[squeak-dev] Sound mixing makes nasty noises

tim Rowledge tim at rowledge.org
Thu Dec 17 23:53:00 UTC 2020

Thanks for chiming in (see what I did there?).

> On 2020-12-17, at 11:00 AM, Stéphane Rollandin <lecteur at zogotounga.net> wrote:
>> "no effect from adjustVol..."
>> |snd |
>> snd := FMSound organ1.
>> snd
>> 	duration: 5;
>> 	play.
>> 1 second wait.
>> snd adjustVolumeTo: 1.0 overMSecs: 500.
>> 1 second wait.
>> FMSound brass1
>> 	play.
>> 1 second wait.
>> snd stopGracefully.
> There is no effect because amplitude change is supposed to be driven by an AmplitudeEnvelope (these are the ones that send #adjustVolumeTo:overMSecs:).

That's extra-puzzling because it is the mechanism used in the original Scratch code to control volume and I'd swear it used to work. The other mechanism #loudness: is rather more brutal and makes glitchy noises if used whilst playing.

> Unfortunately, there is already one such envelope active in FMSound organ1, which uses amplitude modulation, so a second one would be ignored anyway.
> What we need is a way to combine several layers of amplitude control; we could start by supporting several AmplitudeEnvelopes in a single AbstractSound.

I'm not very familiar with the workings of the sound system and happy to keep it that way if possible. There is the futzing with the  'scaledVol' value built in to the assorted mix prims & methods, so surely that ought to work?

What would be the 'proper' way to merge multiple sounds with varying volumes? Do you scale all of them? Wouldn't that mean that starting a new sound would make the others go quieter in an odd sounding manner? Do you just clip the final total for every sample?

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
"How many Slavers does it take to change a lightbulb?” 
"Dunno. How susceptible are lightbulbs to telepathy?"

More information about the Squeak-dev mailing list