Typo in the Reverb algorithm


#1

Hello Jules !

There is a typo in your reverb algoritm. The processMono function should be written like this :

void processMono (float* const samples, const int numSamples) noexcept
{
        jassert (samples != nullptr);

        if (shouldUpdateDamping)
            updateDamping();

        for (int i = 0; i < numSamples; ++i)
        {
            const float input = samples[i] * gain;
            float output = 0;

            for (int j = 0; j < numCombs; ++j)  // accumulate the comb filters in parallel
                output += comb[0][j].process (input);

            for (int j = 0; j < numAllPasses; ++j)  // run the allpass filters in series
                output = allPass[0][j].process (output);

            // better !
            samples[i] = output * wet1 + samples[i] * dry * 0.5f;
            
            // wrong, because of the gain, and the dryScalefactor
            //samples[i] = output * wet1 + in * dry;

        }
}

 


#2

Ah, good catch! Many thanks!


#3

Hello Jules !

I have a question. In the function setParameters of the reverb, there is this code :

const float wetScaleFactor = 3.0f;
const float dryScaleFactor = 2.0f;

What is its use ? In the fix I proposed for the processMono, I added a 0.5f multiplication to compensate this, since I want the effect to be equivalent to a bypass when the dry parameter is one, and the wet parameter is zero. I thought it was some kind of compensation for stereo signals, but you didn't add my extra multiplication when you fix the bug on the processMono function...
 


#4

IIRC that's there to make the parameters compatible with the parameters for the old Freeverb plugin which this class emulates. 

True, it's a bit odd that the value is 2.0, and I'm not sure why that's the case. But I obviously can't change its behaviour now, because that'd mean that all existing code which uses a Reverb object would suddenly produce different output.