[LAD] Click-free fade-in algorithm for synths?

Will J Godfrey WillGodfrey at musically.me.uk
Wed Sep 25 09:07:03 CEST 2019


On Tue, 24 Sep 2019 19:12:47 -0400
Tim <termtech at rogers.com> wrote:

>On 9/24/19 4:26 PM, Paul Davis wrote:
>> 
>> 
>> On Tue, Sep 24, 2019 at 12:38 PM Johannes Lorenz <j.spam at lorenz-ho.me 
>> <mailto:j.spam at lorenz-ho.me>> wrote:
>> 
>>     Counting zero crossings prevents
>>     clicking on lower notes, and it makes higher notes more punchy.
>> 
>> 
>> There's fundamentally no such thing as a zero crossing. You might have 
>> two samples on either side of zero, but you still don't have a sample 
>> *at* zero, so in the general case, truncating one of them to zero and 
>> starting/ending there is still going to give you distortion and/or 
>> noise. Obviously there may be cases where one of them is close enough to 
>> zero for this not to be be an issue, but it's not a general method.
>> Ardour applies declick fades every time the transport starts and stops. 
>> You can read about how we do it here:
>> 
>> https://github.com/Ardour/ardour/blob/master/libs/ardour/ardour/disk_reader.h#L135
>> https://github.com/Ardour/ardour/blob/master/libs/ardour/disk_reader.cc#L1445
>> https://github.com/Ardour/ardour/blob/master/libs/ardour/amp.cc#L163  
>
>Hi Paul. Thanks, I was going to mention that.
>
>We had a similar conversation a few years ago when I was adding
>  anti-zipper noise to MusE, and I inquired about zero-crossing methods.
>
>I replied that TV and amplifier electronic volumes use zero-crossing,
>  so why not use it?
>
>But I conceded the very point you mention above, ie. where exactly is
>  the crossing point.
>And it is dependent on frequency so you get a different attack result
>  each time.
>
>In a TV or amp volume chip it's OK but here, meh...
>
>So in the end, looking at the code given above, I can see I did much
>  the exact same thing as Ardour, using a fixed coefficient value
>  driven by time passage (sample rate).
>
>Cheers.
>Tim.


Just like to add, that on a complex waveform with a strong harmonic content it's
quite likely to cross the zero point 2-3 times during each cycle of the
fundamental.

-- 
It wasn't me! (Well actually, it probably was)

... the hard part is not dodging what life throws at you,
but trying to catch the good bits.


More information about the Linux-audio-dev mailing list