This is a collection of demos showing how to do real time, full duplex audio processing on a microcontroller using Zephyr (nRF Connect SDK) and the microdsp Rust library (scroll down for videos).
The microdsp_demos Rust crate contains the demo apps and is added to the Zephyr build using zephyr_add_rust_library
.
The demo apps have been tested with nRF Connect SDK v2.1.2 and the following boards.
In the videos below, an nRF52840 DK board is used together with breakout boards for a WM8940 audio codec and an analog MEMS microphone. KiCad projects and JLCPCB fabrication files for these breakout boards are available here.
This demo shows how to use a normalized least mean squares (NLMS) filter to reduce leakage of sound from the speaker in the signal recorded by the microphone.
nlms.mov
- Button 1 - Toggle speaker output
- Button 2 - Toggle NLMS filter
- Button 3 - Toggle recording
- Button 4 - Toggle playback
- LED 1 - On when speaker output is active
- LED 2 - On when the NLSM filter is active
- LED 3 - On when recording
- LED 4 - On when playing back recording
A (very) simple ukulele tuner. Each of the four LEDs turns on when a pitch close to the corresponding ukulele string is detected.
mpm.mov
- LED 1 - On when the pitch is close to 392 Hz
- LED 2 - On when the pitch is close to 262 Hz
- LED 3 - On when the pitch is close to 330 Hz
- LED 4 - On when the pitch is close to 440 Hz
This demo shows how to detect transients and "starts of sounds" using spectral changes over time rather than just signal amplitude changes.
sfnov.mov
- LED 1 - Toggles between on and off for each detected novelty peak
The microdsp_demos
Rust crate is compiled as part of the Zephyr build using zephyr_add_rust_library
, which is called from CMakeLists.txt. The EXTRA_CARGO_ARGS
argument is used to specify which demo app to build by enabling one of the following cargo features:
nlms_demo
- Normalized least mean squares filter demosfnov_demo
-Spectral flux novelty detection demompm_demo
- MPM pitch detection demo