1

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!

Royi
  • 19,608
  • 4
  • 197
  • 238
Junfei Wang
  • 123
  • 1
  • 5

2 Answers2

2

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).

pichenettes
  • 19,413
  • 1
  • 50
  • 69
2

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$).

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • 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. – Junfei Wang Apr 23 '13 at 18:59
  • There appears to be an adaptive filter function ('adaptfilt') in the Matlab DSP System Toolbox. I haven't tried it myself. See http://www.mathworks.nl/help/dsp/examples/acoustic-echo-cancellation-aec.html – Matt L. Apr 23 '13 at 19:04
  • 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. – Junfei Wang Apr 23 '13 at 19:05
  • Yes, the basic problem is the same. You have some reference signal, and you want to cancel a filtered version of it. – Matt L. Apr 23 '13 at 19:11
  • thank you, one more question: do i have to do the synchronization before applying this method? – Junfei Wang Apr 23 '13 at 19:51
  • What do you want to synchronize? – Matt L. Apr 23 '13 at 19:58
  • i mean should y and x1 have the same length or sth? – Junfei Wang Apr 23 '13 at 20:01
  • I do not think that's necessary. – Matt L. Apr 23 '13 at 20:07