How to Fade-In/Fade-Out a Sampled/Repeating/Mixed Sound

Rob Rothwell r.j.rothwell at
Thu May 4 02:25:27 UTC 2006

Does anyone know how to fade a mixed sound?  I am creating a MixedSound
which includes both a RepeatingSound (based on a looped SampledSound from a
WAV file), and an FMSound.

I pretty much know how to apply a VolumeEnvelope to an FMSound by looking at
the exponentialDecay method, but applying a VolumeEnvelope to a
SampledSound, RepeatingSound, or MixedSound seems to have no effect.

For example...

snd := RepeatingSound new.
snd setSound: (SampledSound fromWaveFileNamed: 'aWAVFile.wav') iterations:
snd addEnvelope: (VolumeEnvelope exponentialDecay: 0.96).
snd storeWAVOnFileNamed: 'out.wav'.

...shows no effect on the waveforms in the resulting WAV file, even if I
change the step size of the increments in the exponentialDecay to drag the
decay out much further...

Do I need to write a method to modify the SoundBuffer values of the
SampledSound directly?  If so, I'm afraid I will need much more help!

I just don't know enough technically about sound generation to trace my way
through the updateTargetAt method of the VolumeEnvelope class to figure out
what is going on with a non-FMSound...


-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Squeak-dev mailing list