Hello folks, I hope you are well.
Hoping to get some help with smoothing my delayTimes to eliminate artifacts. The goal is to create a delay plugin that pitch shifts as the delayTime is changed, i.e. the Doppler effect.
Prototyping in SuperCollider has shown me that a control rate delay with no interpolation can still produce this response, yet I have had no luck in JUCE. Here is my process block. delayTime is set in the value tree and retrieved with delayTime.get().
void ModDelayAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
if (mustUpdateProcessing)
update();
juce::SmoothedValue<float, ValueSmoothingTypes::Linear> delaySmoothed;
delaySmoothed.setTargetValue(delayTime.get() * mSampleRate / 1000); // delay in samples
delaySmoothed.reset(buffer.getNumSamples());
// initial tap
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* buffRead = buffer.getReadPointer (channel);
auto* buffWrite = buffer.getWritePointer(channel);
for (int i = 0; i < buffer.getNumSamples(); ++i)
{
delayLine.pushSample(channel, buffRead[i]);
auto dTime = delaySmoothed.getCurrentValue();
float sample = delayLine.popSample(channel, dTime, true);
buffWrite[i] = sample;
}
}
}
This text will be hidden