How can I solve this code?
8 次查看(过去 30 天)
显示 更早的评论
clc;
clear all;
close all;
fs=54100;
y= audioread('dsp1.wav');
p= audioread('dsp2.wav');
figure(1);
plot(y);
figure(2);
plot(p);
xx = [y p];
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
figure(4);
subplot(2,2,1); plot(y); title('mixed audio - mic 1');
subplot(2,2,2); plot(p); title('mixed audio - mic 2');
subplot(2,2,3); plot(a, 'g'); title('unmixed wave 1');
subplot(2,2,4); plot(a(1,:),'r'); title('unmixed wave 2');
This code is for the cocktail party problem. I actually want to mix the two signals and extract them using ICA. Is the logic correct?? But,I am getting an error for the above code.
Out of memory. Type HELP MEMORY for your options.
Error in cov (line 97)
xy = (xc' * xc) / (m-1);
Error in mix1 (line 27)
yy = sqrtm(inv(cov(xx')))*(xx-repmat(mean(xx,2),1,size(xx,2)));
2 个评论
Walter Roberson
2017-7-27
What is the difference between this and your previous https://www.mathworks.com/matlabcentral/answers/350220-how-to-solve-the-code ? Is that previous question Answered to your satisfaction? If so you should Accept something there.
KSSV
2017-7-27
Your size of xx would be very large.....so memory is not sufficient. Try taking a coarse signal.
采纳的回答
Walter Roberson
2017-7-27
You have
y= audioread('dsp1.wav');
p= audioread('dsp2.wav');
Each of those will be either N x 1 (one channel) or N x 2 (2 channels)
xx = [y p];
so xx will be N x 2 (one channel each) or N x 4 (two channels each)
yy = sqrtm(inv(cov(xx')))*(xx-repmat(mean(xx,2),1,size(xx,2)));
xx is N x 2 or N x 4 so xx' is 2 x N or 4 x N . The output of cov() is an M x M matrix where M is the number of columns in the input, so the output of cov() would try to be N x N . You simply do not have enough memory for that. You will need to work with a portion of the files at a time.
11 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!