# Using only one mic in Cocktail Party Algorithm

So I came across this piece of code that separates 2 audio sources from 2 mixed audio sources has shown here:

[x1, Fs1] = wavread('src1.wav');
% Change the path to your first wav file.
[x2, Fs2] = wavread('src2.wav');
% Change the path to your second wav file.

m = size(x1,1);
n = 2;
A = randn(n, n);
% A random matrix that linearly combines the sound  signals.
x = A*[x1';x2'];

% x is the input. If you already have a linear combination, like something from two microphones, feed it here.
c = cov(x');
sq = inv(sqrtm(c));
mx = mean(x, 2)';
xx = x - mx'*ones(1, size(x, 2));
xx = sq*xx;

w1 = randn(n, 1);
w1 = w1/norm(w1,2);
w0 = randn(n, 1);
w0 = w0/norm(w0, 2);

while abs(abs(w0'*w1)-1) > 0.001
w0 = w1;
w1 = xx*G(w1'*xx)'/m - mean(DG(w1'*xx), 2)*w1;
w1 = w1/norm(w1, 2);
end

w2 = randn(n, 1);
w2 = w2/norm(w2,2);
w0 = randn(n, 1);
w0 = w0/norm(w0, 2);

while abs(abs(w0'*w2)-1) > 0.001
w0 = w2;
w2 = xx*G(w2'*xx)'/m - mean(DG(w2'*xx), 2)*w2;
w2 = w2 - w2'*w1*w1;
w2 = w2/norm(w2, 2);
end

w = [w1 w2];
s = w*x;
s1 = s(1,:);
s2 = s(2,:);

% Writes out the extracted sound signals into two different wav files.
wavwrite( s1', 'out1.wav' );
wavwrite( s2', 'out2.wav' );


I've looked at http://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgi and I have seen Professor Andrew Ng's video on this algorithm, and all of them required 2 audio sources from different "distances" to separate the 2 sources.

My question is, if you only had 1 mixed audio source instead of 2 from different distances, is it possible to programmatically modify the same audio source to make a duplicate it and use it as the second mixed audio source so the algorithm works?

• People are voting to close this as a code question. My guess is that this is more about the nature of trying to solve the cocktail problem, & 1 vs >1 signal source, & that the code is ancillary. I'm voting to leave open. Mar 15, 2017 at 16:37
• Usually you have many mics and few sources for this problem. Apr 24, 2017 at 21:53

No, it is not general possible to use one (duplicated) source given the theory used to define the Cocktail Party problem. It is a deconvolution problem. For example, consider the matrix equation: $\boldsymbol{y} = \boldsymbol{M}\boldsymbol{x} + \boldsymbol{b}$

where $\boldsymbol{x}= \begin{pmatrix} \rm{source}_{1} \\ \rm{source}_{2} \end{pmatrix}$ $\boldsymbol{M}= \begin{pmatrix} \rm{volume}_{11} & \rm{volume}_{12} \\ \rm{volume}_{21} & \rm{volume}_{22} \end{pmatrix}$ $\boldsymbol{b}= \begin{pmatrix} \rm{systemicnoise}_{1} \\ \rm{systemicnoise}_{2} \end{pmatrix}$ $\boldsymbol{y} = \begin{pmatrix} \rm{microphone}_{1} \\ \rm{microphone}_{2} \end{pmatrix}$

This yields two equations and two unknowns. Therefore, the two sources can be solved for if the system of equations is independent.

However, what has been proposed here (using a single microphone or having only one good ear) is mathematically equivalent to: $\boldsymbol{x}= \begin{pmatrix} \rm{source}_{1} \\ \rm{source}_{2} \end{pmatrix}$ $\boldsymbol{M}= \begin{pmatrix} \rm{volume}_{11} & \rm{volume}_{12} \\ \rm{volume}_{21} & \rm{volume}_{22} \end{pmatrix}$ $b= \rm{systemicnoise}$ $y= \rm{microphone}$

$y=\boldsymbol{M}\boldsymbol{x}+b$

which cannot be solved.

There could be other ways to unmix two audio sources from a single mic (like Fourier decomposition), but all of these methods would need to know something about the sources to distinguish them. The "Cocktail Party Algorithm" does not require information about the sources.

• Welcome to our site! Note that you can use Latex to write equations here by enclosing in dollar signs, e.g. $x^2$ produces $x^2$ Apr 24, 2017 at 22:43
• Thanks Silverfish! I'll do the equations in Latex notation next time Apr 28, 2017 at 0:25