I have an (audio) signal. I am applying STFT continuously and after applying a certain magnitude threshold I am doing inverse STFT to reconstruct the signal. But I am getting some unwanted mini noise spikes during the whole reconstructed audio.
In the time-freq domain, I just zeroed the value if it surpasses a certain threshold. I am also applying Hanning's window while doing STFT. What's wrong in there?
The idea was simply like :
for(int i=0; i<total_samples ; i+=hopsize){
for(int j=0; j<frame.size(); j++){
apply_hanning_window(frame[j]);
}
stft_frame = apply_STFT(frame);
reconstructed_overlapping_frame = apply_INVERSE_STFT(stft_frame);
reconstructed_audio.push(reconstructed_overlapping_frame);
}
apply_INVERSE_STFT(stft_frame){
Iterate_over_fullframe(){
if(stft_frame[i].magnitude > threshold) stft_frame[i] = 0; // applying magnitude threshold
// I can also apply frequency threshold here
}
filtered_frame = do_INVERSE_STFT(stft_frame):
return filtered_frame;
}
Please make me know if I am doing anything wrong. Thanks