[squeak-dev] Sound mixing makes nasty noises
lecteur at zogotounga.net
Fri Dec 18 01:12:27 UTC 2020
> There is the futzing with the 'scaledVol' value built in to the assorted mix prims & methods, so surely that ought to work?
Yes, but that scaledVol value is already set to change cyclicly (is that
a word?) in FMSound organ1 in order to modulate the base sine wave and
give it some timbre. If we attempt to use that same value to control the
overall loudness, we will lose the timbre. In fact we would need to
multiply the timbral volume envelope with the loudness one, but this is
not trivial because the first one uses a loop.
> What would be the 'proper' way to merge multiple sounds with varying volumes? Do you scale all of them?
Yes, and whether or not their volumes are varying, the sounds must have
been scaled beforehand to ensure there is enough headroom for their
superposition. This again is not trivial, because of the way
interference works: adding two sounds can potentially double the height
of their amplitude peaks, where they interfere constructively, but can
also, where they interfere destructively, lead to a lower volume (for an
extreme example, if you mix a signal with its exact mirror you will get
a plain silence).
More information about the Squeak-dev