How can I mix a WAV file with SequentialSound(s)?

Benjamin Schroeder benschroeder at
Mon Jan 23 13:26:07 UTC 2006

On Jan 22, 2006, at 11:36 AM, Rob Rothwell wrote:

> For example, I would like to take a 30 minute set of SequentialSound 
> (s) and mix it with a randomly looped sample of [rain] sounds, and  
> I have absolutely no idea how to proceed!
> For simplicity, I am probably asking the following questions:
> 1.  How do I create a randomly looped track from a sample sound?
> 2.  How do I mix that new track with a set of SequentialSound(s)?
> 3.  Will that new track be another set of SequentialSounds that I  
> can then write to a WAV file?

Hi Rob,

If you have a sound called "rain" and another sound called "notes",  
you can use MixedSound to play them over the top of one another (this  
works with sampled sounds as well as generated notes):

     mixed := MixedSound new.
     mixed add: rain.
     mixed add: rain.

     mixed play.

The new sound will be as long as it needs to be to play each of its  
sub-sounds. add:pan:volume: can be used to control the volume level  
of each sub-sound.

I don't know about the looping - I guess a cheap way would be to use  
SequentialSound to play your sample over and over, as many times as  
you need. (You could cut the last one short, if needed, or if you're  
selecting from a set of samples, try to work out the selections so  
they ended up at the same time as the notes.)

You can use storeWAVOnFileNamed: to write the MixedSound out to disk.

Hope this helps,
Ben Schroeder

More information about the Squeak-dev mailing list