Implementing an anti-click crossfade over very short sample times?

Hello,

I’m developing a simple module which is a looping recorder. It’s working, but I’d like to implement an anti-click / crossfade option, so that any new samples recorded into the loop buffer are faded in and out over 5 milliseconds or so.

I can write custom code to do that, but just would like to ask if any of the more cleverer people here knows of functions in the VCV SDK which can help with that? :slight_smile:

Many thanks, Alan.

EDIT: I should point out my current thinking, instead of just asking! :slight_smile: So, when a new recording is started, a rack::dsp::PulseGenerator is triggered, and over the time the PulseGenerator is “high”, its remaining value is used to set the linear / curved crossfade. Same when the recording is stopped. That sound like a good approach, maybe?

I believe the SDK includes a dsp::slewLimiter which might be what you are looking for. Feed your crossfade ratio through that to limit the rate of change.

1 Like

Thanks! :slight_smile:

There’s a crossfade function too, but I haven’t looked into the functionality.

If you want an example of something similar, I wrote code that did basically what you are describing in my Repeat3hr module. Upon detecting a change in the delay time, it fades the volume going into the feedback buffer to zero over the amount of samples remaining until the delayline resets, then fades it back in after the reset, which eliminates almost all discontinuities in the waveform.

1 Like

Thanks! I really should look through the VCV code more. :slight_smile:

I know that this is a very old post, but I’m doing the same thing and wanted to mention that I initially tried using the built-in crossfade function for crossfading between audio, but it didn’t do what I expected and I ended up writing my own.

1 Like

Ahh, I’ve been scratching my head over an issue I’ve been working on, and that might be the root of it.

has anyone tried what @carbon14 suggested so long ago? doesn’t it work?

I read his suggestion to mean using the slewLimiter to control the speed of the crossfade?

Or was he saying, feed all the audio through the slew limiter like a filter? That’s an interesting idea.

I’m still unhappy with my crossfades on my reverse delay module, they’re too audible. But maybe I need to lowpass filter as well.

The dsp::SlewLimiter works great on my next version of Bernoulli Switch when switching A and B audio signals. It solved my switch clicking problem.

Example code can be found in the Fundamental Sequential Switch 1->4 and 4->1 code.

2 Likes

Thanks Dave, I’ll check it out!