Audio signal Filtering

677 views Asked by At

I am trying to filter audio signal with a butterworth bandpass filter (C# from NWaves Nuget) then use audacity to get the frequency analysis of filtered signal to check and validate the result.

Raw signal No filter

I used NWaves nuget to get the following result with those parameters

My audio signal sampling rate :

  • 88200Hz

My cutoffs frequency :

  • lowCutFreq : 9000Hz
  • highCutFreq : 22000Hz

I normalize cutoffs frequencies in range [0..0.5]

  • normLowCutFreq : 9000 / 88200
  • normHighCutFreq : 22000 / 88200

The filter order :

  • Order : 5

NWave Butterworth BandPass

I used NWave Butterworth HighPass then LowPass to be sure that the difference with bandpass were not significant. NWave Butterworth HighPass -> LowPass

Results after filtering still has frequencies left before 9KHz.

I want now to validate my filter. As an indicator to validate my filter i use high pass then low pass filter from audacity to filter the raw signal with the same parameter than mine.

I supposed based on audacity documentation for low pass, high pass and this old comment on audacity forum that those filter were butterworth filter.

Audacity High pass -> Low pass

After applying those filter using :

1- Effet -> High-Pass filter (22KHz , 48db) 2- Effet -> Low-Pass filter (9KHz , 48db)

Where 48 db makes filters of the fifth order.

Both result are very similar. The audacity one seems to get some after processing to "smooth" it but it is globally the same. But both of them have frequencies left before 9KHz.

I was excepting to get almost no frequencies (because filters are not perfect) before 9KHz and after 22KHz.

My question is : After filtering i still have some frequencies left. Where does it come from ? Why they are still that much frequencies left ?

From what i understand, the filter at some point doesnt filter anymore(source)

1

There are 1 answers

0
codeaktivist On

You did not specify the bit depth of the file, but consider this:

16 Bit gives you a resolution of -96 dB. Reducing a sample by this amount leaves "nothing" after a DAC since the signal is not quantized to an amplitude (+/-).

In the time domain -96 dB can be easily achieved by outputting all 0s, 0V respectively.

In the frequency domain, you have filter ringing, spill, leakage and other artifacts making it nearly impossible to reduce a certain frequency or range by -96 dB. What you see is a residual signal paired with the inaccuracy of FFT at the low end (large frequency bins) ... however well below the hearing threshold.