Sound compression Re: [squeak-dev] Re: to be deployed Epaati version is out!

Ties Stuij cjstuij at gmail.com
Wed Apr 23 11:46:28 UTC 2008


On Wed, Apr 23, 2008 at 4:46 PM, karl <karl.ramberg at comhem.se> wrote:
> Hi
>  I looked at the project and noticed you did not use sound compression.
>  I think you could save a lot of space using Ogg Vorbis or Speex.

Yes, definitely. And I have actually already fumbled around with
attached changeset, but we had so much to fix and test and so little
time, that we didn't have time to incorporate it. But thanks for the
patch!

>  To compress the sounds you do this:
>    1 File in attached change set
>    2 Open SoundLibraryTool found in Multimedia in ObjectTool
>    3 Select the sound to compress
>    4 Bring up halo on the SoundLibraryTool
>    5 In the halo menu there is a option to compress the sound
>    6 goto3
>
>  Karl
>
> 'From etoys2.3 of 2 December 2007 [latest update: #1849] on 5 January 2008
> at 2:19:47 am'!
>  "Change Set:            SoundLibraryCompress
>  Date:                   5 January 2008
>  Author:                 Karl Ramberg
>
>  Add a halo menu item that GSM compress and replace the selected sound
>  Now also OggVorbis and OggSpeex codec. Prevents the default library sounds
> to be compressed. Stops playing the current sound if its deleted"!
>
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 1/5/2008 02:18'!
>  addCustomMenuItems: aMenu hand: aHand
>         "Add custom menu items to a menu"
>
>         super addCustomMenuItems: aMenu hand: aHand.
>         aMenu addTranslatedList: #(
>                 ('wave editor' edit 'open a tool which, operating with the
> selected sound as a point of departure, will allow you to construct a new
> "instrument"')
>                 ('GSM compress sound' compressWithGSM 'Simple compression')
>                 ('OggSpeex compress sound' compressWithOggSpeex 'Speech
> compression')
>                 ('OggVorbis compress sound' compressWithOggVorbis 'Music
> compression')
>         ) translatedNoop
>  ! !
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/6/2007 09:03'!
>  compressWithGSM
>         "Compress the sound."
>         self compressWith: GSMCodec! !
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/6/2007 09:03'!
>  compressWithOggSpeex
>         "Compress the sound."
>         self compressWith: OggSpeexCodec! !
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/14/2007 23:19'!
>  compressWithOggVorbis
>         "Compress the sound."
>         self compressWith: OggVorbisCodec.
>
>         ! !
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 1/5/2008 02:17'!
>  compressWith: aCodec
>         "Compress the sound."
>         | newSound name writer |
>         soundIndex = 0
>                 ifTrue: [^ self inform: 'No sound selected' translated].
>         name := listBox getList at: soundIndex.
>         (SampledSound universalSoundKeys includes: name)
>                 ifTrue: [^ self inform: 'You can not compress this sound'
> translated].
>         newSound := currentSound compressWith: aCodec.
>         writer := ByteArray new writeStream.
>         newSound channels
>                 do: [:channel | writer nextPutAll: channel].
>         SampledSound removeSoundNamed: name.
>         SampledSound
>                 addLibrarySoundNamed: name
>                 bytes: writer contents
>                 codecSignature: newSound codecSignature.
>         currentSound := SampledSound soundNamed: name! !
>
>  !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/15/2007 00:00'!
>  deleteSound
>         "Delete the selected sound, if appropriate."
>
>          | name |
>         soundIndex = 0
>                 ifTrue: [^ self inform: 'No sound selected' translated].
>         currentSound pause.
>         name := listBox getList at: soundIndex.
>         (SampledSound universalSoundKeys includes: name)
>                 ifTrue: [self inform: 'You can not delete this sound'
> translated]
>                 ifFalse: [ScriptingSystem removeFromSoundLibrary: name].
>         self soundIndex: 0.
>         listBox updateList! !



More information about the Squeak-dev mailing list