0
$\begingroup$

I am doing Speech dereverberation using Non-negative matrix factorization. I need to initialize an impulse response($H$) such that its reverberation time ($t_{60}$) is $300$ ms. Let the length of $H$ be $10$.

I thought of doing that by identically initializing each row of $H$ using a linearly decaying envelope. Somewhat like this

x=1:10;
h = exp(-x/2);
H = repmat(h,600,1);

This will give me a $H$ of dimension $600$ X $10$. But, I don't understand how to use $t_{60}$ for the initialization in MATLAB. Please tell me.

$\endgroup$

2 Answers 2

1
$\begingroup$

A good method is to generate white noise apply an exponential envelope with the reverb time. In general you will need lots of samples. Typically 10s of thousands. If you want to get fancier you can window out the front part and put in a direct sound spike and a few discrete reflections. Below an example of how to create a simulated room impulse response with a given reverb time and sample rate

%% create an room impulse response with a given t60
fs = 44100; % sample rate in Hz
t60 = 0.35; % reverb time in seconds
% 1. Detemine the length of the impulse response. It's an infinite response
%    so some truncation is neccessary. A good starting point 1.5 times the
%    t60 which will result in 90 dB of dynamic range
n = round(fs*1.5*t60);
t = (0:n-1)'/fs;  % time vector
% 2. initialize to white noise, gaussian distributed
h = randn(n,1);
% 3. Calculate the decay. During the reverb time the envelope decays by 60
%    dB, so we have exp(decay*t60) = 1e-3; We can solve to
decay = log(1e-3)/t60;
% 4. Apply the envelope
h = h.*exp(decay.*t);
figure(1); clf
plot(t,h);
xlabel('Time in s');


%% we can calcuale the energy decay curve through reverse integration
decayCurveInDB = 10*log10(flipud(cumsum(flipud(h.^2))));
% normalize to 0 dB
decayCurveInDB = decayCurveInDB-decayCurveInDB(1);
% and plot it
figure(2);clf;
h = plot(t,decayCurveInDB);
set(h,'Linewidth',2);
xlabel('Time in s');
ylabel('Decay in dB');
% mark the t60 spot
hold on 
set(gca,'ylim',[-100,0]);
y = get(gca,'ylim');
h = plot(t60*[1 1],y,'r');
set(h,'Linewidth',2);
grid('on');
$\endgroup$
3
  • $\begingroup$ Thanks :) Can I make my RIR length independent of reverberation time? Lets say RIR length = 10. How do I approach this? $\endgroup$ Jul 2, 2015 at 15:16
  • $\begingroup$ Not really. You can make it shorter but it won't match the behavior of a real room any more. It really depends on what your application can tolerate. However N=10 will not work. Actual room impulse responses are 1000s of samples long. If you cut it down to 10 it has absolutely no resemblance to an RIR any more. $\endgroup$
    – Hilmar
    Jul 2, 2015 at 17:13
  • $\begingroup$ Actually, I am working on this paper (paris.cs.illinois.edu/pubs/nasser-icassp2015.pdf) which involves obtaining optimal solution for a Room Impulse Response(Equation 10). So, for that I need to initialize H first. He has mentioned in the paper that "Each row of H was initialized identically using a linearly decaying envelope"(Section 4, at the end of page 3). I need to initialize H such that its reverberation time(T60) is 300 ms. In the paper he mentions, RIR length Lh was set to 10, independent of T60(Section 4, at the end of page 3). So, can you tell what he is trying to do? $\endgroup$ Jul 3, 2015 at 14:46
0
$\begingroup$

To simulate the room impulse response, refer to RIR generator open source or the Matlab implementation.

$\endgroup$

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.