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.
We are angry, frustrated, and in pain because of the violence and murder of Black people by the police because of racism. We are in the fight AGAINST RACISM. George Floyd was murdered, his life stolen. The Adafruit teams have specific actions we’ve done, are doing, and will do together as a company and culture. We are asking the Adafruit community to get involved and share what you are doing. The Adafruit teams will not settle for a hash tag, a Tweet, or an icon change. We will work on real change, and that requires real action and real work together. That is what we will do each day, each month, each year – we will hold ourselves accountable and publish our collective efforts, partnerships, activism, donations, openly and publicly. Our blog and social media platforms will be utilized in actionable ways. Join us and the anti-racist efforts working to end police brutality, reform the criminal justice system, and dismantle the many other forms of systemic racism at work in this country, read more @ adafruit.com/blacklivesmatter
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.