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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Rob Rothwell
Can anyone point me in the right direction to figure out how to mix a set of SequentialSound(s) with a preexisting recording (say, a .WAV file)?

I figured out how to create a series of tones using the MixedSound and SequentialSound classes, but now I would like to overlay them with a background recording, preferably by looping a small sample ( i.e. rain, waves, river noise, etc...).

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?

I am certainly not a sound-engineering type who will easily understand how to do this at the level of these mysterious-seeming sound envelopes, and I am pretty new to Squeak, so I have to admit I am hoping that I have just not found some built-in Squeak functionality that can accomplish this task!

Thanks,

Rob Rothwell


Reply | Threaded
Open this post in threaded view
|

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

Benjamin Schroeder

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