# How can I calculate Reverberation Time (RT60) from the Room Impulse Response using Python?

I have the following Room Impulse Response(RIR) in wave format here. I wanted to calculate Reverberation Time (RT60) of it by plotting its Energy Decay Curve using this Python code.

The RIR is mostly zeros after the first 120ms. Plotting the Energy Decay Curve of the whole signal gives the graph below.

From this graph it looks like after 120ms the signal is decaying very slowly and looks like never going to come down below -60dB, which is confusing to me. If I truncate the signal after 120ms, I am getting different curves for different truncation. It seems like we will get different RT60, depending on how many trailing zeros the RIR has. I went through the MATLAB example here but needs to do the same with Python.

1. How can I properly calculate RT60 from the RIR using Python code?

2. What is wrong with my approach here?

3. How can few trailing zeros can make difference in the RT60 of an RIR?

You have a noisy measurement and the Schroeder reverse integration method is fairly sensitive to this. In order to see a decay down to -60 dB you need to have a low enough noise floor, which you don't.

You need to model your measured impulse response as $h'(t) = h(t) + n(t)$, where h(t) is the true impulse response and n(t) some stationary noise of constant amplitude. You need to find the delay where the power in h(t) is similar to $\sigma_{nn}$, the noise power. A simple method to do this would be just plot the log magnitude of the measured impulse response with a little bit of time smoothing. In the early part of there should be a clearly visible decay (impulse response dominated), the later part of the plot should be flat (noise dominated). Intersect the two lines, and use that as as the truncation point.

This should be done in relatively narrow frequency bands (octaves or third octaves): Both reverb time and noise floor vary significantly with frequency, so doing this for a broad band signal doesn't make a lot of sense. There is no such thing as a single "reverb time of a room".

• Thanks for the information. As per the last graph, it goes from 0 to -40dB in 0.35ms. i.e. around 0.1142dB/ms. If I expect that to continue and Ignore the noise, it should reach at -60dB by 0.52ms. Isn't that a fair approximation? – SAJIL C K Mar 30 '18 at 14:22
• Maybe. It really depends on how straight or decay curve is, If there is any significant curving, you can't extrapolate – Hilmar Mar 30 '18 at 15:56

why is the RIR signal truncated at all?

you can see that the slope in the first 250 ms is decaying at a steeper slope than after 300 ms. after that, it looks like it's decaying 10 dB in ca. 400 ms.

so from -25 dB to an extrapolated -60 dB, that 35 dB might take maybe a $\tfrac{35}{10} \times$ 400 = 1400 ms added to 300 ms..

so maybe RT60 = 1.7 seconds.

just a guess.

• Hi, Thanks for the idea. The RIR is of a small room (2.9*2.14*3.1), so I expect the RT60 to be less than a second. – SAJIL C K Mar 30 '18 at 14:26