Borrar filtros
Borrar filtros

Spectral Substraction for removing noise

3 visualizaciones (últimos 30 días)
Amirhosein Khanlari
Amirhosein Khanlari el 26 de En. de 2020
Editada: Thiago Henrique Gomes Lobato el 26 de En. de 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)

Respuestas (1)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato el 26 de En. de 2020
Editada: Thiago Henrique Gomes Lobato el 26 de En. de 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)

Categorías

Más información sobre Data Import and Network Parameters en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by