0
$\begingroup$

Here's my basic understanding of how to implement a convolution reverb:

  1. I measure the IR of a space using a sine sweep. The raw mic output is stored as a Voltage-Time data set. Let's assume that this recording is 5s long.

  2. I run a fft on the recorded mic output to derive the Mag and Phase at every frequency bin. Call this the "IR Buffer".

  3. Next, I have my music source. Let's say it's a vocal track that's playing in real-time. I record this vocal track into a 5s buffer.

  4. Similar to step 2, I run a fft to extract the vocal track buffer's Mag and Phase values at every frequency.

  5. Then, I multiply the Mag and Phase values of the vocal track with that of the IR Buffer at every frequency bin.

  6. Finally, I run a ifft on the multiplied buffer and play the output as the reverb'd vocal track.

Is my understanding above correct?

What I'm very uncertain about is that it looks more like I've created a simple EQ rather reverb.

More specifically, I can't figure out how to extract and apply the time-variant Mag and Phase characteristic of the reverb space. For example, there's a certain decay time for 100Hz in the space, which means that Mag and Phase varies with time for this frequency. How is this time-variant component added to the vocal track?

$\endgroup$

2 Answers 2

2
$\begingroup$
  1. First, you have to extract the Room Impulse Response (RIR) of the space from your sine sweep recordings. You can do this by taking the ratio of the FFTs of the measured response and sine sweep input and then taking its IFFT, rir = ifft(fft(measured, Nfft)./fft(sin_sweep,Nfft)). I generally use Nfft = 2^nextpow2(length(measured))
  2. You can truncate the RIR to $L$ samples, depending on how long the reverb tail is.
  3. Break your music source into frames of $M$ samples.
  4. For each frame, you want to convolve a signal of length $M$ with the RIR of length $L$. The output of the resultant convolution will be $M+L-1$ samples. So you have to pick an FFT size accordingly. Then multiply the FFT of the current frame of the signal, with the FFT of the RIR.
  5. The final step is overlap add.

Here is some MATLAB style code.

% sig - Input signal
% rir - Room Impulse Response extracted from sine sweep
% M - length of each frame
% L - length of the RIR 

nframes = round(length(sig)/M));
Nfft = 2^nextpow2(L+M-1);
conv_sig = zeros(nframes*M,1);
for frame_no = 1:nframes
    sig_frame = sig((frame_no-1)*M+1:frame_no*M);
    conv_frame = ifft(fft(sig_frame,Nfft).*fft(rir,Nfft));
    conv_frame = conv_frame(1:M+L-1);
    conv_sig((frame_no-1)*M+1:frame_no*M+L-1) = conv_sig((frame_no-1)*M+1:frame_no*M+L-1)+conv_frame
end
$\endgroup$
2
  • $\begingroup$ Thanks for your explanation. The link you shared is also very helpful! However, I'm still uncertain about how the time-variant component is accounted for if we simply convolve the M-sample music stream with a "static" L-sample RIR. Could you elaborate? $\endgroup$
    – Joel
    Apr 25, 2021 at 12:54
  • $\begingroup$ RIRs are generally assumed to be static. They are LTI (linear and time-invariant) systems. Sometimes, if L is very large, then the RIR itself is broken into windows, and convolved with the windowed signal. There also we must ensure that overlap add is done properly. $\endgroup$
    – orchi_d
    Apr 26, 2021 at 18:31
2
$\begingroup$

More specifically, I can't figure out how to extract and apply the time-variant Mag and Phase characteristic of the reverb space.

A real acoustic reverb does not have any time variant characteristics. It's an LTI system, at least as long as nothing is moving around in the roon.

For example, there's a certain decay time for 100Hz in the space, which means that Mag and Phase varies with time for this frequency. How is this time-variant component added to the vocal track?

The decay times at all frequencies are baked into the room impulse response (RIR). Filtering with the RIR will transfer all characteristics of the reverb to the vocal track. Keep in mind that the RIR is very long (tens of thousands of samples) so the spectral resolution is extremely high. The impulse response of an EQ would be a lot shorter.

$\endgroup$
2
  • $\begingroup$ To clarify, let's say we have a RIR recording that's 5s long. How long should the fft window be when we're calculating the RIR? If we used a 5s fft window (whatever its equivalent in samples given the SR), we would lose all time resolution. So I'm guessing that we'd instead segment it into (arbitrarily) 1s slices, run an fft on each of the 5 slices, then finally recombine them? In this way, we would preserve the decay time at every frequency, where the time resolution of the decay time characteristic is proportional to the fft window size? $\endgroup$
    – Joel
    Apr 26, 2021 at 2:21
  • $\begingroup$ The two methods you describe are identical (if you implement them correctly). Note that the FFT length needs to to be twice the length of the impulse response. FFT multiplication implements circular convolution not linear convolution. Hence you need to implement zero padding and overlap add. Your basic intuition about the time variance of reverb is incorrect. Reverb it LTI and simple convolution is all that's needed. $\endgroup$
    – Hilmar
    Apr 26, 2021 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.