cocktail party algorithm SVD implementation … in one line of code?

后端 未结 2 1293
梦谈多话
梦谈多话 2020-12-07 07:24

In a slide within the introductory lecture on machine learning by Stanford\'s Andrew Ng at Coursera, he gives the following one line Octave solution to the cocktail party pr

2条回答
  •  一生所求
    2020-12-07 07:26

    I was trying to figure this out as well, 2 years later. But I got my answers; hopefully it'll help someone.

    You need 2 audio recordings. You can get audio examples from http://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgi.

    reference for implementation is http://www.cs.nyu.edu/~roweis/kica.html

    ok, here's code -

    [x1, Fs1] = audioread('mix1.wav');
    [x2, Fs2] = audioread('mix2.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; %W is unmixing matrix
    subplot(2,2,1); plot(x1); title('mixed audio - mic 1');
    subplot(2,2,2); plot(x2); title('mixed audio - mic 2');
    subplot(2,2,3); plot(a(1,:), 'g'); title('unmixed wave 1');
    subplot(2,2,4); plot(a(2,:),'r'); title('unmixed wave 2');
    
    audiowrite('unmixed1.wav', a(1,:), Fs1);
    audiowrite('unmixed2.wav', a(2,:), Fs1);
    

提交回复
热议问题