Skip to main content
L(td:-1:1)==10*log10(cumsum(hA(td:-1:1).^2)/sum(hA(1:td).^2));
L(td:-1:1)=(cumsum(hA(td:-1:1))/sum(hA(1:td)));
L(td:-1:1)=10*log10(cumsum(hA(td:-1:1).^2)/sum(hA(1:td).^2));
fixed grammar
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75

Encouraged by Hilmar, I've decided to update the answer with all the steps necessary to calculate the Reverberation Time from a scratch. Presumably, it will be useful for others interested in this area. Obviously, it is athe simplest approach because more advanced are definitely beyond a scope.

In the beginning, you must obtain the impulse response of a room. It can be done onin various ways:

  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omnidirectional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with a usage of either linear or exponential sweep. This method is my favouritefavorite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.

Very first step is to filter your impulse response in an appropriate frequency band. This is due to fact that reverberation time is a function of position in the room and frequency. Obviously, we assume that sound field is diffused and at each position in a room decay rate is the same. Thus we must still consider dependency on the frequency band. We are using 1/1 octave or 1/3 octave filters. Its desired parameters are defined by EN 61260 standard, preferably you always wish to use the filter of class 0. For most of the time, Butterworth 3rd order filter is enough (although for frequencies below 125 Hz you might experience some problems with characteristic not meeting specifications). I did the whole implementation on my own with few tweaks, but for usual applications widely used MATLAB implementation is good enough.

Next step after filtering the $h(t)$ and obtaining $h_f(t)$, is to make the response as smooth as possible before conversion to the logarithmic scale. For that purpose, Hilbert Transform is a widely used tool. The goal is to create the analytic signal:

where $A(t)$ is the envelope of your signal and $\psi (t)$ is aan instantaneous phase. Obviously, we are interested mainly in the envelope (magnitude of the analytic signal). Below you can see overlayed filtered response and its envelope:

And on the following figure you can observe the effect of smoothing of the previously calculated energy curve ($A(t)$ in logarithmic scale becomes $E(t)$) for two different values of $M$. For sampling frequency of $48\mathtt{kHz}$ I've used $M=5001$.

Mind that limit of integration (td) is equal to $\infty$. It is true when we do not have any environmental noise. Otherwise, you will see that decaying sound 'dives into noise level'. It is depicted below. RedThe red curve is based on the correct limit, where decay crosses noise floor. If you choose your limit of integration to be too short, then as in green curve, the estimate is not long enough, so you will get under-estimation while doing linear interpolation. On the contrary, the orange curve has too large integration limit and you will get over-estimated. You always want to find the correct limit. If you didn't obtainedobtain curve in such way, then please do so.

Regarding calculation of RT itself. It must be done by performing linear interpolation of your decay curve (or should I say, Schroeder curve) with linear function: $L=A\cdot t+B$ on the correct range (which is described below). When it's done, you calculate the reverberation time from the equation. You can see that point of intercept doesn't really matter (per se), you care about the gradient of your line.

Finally - limits. You cannot really calculate $T_{60}$ having $60 \mathtt{dB}$ of dynamic range as you are trying to do - you always need more (unless you really know what you are doing). So you are doing linear fit on decay curve at following dynamic ranges, and the result is being extrapolated, according to ISO 3382-2:

  • $EDT$ (Early Decay Time): upper limit is $0 \mathtt{dB}$ and lower is $-10 \mathtt{dB}$. This parameter correlates well with perceived reverberation time. In practice, though beginning for the sake of algorithms, people are using an interval of $-1 \mathtt{dB}$ and $-10 \mathtt{dB}$ (i.e. in Norsonic analysersanalyzers).

  • $T_{10}$: upper limit must start at $-5 \mathtt{dB}$ to remove any fluctuations and then lower limit is taken to be $-15 \mathtt{dB}$, but it always must be at least $10 \mathtt{dB}$ above the noise floor. So in fact you need at least $25 \mathtt{dB}$ of dynamic range (or INR) to be able to calculate $T_{10}$ ($5+10+10$).

  • $T_{20}$: upper limit at $-5 \mathtt{dB}$, lower at $-25 \mathtt{dB}$. Minimum dynamic range needed is $35\mathtt{dB}$

  • $T_{30}$: upper limit of $-5 \mathtt{dB}$, lower at $-35 \mathtt{dB}$, with minimum $45 \mathtt{dB}$ of dynamic range.

Why people are people using these values? Well, because you very rarely have $75 \mathtt{dB}$ of dynamic range to be able to estimate $T_{60}$. For very smooth decay these values should be equal. Some more detailed analysis of effects can be found in this publication:

If you will not perform Schroeder integration, then most probably they will diverge a lot. For the very nasty room you can get something like:

In theory: $EDT$ = $T_{10}$ = $T_{20}$ = $T_{30}$. Although they are not necessarily going to be. For example, if your small room is coupled with large one (let's think of small chapel coupled with cathedral by a small doorway), then you will get very sharp decay for smaller one at the beginning of the curve, and very long tail in the end:

To wrap up. According to standards, you should always estimate your reverberation time $T_{N}$ starting from $-5 \mathtt{dB}$ and down to $(-5-N) \ \mathtt{dB}$. Also, ensure that you are at least $10 \mathtt{dB}$ above the noise floor. If not, then you must use otheranother estimate. In your case, I suggest to useusing the $T_{30}$.

I think that should do. If anyone will follow these steps, then he should get an accuracy of $0.1 \mathtt{s} $ against widely used Dirac. Anyway, it must be remembered that even different softwaressoftware tend to give different results (i.e. EASERA and Dirac), so you should be totally fine. For more complicated impulse responses with artifacts at the end of impulse response one might get worse performance, but anyway, such measurements are not reliable and reflect wrongly conducted an experiment.

Encouraged by Hilmar, I've decided to update the answer with all the steps necessary to calculate the Reverberation Time from a scratch. Presumably it will be useful for others interested in this area. Obviously it is a simplest approach because more advanced are definitely beyond a scope.

In the beginning you must obtain the impulse response of a room. It can be done on various ways:

  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omnidirectional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with usage of either linear or exponential sweep. This method is my favourite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.

Very first step is to filter your impulse response in appropriate frequency band. This is due to fact that reverberation time is a function of position in the room and frequency. Obviously we assume that sound field is diffused and at each position in a room decay rate is the same. Thus we must still consider dependency on frequency band. We are using 1/1 octave or 1/3 octave filters. Its desired parameters are defined by EN 61260 standard, preferably you always wish to use the filter of class 0. For most of the time Butterworth 3rd order filter is enough (although for frequencies below 125 Hz you might experience some problems with characteristic not meeting specifications). I did whole implementation on my own with few tweaks, but for usual applications widely used MATLAB implementation is good enough.

Next step after filtering the $h(t)$ and obtaining $h_f(t)$, is to make the response as smooth as possible before conversion to logarithmic scale. For that purpose Hilbert Transform is a widely used tool. The goal is to create the analytic signal:

where $A(t)$ is the envelope of your signal and $\psi (t)$ is a instantaneous phase. Obviously we are interested mainly in envelope (magnitude of analytic signal). Below you can see overlayed filtered response and its envelope:

And on following figure you can observe the effect of smoothing of the previously calculated energy curve ($A(t)$ in logarithmic scale becomes $E(t)$) for two different values of $M$. For sampling frequency of $48\mathtt{kHz}$ I've used $M=5001$.

Mind that limit of integration (td) is equal to $\infty$. It is true when we do not have any environmental noise. Otherwise you will see that decaying sound 'dives into noise level'. It is depicted below. Red curve is based on the correct limit, where decay crosses noise floor. If you choose your limit of integration to be too short, then as in green curve, the estimate is not long enough, so you will get under-estimation while doing linear interpolation. On the contrary, orange curve has too large integration limit and you will get over-estimated. You always want to find the correct limit. If you didn't obtained curve in such way, then please do so.

Regarding calculation of RT itself. It must be done by performing linear interpolation of your decay curve (or should I say, Schroeder curve) with linear function: $L=A\cdot t+B$ on the correct range (which is described below). When it's done, you calculate the reverberation time from equation. You can see that point of intercept doesn't really matter (per se), you care about gradient of your line.

Finally - limits. You cannot really calculate $T_{60}$ having $60 \mathtt{dB}$ of dynamic range as you are trying to do - you always need more (unless you really know what you are doing). So you are doing linear fit on decay curve at following dynamic ranges, and result is being extrapolated, according to ISO 3382-2:

  • $EDT$ (Early Decay Time): upper limit is $0 \mathtt{dB}$ and lower is $-10 \mathtt{dB}$. This parameter correlates well with perceived reverberation time. In practice though beginning for the sake of algorithms, people are using interval of $-1 \mathtt{dB}$ and $-10 \mathtt{dB}$ (i.e. in Norsonic analysers).

  • $T_{10}$: upper limit must start at $-5 \mathtt{dB}$ to remove any fluctuations and then lower limit is taken to be $-15 \mathtt{dB}$, but it always must be at least $10 \mathtt{dB}$ above the noise floor. So in fact you need at least $25 \mathtt{dB}$ of dynamic range (or INR) to be able to calculate $T_{10}$ ($5+10+10$).

  • $T_{20}$: upper limit at $-5 \mathtt{dB}$, lower at $-25 \mathtt{dB}$. Minimum dynamic range needed is $35\mathtt{dB}$

  • $T_{30}$: upper limit of $-5 \mathtt{dB}$, lower at $-35 \mathtt{dB}$, with minimum $45 \mathtt{dB}$ of dynamic range.

Why people are using these values? Well, because you very rarely have $75 \mathtt{dB}$ of dynamic range to be able to estimate $T_{60}$. For very smooth decay these values should be equal. Some more detailed analysis of effects can be found in this publication:

If you will not perform Schroeder integration, then most probably they will diverge a lot. For very nasty room you can get something like:

In theory: $EDT$ = $T_{10}$ = $T_{20}$ = $T_{30}$. Although they are not necessarily going to be. For example if your small room is coupled with large one (let's think of small chapel coupled with cathedral by a small doorway), then you will get very sharp decay for smaller one at the beginning of curve, and very long tail in the end:

To wrap up. According to standards, you should always estimate your reverberation time $T_{N}$ starting from $-5 \mathtt{dB}$ and down to $(-5-N) \ \mathtt{dB}$. Also ensure that you are at least $10 \mathtt{dB}$ above the noise floor. If not, then you must use other estimate. In your case I suggest to use the $T_{30}$.

I think that should do. If anyone will follow these steps, then he should get accuracy of $0.1 \mathtt{s} $ against widely used Dirac. Anyway it must be remembered that even different softwares tend to give different results (i.e. EASERA and Dirac), so you should be totally fine. For more complicated impulse responses with artifacts at the end of impulse response one might get worse performance, but anyway such measurements are not reliable and reflect wrongly conducted experiment.

Encouraged by Hilmar, I've decided to update the answer with all the steps necessary to calculate the Reverberation Time from a scratch. Presumably, it will be useful for others interested in this area. Obviously, it is the simplest approach because more advanced are definitely beyond a scope.

In the beginning, you must obtain the impulse response of a room. It can be done in various ways:

  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omnidirectional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with a usage of either linear or exponential sweep. This method is my favorite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.

Very first step is to filter your impulse response in an appropriate frequency band. This is due to fact that reverberation time is a function of position in the room and frequency. Obviously, we assume that sound field is diffused and at each position in a room decay rate is the same. Thus we must still consider dependency on the frequency band. We are using 1/1 octave or 1/3 octave filters. Its desired parameters are defined by EN 61260 standard, preferably you always wish to use the filter of class 0. For most of the time, Butterworth 3rd order filter is enough (although for frequencies below 125 Hz you might experience some problems with characteristic not meeting specifications). I did the whole implementation on my own with few tweaks, but for usual applications widely used MATLAB implementation is good enough.

Next step after filtering the $h(t)$ and obtaining $h_f(t)$, is to make the response as smooth as possible before conversion to the logarithmic scale. For that purpose, Hilbert Transform is a widely used tool. The goal is to create the analytic signal:

where $A(t)$ is the envelope of your signal and $\psi (t)$ is an instantaneous phase. Obviously, we are interested mainly in the envelope (magnitude of the analytic signal). Below you can see overlayed filtered response and its envelope:

And on the following figure you can observe the effect of smoothing of the previously calculated energy curve ($A(t)$ in logarithmic scale becomes $E(t)$) for two different values of $M$. For sampling frequency of $48\mathtt{kHz}$ I've used $M=5001$.

Mind that limit of integration (td) is equal to $\infty$. It is true when we do not have any environmental noise. Otherwise, you will see that decaying sound 'dives into noise level'. It is depicted below. The red curve is based on the correct limit, where decay crosses noise floor. If you choose your limit of integration to be too short, then as in green curve, the estimate is not long enough, so you will get under-estimation while doing linear interpolation. On the contrary, the orange curve has too large integration limit and you will get over-estimated. You always want to find the correct limit. If you didn't obtain curve in such way, then please do so.

Regarding calculation of RT itself. It must be done by performing linear interpolation of your decay curve (or should I say Schroeder curve) with linear function: $L=A\cdot t+B$ on the correct range (which is described below). When it's done, you calculate the reverberation time from the equation. You can see that point of intercept doesn't really matter (per se), you care about the gradient of your line.

Finally - limits. You cannot really calculate $T_{60}$ having $60 \mathtt{dB}$ of dynamic range as you are trying to do - you always need more (unless you really know what you are doing). So you are doing linear fit on decay curve at following dynamic ranges, and the result is being extrapolated, according to ISO 3382-2:

  • $EDT$ (Early Decay Time): upper limit is $0 \mathtt{dB}$ and lower is $-10 \mathtt{dB}$. This parameter correlates well with perceived reverberation time. In practice, though beginning for the sake of algorithms, people are using an interval of $-1 \mathtt{dB}$ and $-10 \mathtt{dB}$ (i.e. in Norsonic analyzers).

  • $T_{10}$: upper limit must start at $-5 \mathtt{dB}$ to remove any fluctuations and then lower limit is taken to be $-15 \mathtt{dB}$, but it always must be at least $10 \mathtt{dB}$ above the noise floor. So in fact you need at least $25 \mathtt{dB}$ of dynamic range (or INR) to be able to calculate $T_{10}$ ($5+10+10$).

  • $T_{20}$: upper limit at $-5 \mathtt{dB}$, lower at $-25 \mathtt{dB}$. Minimum dynamic range needed is $35\mathtt{dB}$

  • $T_{30}$: upper limit of $-5 \mathtt{dB}$, lower at $-35 \mathtt{dB}$, with minimum $45 \mathtt{dB}$ of dynamic range.

Why are people using these values? Well, because you very rarely have $75 \mathtt{dB}$ of dynamic range to be able to estimate $T_{60}$. For very smooth decay these values should be equal. Some more detailed analysis of effects can be found in this publication:

If you will not perform Schroeder integration, then most probably they will diverge a lot. For the very nasty room you can get something like:

In theory: $EDT$ = $T_{10}$ = $T_{20}$ = $T_{30}$. Although they are not necessarily going to be. For example, if your small room is coupled with large one (let's think of small chapel coupled with cathedral by a small doorway), then you will get very sharp decay for smaller one at the beginning of the curve, and very long tail in the end:

To wrap up. According to standards, you should always estimate your reverberation time $T_{N}$ starting from $-5 \mathtt{dB}$ and down to $(-5-N) \ \mathtt{dB}$. Also, ensure that you are at least $10 \mathtt{dB}$ above the noise floor. If not, then you must use another estimate. In your case, I suggest using the $T_{30}$.

I think that should do. If anyone will follow these steps, then he should get an accuracy of $0.1 \mathtt{s} $ against widely used Dirac. Anyway, it must be remembered that even different software tend to give different results (i.e. EASERA and Dirac), so you should be totally fine. For more complicated impulse responses with artifacts at the end of impulse response one might get worse performance, but anyway, such measurements are not reliable and reflect wrongly conducted an experiment.

deleted 1 character in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omni=directionalomnidirectional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with usage of either linear or exponential sweep. This method is my favourite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.
  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omni=directional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with usage of either linear or exponential sweep. This method is my favourite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.
  • Firing a starter gun, popping a balloon, etc. - basically recording any impulsive-like signal with broad frequency content and omnidirectional characteristic. This is the simplest method of obtaining impulse response.
  • Sweep Sine measurement with usage of either linear or exponential sweep. This method is my favourite as it allows you to extract many different parameters of your system at the same time.
  • MLS (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found here.
added 245 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 177 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 89 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 75 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 110 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 89 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
expanded a bit
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 106 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 27 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 44 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
added 28 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75
Loading