I have a wav file which is gained by playing 2 different wav files with 2 speakers and recorded with mic. If I want to get one of the original signals using the resulting wav file and the other original wav file, is it possible to do this? I checked online and only got blind signal separation algorithm. Thank you in advance!


Let's call your signals $x_1$ and $x_2$. The recorded signal is $y$:

$$y(n) = (x_1*h_1)(n) + (x_2*h_2)(n)$$

where $n$ is the sample (time) index, and $h_1$ and $h_2$ are the room impulse responses from the respective speakers to the mic. Assume you want to retrieve $x_2$ from $y$ with the knowledge of $x_1$. You can apply echo cancellation methods to remove the part in $y$ stemming from $x_1$. What you get is $(x_2*h_2)(n)$ plus some residual from $x_1$ due to imperfect echo cancellation. If you also want to get rid of the effect of $h_2$, you must resort to blind deconvolution methods, which is a lot harder (and you need to know or assume some things about the desired signal $x_2$).

  • $\begingroup$ Thank you, I only need to get the estimation of x2, h2 has been handled in my server side. Is there any existing matlab code that can do what you just said? I completely have no background so if I implement it myself that is gonna be overwhelming. $\endgroup$ – Junfei Wang Apr 23 '13 at 18:59
  • $\begingroup$ There appears to be an adaptive filter function ('adaptfilt') in the Matlab DSP System Toolbox. I haven't tried it myself. See mathworks.nl/help/dsp/examples/… $\endgroup$ – Matt L. Apr 23 '13 at 19:04
  • $\begingroup$ BTW, you mentioned that i can use AEC to do this, I found some matlab code about it but it said that it is for cancelling echo sounds. $\endgroup$ – Junfei Wang Apr 23 '13 at 19:05
  • $\begingroup$ Yes, the basic problem is the same. You have some reference signal, and you want to cancel a filtered version of it. $\endgroup$ – Matt L. Apr 23 '13 at 19:11
  • $\begingroup$ thank you, one more question: do i have to do the synchronization before applying this method? $\endgroup$ – Junfei Wang Apr 23 '13 at 19:51

Let's sum your problem. Assuming the transfer function of the whole signal transmission chain from the source 1 to the recorded signal (DAC, speaker, room, microphone, ADC...) is $h_1$ (and $h_2$ from source 2 to microphone), then the signals you have complete access too are:

  • $(h_1 \star x_1)(n) + (h_2 \star x_2)(n)$ (the resulting signal)
  • $x_1(n)$ (one of the original signals).

And your problem is that you want to recover $x_2$? Then this is the same setup as this question, and certainly not a problem of source separation - since one of the signals is already known (up to a convolution). You can get an estimate of $h_1$, and recover $h_2 \star x_2$. And if you can assume that $h_1$ and $h_2$ are similar, you can try inverting $h_2$ and get a result closer to $x_2$.

It would be a true BSS problem is you had no prior information about both $x_1$ and $x_2$, in which case it would have been intractable (unless some assumptions can be made about the way these sounds are produced - eg one of them is speech and the other is background music).

  • $\begingroup$ Funny, we even used the same variables ... $\endgroup$ – Matt L. Apr 23 '13 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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