spectral subtraction noise suppression

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

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 8월 23일
편집: KALYAN ACHARJYA 2018년 8월 23일
Format the question properly? Visit Here
Have you got any error? Share the error? Pls attach finaloutput.wav?
Image Analyst
Image Analyst 2018년 8월 23일
편집: Image Analyst 2018년 8월 23일
and explain why you believe there is something wrong with it. Tell us what you got, and what would be "right".

댓글을 달려면 로그인하십시오.

답변 (1개)

Deepa
Deepa 2018년 8월 23일

0 개 추천

hi, I have attached my code here. but, couldn't able to attach my wav(finaloutput.wav) file.... and output signal I am receving is combination of both noise and signal. but, I should only get sinewave by suppressing or cancelling the added noise. Am i explain my expected output clearly ?
Thanks, Chinny

카테고리

도움말 센터File Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

질문:

2018년 8월 23일

답변:

2018년 8월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by