Smoothing Artifacts in Blockwise Processing For Delay

Hi All,

I’m fairly new to JUCE development and DSP. I built a delay plugin based on “The Audio Programmer” youtube tutorial (https://www.youtube.com/watch?v=IRFUYGkMV8w), and then added my own UI parameters, etc. Each time processBlock gets called, the code takes audio from the main buffer, copies it into a delay buffer, runs the delay back into the main buffer offset by a read pointer calculated using the delay time, and then feeds the output back into the delay buffer for feedback. That part seems to be standard for a circular buffer.

When I change the delay time in the UI, I don’t get the characteristic pitch-shifting effect of other delay plugins and instead I tend to get clicks and pops. I think this is due to the delay time being set and called on each block rather than sample-by-sample. (If i’m wrong would love to get pointed in the right direction!).

MY QUESTION IS: is there a way to smooth out these artifacts without re-writing the code to recalculate the read pointer on each sample? Can we maintain the processing for each block (which seems to have some efficiency advantages?) and remove the artifacts/get the standard pitch-shift effect?? Thanks!

There is no way around it, you need to calculate the delay position per sample. Simple exponential smoothing will do, but make sure to calculate the coefficients based on the current sample rate. This position will need to be sub-sample accurate and you should incorporate at least a simple resampling scheme to avoid aliasing artifacts. Easiest is linear interpolation, catmull rom will yield better results, if you really want to have it “perfect” you’ll need to come up with a sinc based resampling scheme.

1 Like

Sweet thank you for the reply!

1 Like