I am recording raw files in python to later break them into phonemes, but the noise in the surrounding environment is hampering the result. So, there is a need to apply a filter to the recorded raw audio files. How can this be done ??
Do it using the following steps:
- Look for the optimal frequency for the Low Pass Filter. Usually close as possible to the bandwidth of your desired signal.
- Design an LPF filter according to the frequency above. If you're after Gaussian based filter you need to optimize the STD ($ \sigma $) parameter.
- Apply the filter either using convolution, Using Numpy's
convolve()function (Only in case of FIR Filter) or Scipy's
lfilter()function (Which, in case of FIR Filter does convolution as well yet can also handle IIR Filters).
Gaussian based filters aren't optimal for the task you are after (Their passband isn't flat).
I'd would design a filter using Remez Method (See Scipy's
remez()) which is Equiripple Method or using Chebyshev Filter Type II (
cheby2()) and Butterworth Filter (
butter()) which has flat passband (Namely they won't do any harm to the audio content).