Biquad audio DSP filters using a STM32F303CC (black-pill) board #DSP #Audio
The Stupid Projects blog posts about building a biquad audio DSP filters using a STM32F303CC board (commonly called a black-pill board, specifically the RobotDyn STM32 mini).
It seems that DSP and audio is a very hot domain for many people. Although I’m a musician myself, I’m a bit old school and I don’t use any digital effects or filters, so everything on my audio path is mostly analog. Nevertheless, DSP is definitely a huge domain with a lot of interesting stuff and filtering is only a small area of this vast domain.
Therefore, I thought to port (some) DSP filters to C and use an ARM Cortex-M4 to test them in real time. And thus this stupid project was born.
(The) RobotDyn STM32 mini board comes with an STM32F303CCT6 running at 72MHz (also I’ve tested it overclocked at 128MHz), 256KB ROM, 40KB RAM and plenty of timers and peripherals. In this project I’ll use a timer, an ADC and a DAC.
The supported filters in the code are:
First order all-pass filter (fo_apf)
First order high-pass filter (fo_hpf)
First order low-pass filter (fo_lpf)
First order high-shelving filter (fo_shelving_high)
First order low-shelving filter (fo_shelving_low)
Second order all-pass filter (so_apf)
Second order band-pass filter (so_bpf)
Second order band-stop filter (so_bsf)
Second order Butterworth band-pass filter (so_butterworth_bpf)
Second order Butterworth band-stop filter (so_butterworth_bsf)
Second order Butterworth high-pass filter (so_butterworth_hpf)
Second order Butterworth low-pass filter (so_butterworth_lpf)
Second order high-pass filter (so_hpf)
Second order Linkwitz-Riley high-pass filter (so_linkwitz_riley_hpf)
Second order Linkwitz-Riley low-pass filter (so_linkwitz_riley_lpf)
Second order Low-pass filter (so_lpf)
Second order parametric/peaking boost filter with constant-Q (so_parametric_cq_boost)
Second order parametric/peaking cut filter with constant-Q (so_parametric_cq_cut)
Second order parametric/peaking filter with non-constant-Q (so_parametric_ncq)
In the above diagram we see that there’s a function generator which is used to provide the input signal, in this case just a sinusoidal signal. Next there’s in an optional anti-aliasing filter, which I’m not using in my tests. In this case the anti-aliasing filter doesn’t make sense, because the SDG1025 generator outputs a clean sin, but normally you would need that in order to filter frequencies over 20KHz, so their mirror images are not shown in the 20-20KHz range that we care about.
8-6-2021 (August 6, 2021) is the Snakiest day of the year and it’s also this year’s CircuitPython Day! The day highlights all things CircuitPython and Python on Hardware. See you there!
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.