Azzera filtri
Azzera filtri

Spectral Substraction for removing noise

3 visualizzazioni (ultimi 30 giorni)
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)

Risposte (1)

Thiago Henrique Gomes Lobato
Modificato: Thiago Henrique Gomes Lobato il 26 Gen 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)

Categorie

Scopri di più su Data Import and Network Parameters in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by