I have a five second audio (speech with background noise), which I want to process first with bandpass filter and then with wiener filter to reduce noise. Audio is normalized between [-1, 1] and I expect the result to stay in this range also. It does when I do high or low pass filtering, but with a bandpass filtering, the values of the wiener filter explodes (they are approximately in range [-1500, 1500]. Can anybody tell me why?
Here's the Python code. I've tried both butterworth and elliptic filters, different cutoff frequencies and different parts of the audio sample, but all leads to the same result. So does the concatenation of high and low pass filters.
from scipy.io import wavfile
from scipy.signal import sosfilt, butter, wiener, stft, istft
import numpy as np
# bandpass filter
sos = butter(5, [400, 4000], btype='band', output='sos', fs=fs)
filtered = sosfilt(sos, sample, axis=0)
# wiener filter
f, t, fourier = stft(filtered, fs=fs)
y = wiener(fourier)
y = np.asarray(istft(y))
y = y[1, :]
btype
parameter be"bandpass"
(instead of"band"
- see here)? $\endgroup$wiener
function assumes a time-domain signal for input (see here). $\endgroup$