spectral subtraction noise suppression
Ältere Kommentare anzeigen
hi, anyone please check my code for noise suppression using spectral subtraction.
fs =16000; t=0:1/fs:5; signal=2*sin(2*pi*50000*t); noise=5*rand(1,length(signal)); input_speech=noise+signal; removal_sample=input_speech(1,6000:end); NFFT=256; window_length=256; window=hamming(window_length); window = window(:); overlap=floor(0.45*window_length); t_min=0.075; t_max=0.100; [STFT,Freq,Time] =spectrogram(input_speech+1i*eps,window,window_length-overlap,NFFT,fs); %put a short imaginary part to obtain two-sided spectrogram [Nf,Nw]=size(STFT); ind=mod((1:window_length)-1,Nf)+1; output_signal=zeros((Nw-1)*overlap+window_length,1);
%% %Overlapping for indice=1:Nw
left_index=((indice-1)*overlap) ;
index=left_index+[1:window_length];
temp_ifft=real(ifft(STFT(:,indice),NFFT));
output_signal(index)= output_signal(index)+temp_ifft(ind).*window;
end t_index=find(Time>t_min & Time<t_max); subplot(211);plot(t,signal,'g'); hold on; plot(t,noise,'r') hold off; title('Inputspeech'); subplot(212); plot([1:length(output_signal)]/fs,output_signal); xlabel('Time (s)'); ylabel('Amplitude'); title('Sound without noise'); t_epsilon=0.001; figure; S_one_sided=max(STFT(1:length(Freq)/2,:),t_epsilon); pcolor(Time,Freq(1:end/2),10*log10(abs(S_one_sided))); %keep only the positive frequency shading interp; colormap('hot'); title('Spectrogram:final speech'); xlabel('Time (s)'); ylabel('Frequency (Hz)'); audiowrite('finaloutput.wav',output_signal,fs); soundsc(output_signal,fs);
please, tell where I did wrong ?
Thnaks, Chinnydas
2 Kommentare
KALYAN ACHARJYA
am 23 Aug. 2018
Bearbeitet: KALYAN ACHARJYA
am 23 Aug. 2018
Have you got any error? Share the error? Pls attach finaloutput.wav?
Image Analyst
am 23 Aug. 2018
Bearbeitet: Image Analyst
am 23 Aug. 2018
and explain why you believe there is something wrong with it. Tell us what you got, and what would be "right".
Antworten (1)
Deepa
am 23 Aug. 2018
0 Stimmen
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!