## Finding "channel" impulse response from input and recorded data

Started by 5 years ago●9 replies●latest reply 3 years ago●205 viewsHello nice forum!

Im facing the problem of estimating the impulse response of the following process: Known signal that is transmitted and recorded by a microphone (not the same length). I understand that this kind of problem falls into the category of inverse problems, since Im not that experienced in these problems, Im having a hard time trying to solve it.

I have been trying to solve it by setting up the Wiener Hopf equations for the setting (deconvolution), by creating the autocorrelation matrix from the known input signal x(n) and the vector of autocorrelations from the recorded signal y(n). This seems to give a reasonable result after solving for the filter coefficients, but..

This approach seems to complex in computational time ~1min, not feasible when it is desired to do for a lot of recorded signals! This is btw. done to figure out the time it takes for a signal to be picked up. The method consequently gives filter coefficients that are as long as the recorded data sequence. This should be do-able with a much smaller filter?

Any suggestion of methods that I can apply to do the deconvolution, in a nice and structured way?

Thank you very much!

I assume that you are trying to build a model of the impulse response of the microphone output that results from the sound input.

If so, I recommend that you use the LMS (Least Mean Squares) algorithm to update the taps of an adaptive FIR filter.

First: Establish an FIR filter with at least as many taps as your safest guess of the delay between the known good signal and the microphone output, and then add a few more taps, to be safe.

Second: Pass the "Known Signal" into the adaptive filter input, and declare the "error" signal to be the difference of "microphone output" minus "Known Signal". That error signal then drives the LMS updates to each tap of the FIR filter.

Third: always monitor the energy content of the error signal. When the energy level of the error signal is a nicely small fraction of the energy level of the "known good" signal, you're done.

At this point, the tap values of the adaptive FIR filter is the impulse response of the microphone output that results from the sound input.

I totally agree with achesir (hello by the way).

However, I would also caution, that the recording into the mic will probably be in a space that has some significant reverberation. You will want to extend the length of the filter to cover this time period as well as the pure delay between the source and the mic.

For a small office, I would allow about 100 msec for the reverb.

For a living room, maybe 50 msec will do.

For an auditorium you may need something like 300 msec to 1.5 sec depending on the size and the acoustic treatment.

Hi, yes there are indeed some significant reverberation. Thanks for the advice, will try to extend the filter to an appropriate length, and the algorithm will hopefully be finalized in the comming days. If everything goes completely bad, I might turn back to this thread.

Best regards

One more piece of advice, that no-one has mentioned here.

You will have much more success with this whole thing if you go to sub-band processing using a polyphase filter bank to break things up into the frequency domain. The LMS is then applied to each sub-band separately.

Far less processing required. More control over the reverb in different bands. Lots of other advantages.

This is a topic way beyond the scope of this small forum.

Yes that is what I'm trying to do! Okay this makes sense, so I am going to implement the lms, thank you for the answer!

In re-reading what I had written, I need to clarify:

Second: Pass the "Known Signal" into the adaptive filter input, and declare the "error" signal to be the difference of "microphone output" minus the *filter output of the* "Known Signal"

**. That error signal then drives the LMS updates to each tap of the FIR filter.**

__filter input__That is noted! Want to take the time to say thank you very much (to everyone) for their help, it indeed helped! And I'm grateful one can come here and get advice! Definitely also a forum, and a community that I will consult in the future, and hopefully contribute to.

Hi niptoz,

I'm looking for a solution for a similar problem as yours as mentioned here - basically, calculate the delay of an audio captured over microphone (a sink) with respect to a played file (the source). I also created a Matlab function after reading from sources as shown below:

function chcoeffs = getchannelcoeffs(tx, rx, ntaps) % Determines channel coefficients using the Wiener-Hopf equations % (LMS Solution). % TX = Transmitted (channel input) waveform, row vector, length must % be >> ntaps. % RX = Received (channel output) waveform, row vector, length must % be >> ntaps. % NTAPS = Number of taps for channel coefficients % Dan Boschen 1/13/2020 tx = tx(:)'; % force row vector rx = rx(:)'; % force row vector depth = min(length(rx), length(tx)); A = convmtx(rx(1:depth).', ntaps); R = A'*A; % autocorrelation matrix X = [tx(1:depth) zeros(1, ntaps - 1)].'; ro = A'*X; % cross correlation vector chcoeffs = (inv(R) * ro); % solution end

Now, I'm lost on what value do I pass for ntaps in the above function.

Then I came across this post of yours and was wondering if you could share the details of your implementation and help me understand. That would be of great help because I'm quite a newbie here.

Hi there.

I sent you an e-mail with the solution obtained at the time.

Kind regards,

Nick Thanthrige