Go Down

Topic: lowpass filter 315Hz / 12dB octave (Read 383 times) previous topic - next topic

classic

I am looking for a library / sketch for a lowpass filter.

The frequency 315Hz (3 dB ) and 12 dB / octave.

The filter will be used in an audio test equipment - testing rumble in record players.
I have really tried to search (Google ofcourse) - all I can find is noise reduction filters.
I hope for some help here.

Perhaps someone who allready have been designing audio filters.



( Obviously I cannot attached a sketch -since I have no solution so far )

PieterP

Why do you want to do it digitally? Wouldn't a second order analog filter be more suitable?

If you prefer to do it digitally, you'll need quite a powerful microcontroller, that can sample and fo MAC operations really quickly. You'll also need a strong anti-aliasing filter.

If you really want to do it using digital filters, you could use this filter library I wrote.
An 8th order IIR filter at 360 samples/second uses around 16% of the CPU of an UNO, IIRC.

Pieter

classic

#2
Jul 11, 2018, 03:34 pm Last Edit: Jul 11, 2018, 05:06 pm by classic Reason: Clarifying the actual filter configurations
I allready designed the testequipment with analog filters.
This works really great.

I would like "the challange" of implementing the filter digitally in an Arduino design.

Thanks for the link - I will have a look and see if I my knowledge is sufficient for challange.
(I am not sure I fully understand the design of digital filters)

However the filters actually must be like this:

Lowpass filter 12dB/octave - 315Hz
Highpass filter 6dB/octave - 10Hz

and

Highpass filter 12dB/octave - 315Hz
Lowpass filter 12dB/octave - 315Hz

all according to DIN 45544 (the old standard for turntable rumble messurements)

DVDdoug

I don't have a feel for how much processing power is needed.    About the only Arduino audio processing projects I see are FFT based spectrum analyzer effects.  But, these are effects...  Nothing like a real spectrum analyzer instrument.        

- You need an analog anti-aliasing filter before the signal is sampled because the aliasing occurs when the signal is sampled.

- The Arduino has a 10-bit ADC and that's a 60dB of dynamic range.  Probably not enough.


Quote
Highpass filter 6dB/octave - 10Hz
According to the ATmega datasheet the ADC looses accuracy above 15kHz (sample rate) which means you can't read signals above 7.5kHz accurately.


Quote
I would like "the challange" of implementing the filter digitally in an Arduino design.

Thanks for the link - I will have a look and see if I my knowledge is sufficient for challange.
(I am not sure I fully understand the design of digital filters)
There is a free online DSP book.  (It's a general book, not specific to any processor, computer or programming language.)

   

Grumpy_Mike

#4
Jul 11, 2018, 10:44 pm Last Edit: Jul 11, 2018, 10:45 pm by Grumpy_Mike

MarkT

If the incoming signal is known to be 20kHz band-limited, then the need for an analog anti-aliasing
filter is only if you sample at less than 44kSPS or so.

Since the requirements for anti-aliasing for the audio band are severe (the human ear has a 100dB dynamic
range at least), you are strongly advised to sample at 44kSPS or above if possible before trying to
digitally low-pass filter.  Otherwise you might as well use an analog low pass filter as it will be much
less tricky to design than the brick-wall antialiasing filter needed to support lower sampling rates.

Use an IIR digital filter, the Arduino cannot handle the dozens of coefficients needed for a FIR filter.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

pjrc

Over the last 4 years I've been working on an audio library for Teensy.  It currently has 3 different filters.  You could probably use the FIR or State Variable ones to achieve this project.  While the Biquad filter might also work, it's not recommended for implementing low corner frequencies due to only 32 bit numerical precision in the calculations.

The library has a graphical design tool, where all the documentation resides (look at the right side panel).  Here are links to the 3 filters.

https://www.pjrc.com/teensy/gui/?info=AudioFilterFIR
https://www.pjrc.com/teensy/gui/?info=AudioFilterStateVariable
https://www.pjrc.com/teensy/gui/?info=AudioFilterBiquad

The actual source code for these is on github, and also gets installed automatically when you run the Teensyduino installer.  Here's links to the code.  (the FIR is actually implemented within the arm_math library)

https://github.com/PaulStoffregen/Audio/blob/master/filter_fir.cpp
https://github.com/PaulStoffregen/Audio/blob/master/filter_variable.cpp
https://github.com/PaulStoffregen/Audio/blob/master/filter_biquad.cpp

This code runs on Teensy 3.2, 3.5 or 3.6.  But it can't possibly run on less powerful boards like Arduino Uno or Arduino Zero or even Teensy LC.  The Cortex-M4 DSP extensions are leveraged to optimize the code, and the rest of the library uses efficient DMA to get the audio input & output without burning up the CPU, so you can actually use the CPU for filtering, effects & synthesis.




Go Up