Insert Reverb algorithm in a GUI Application


#1

Hi! I’m making a GUI App that’s a simple guitar clean booster/amplifier and i would like to add a reverb to it.

I’ve found this algorithm:

int numlines = 8;
float t1 = 50.0; // d0 time
float g1 = 0.75; // d0 gain
float rev = -3*t1 / log10 (g1);

for (int n = 0; n < numlines; ++n)
{
float dt = t1 / pow (2, (float (n) / numlines));
float g = pow (10, -((3*dt) / rev));
printf (“d%d t=%.3f g=%.3f\n”, n, dt, g);
}

And my getNextAudioBlock () is:

void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
{
    const float* inBuffer = bufferToFill.buffer->getReadPointer(selChannel);
    
    float* outBufferL = bufferToFill.buffer->getWritePointer(0);
    float* outBufferR = bufferToFill.buffer->getWritePointer(1);
    
    for (int sample = 0; sample < bufferToFill.buffer->getNumSamples(); ++sample)
    {
        float x = level;
        outBufferL[sample] = inBuffer[sample] * ((x > 0) ? (1 - exp( -x )) : (-1 + exp( x ))) * colour;
        outBufferR[sample] = inBuffer[sample] * ((x > 0) ? (1 - exp( -x )) : (-1 + exp( x ))) * colour;
    }
}

So, how can I implement the algorithm?


#2

Implementing a convincing reverb effect is a difficult task and requires a lot of knowledge of both DSP and C++ programming. JUCE contains a Reverb class that does the job and is easy to implement - you just need to set it up with your desired parameters and then call the processStereo() or processMono() method to apply the effect to your audio data. However if you really want to make your own reverb, I’d recommend that you get familiar with simpler DSP concepts like circular buffers and delay lines beforehand. This webpage is a great resource for getting started.

Ed


#3

Thanks, I will take a look…
Meanwhile I’ve inserted a Stereo Chorus to my app from here:

It sounds pretty good with a mic, but if I insert a guitar in my External Audio Card, I ear many noise, even at low gain values…
I this that the problem is the impedance input signal of the mic (low-Z) and the guitar (hi-Z).
Does anybody know how I can modify the input buffer pointer (mono) to avoid that problem?