The C++ code for the main processing loop of Freeverb is shown in Fig.3.9. Notice that it sums the two stereo input channels to create a mono signal that is fed to the reverberator, which then computes a stereo output signal.
void revmodel::processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip) { float outL,outR,input; int i; while(numsamples-- > 0) { outL = outR = 0; input = (*inputL + *inputR) * gain; // Accumulate comb filters in parallel for(i=0; i<numcombs; i++) { outL += combL[i].process(input); outR += combR[i].process(input); } // Feed through allpasses in series for(i=0; i<numallpasses; i++) { outL = allpassL[i].process(outL); outR = allpassR[i].process(outR); } // Calculate output REPLACING anything already there *outputL = outL*wet1 + outR*wet2 + *inputL*dry; *outputR = outR*wet1 + outL*wet2 + *inputR*dry; // Increment sample pointers, allowing for interleave // (if any) inputL += skip; // For stereo buffers, skip = 2 inputR += skip; outputL += skip; outputR += skip; } } |
From the code in Fig.3.9, we see that the left and right reverberator output channels outL and outR are combined with the left and right input channels inputL and inputR as follows:
The dry parameter (initially set to 0 in tuning.h, and typically changed using a graphical user interface (GUI)), determines how much of the original (stereo) input signal is mixed to the output, and wet1 and wet2 determine how much of the reverberated signal is mixed to the output, and also how much ``stereo separation'' occurs in the reverberation. In particular, if , there is no stereo separation since the same reverberator output signal is sent to the left and right output channels. (Note that there is no decorrelating delay-line like we saw at the output of JCRev in Fig.3.7.) Setting yields maximally different left and right reverberation signals, thus maximizing ``stereo separation'' in the reverb. The default values, determined by tuning.h and revmodel.cpp, are and .