Filter löschen
Filter löschen

Spectral Substraction for removing noise

3 Ansichten (letzte 30 Tage)
Amirhosein Khanlari
Amirhosein Khanlari am 26 Jan. 2020
i have this code buy i get index out of range.how can i fix it
[x,fs]=audioread('NoisyTest.wav');
y=x(1:350,1);
Y=fft(y);
length(Y)
magY=abs(Y);
b=[];
for i=0:2000;
n=350;
x1=x(1+n*i:n+n*i);
X1=fft(x1);
magX=abs(X1);
S=(magX.^2-magY.^2);
S1=abs(S).^0.5;
s1=ifft(S1);
a=s1';
b=[b a];
end
x2=b';
plot(x2);
sound(x2,fs);
audiowrite('13.wav',x2,fs)

Antworten (1)

Thiago Henrique Gomes Lobato
Bearbeitet: Thiago Henrique Gomes Lobato am 26 Jan. 2020
Probably your signal is not long enough for you to use 2000 blocks of 350 samples, you can make your loop signal dependent to avoid this problem:
[x,fs]=audioread('NoisyTest.wav');
y=x(1:350,1);
Y=fft(y);
length(Y)
magY=abs(Y);
b=[];
for i=0:round(length(x)/350)-1;
n=350;
x1=x(1+n*i:n+n*i);
X1=fft(x1);
magX=abs(X1);
S=(magX.^2-magY.^2);
S1=abs(S).^0.5;
s1=ifft(S1);
a=s1';
b=[b a];
end
x2=b';
plot(x2);
sound(x2,fs);
audiowrite('13.wav',x2,fs)

Kategorien

Mehr zu Argument Definitions finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by