# How to Apply Gaussian Filter to Raw Audio Files in Python?

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 ??

• Why do you think a Gaussian filter is going to help with noise in the surrounding environment? – endolith Jun 19 '18 at 3:39

Do it using the following steps:

1. Look for the optimal frequency for the Low Pass Filter. Usually close as possible to the bandwidth of your desired signal.
2. Design an LPF filter according to the frequency above. If you're after Gaussian based filter you need to optimize the STD ($\sigma$) parameter.
3. 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).

Remark
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).