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.
3 Likes
Sweet thank you for the reply!
1 Like
Hi @langermarc19 , I have exactly the same question that you expose here. I would like to know if finally you did the interpolation catmull rom and if you could point me how you implemented it.
I have seen that JUCE class but I have no idea how to use it.
Thanks,
Raul
Hi Raul,
Are you curious just about how to implement this class or are you wanting to know more conceptually how the interpolation should work in general?
Well, following the @jcomusic comment I saw that I need to do 2 things to avoid these artifacts.
- Calculate the delay position per sample.
- Implement a Catmull ROM interpolation for the delay time parameter.
Regarding the 2nd, I have found this class:
◆ CatmullRom
using Interpolators::CatmullRom = GenericInterpolator<CatmullRomTraits, 4>
Anyway, this class has no functions in it, so I don’t undertand what it is and how to use it.
Regarding the 1st point, I have no idea either how to calculate that sample per sample. It would be useful if you could point me where could I find information about that.
About your question, I think I’m interested in both, the implementation and the interpolation working in general, since I have never used it yet.
Thanks so much