Adding a tape-delay style repitch when changing delay time

Hi! I’m working on my first delay plugin. I’ve made my own delay class where i’m using an array of two juce::dsp::delayLine objects. Currently I’m using this setTime function to set the delay times with a juce::SmoothedValue.

void Delay::setTime(double bpm)
{
    const int subdivisionIndex = getSyncTime();
    const float selectedSubdivision = subdivisions[subdivisionIndex];
    
    if (getSync())
    {
        delayInSamples = (60 / bpm) * selectedSubdivision * sampleRate;
    }
    else
    {
        delayInSamples = getTime() / 1000 * sampleRate;
    }
    
    smoothDelayTime.setTargetValue(delayInSamples);
}

(I use .setDelay(smoothDelayTime.getNextValue()) for both delayLines in the process function)
How would I go about implementing a tape delay style repitching effect?

Thanks!

Smoothing the delay time should do it, though you may need to mess around with a longer smoothing time if it’s not audible, even as high as 100-150 milliseconds.

You should also make sure that you only call smoothDelayTime.getNextValue() once per sample. When you call getNextValue() it advances the counter used internally in the SmoothedValue class, so if you call this twice per sample you will double the set rate for the smoother. What I usually do is save the result of getNextValue() to a temporary variable in the process function and use that for updating the DSP on both channels.

This will achieve the basic effect but you could check out AES papers like " A Digital Model of the Echoplex Tape Delay" which go in-depth on the specifics of modeling of tape delay behavior.

Hope that helps!
-Cameron

2 Likes