Cocktail Party Problem — audio source separation

I am trying to solve the Cocktail Party Problem. I am trying to separate these two mixed audio files:

into 2 separate audio files that contain the 2 original sources, like this:

I found that it can supposedly be accomplished fairly easily. I found many sources of code online that claim to solve this problem, but the only code I found that was actually giving me some kind of result is the following code in Octave:

[x1, Fs1] = audioread('mixed1.wav');
xx = [x1, x2]';
yy = sqrtm(inv(cov(xx')))*(xx-repmat(mean(xx,2),1,size(xx,2)));
[W,s,v] = svd((repmat(sum(yy.*yy,1),size(yy,1),1).*yy)*yy');
a = W*xx;
audiowrite('refined1.wav', a(1,:), Fs1);
audiowrite('refined2.wav', a(2,:), Fs1);


When I say "some kind of result" I mean that it actually outputs working wav files, although it did not separate the two sources very well at all. It basically returned the original mixed files, in lower volume. All other code I could find either did not show how to actually extract the source audio files after processing (example 1), or gave back corrupt WAV files (example 2).

I also converted the corrupt WAV files to MP3 to see if that would let me use them, which it did, but unfortunately I found out it did not separate the 2 audio sources.

I want to be clear, I don't want to take two separate audio sources and mix them artificially and then separate them, as seen in the following example:

I want to actually record 2, or more, mixed audio sources and separate them. Which algorithm to use to implement this? (ICA,PCA,SVD, etc)

• Q4 is explicitly off-topic by our rules ("questions for working code are off-topic"); Q3 is basically "how to save the results when everything works", and it's a pure programming question and you're far too early to ask it, and also, it's not a signal processing question. Q2 is "we don't care, honestly", it's a question asking for an Opinion, and such are also off-topic here.. So I'm removing all but Q1. – Marcus Müller Aug 1 '18 at 9:36
• You might want to have a look at this, this and this. The clarification you provide ("...i want to actually record...") is immaterial as long you understand the limitations of each method and what does it use to separate the sound files. You can separate drums from horns but you can't tell that there is a 4-horn section playing an identical score in an audio recording. – A_A Aug 1 '18 at 9:49
• "I just need help solving a hard problem that has haunted technology and science for decades. Someone deliver an easily understandable solution!": sorry, this is a hard problem, and "help" won't cut it, as the problem is very broad. You're basically saying "I've read about rocket fuel. Now I just need help getting a settlement on Mars"! – Marcus Müller Aug 1 '18 at 13:14
• I really don't try to make you look foolish! Problem really is that it's a hard problem, and your question is far too broad. It might very well be closed as being unanswerable due to being too broad (already multiple votes for that), and I try to help you improve your question so that it can be answered. Again, the problem is far more complex than you seem to understand. And, the cocktail party problem isn't "solvable", it's just that you can have a good system that solves it within some error boundaries under some specific conditions. – Marcus Müller Aug 1 '18 at 15:39
• Of course the answer isn't a perfect solution. But check out the first video I attached. His name is Andrew Ng and he shows a great example how it was solved. He claims it can be done with one line of code. And to be honest, what he shows there is amazing. I highly recommend you to check it out, maybe you will understand why I wrote this post. – keke Aug 1 '18 at 15:41