[squeak-dev] Sound mixing makes nasty noises

Herbert König herbertkoenig at gmx.net
Thu Dec 17 21:10:54 UTC 2020


I'd think if nobody clips early we can just add all simultaneous sounds
(each one after using their own envelope), do that all in Float32 and
then add a limiter like I described. It just must be put at the end of
the audio chain. Either a clever one with lookahed and no clipping at
all or (for live recording and playback with little latency) a
conventional one which changes the gain with a certain attack rate and
has some clipping until the attack is over. Music industry lived with
the latter for decades.

No idea if Squeak's sound architecture is suitable for that, it seems
the conversion to Integer happens too early. But it was done with 16 Bit
DSPs so some search or thinking should uncover that.

So first question: Where is the place, where the audio samples are
handed to the OS?
Second question: Are there more places than the diverse
mixSampleCount:into:startingAt:leftVol:rightVol: which are responsible
for clipping.

Cheers,

Herbert

Am 17.12.2020 um 20:00 schrieb Stéphane Rollandin:
>> "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:).
>
> 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.
>
> Stef
>



More information about the Squeak-dev mailing list