How can I solve this code?
조회 수: 9 (최근 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!