https://github.com/stuffmatic/microdsp
DSP algorithms and utilities written in Rust. Performant, embedded friendly and no_std compatible.
https://github.com/stuffmatic/microdsp
adaptive-filtering audio dsp embedded no-std novelty-detection pitch-detection rust
Last synced: about 15 hours ago
JSON representation
DSP algorithms and utilities written in Rust. Performant, embedded friendly and no_std compatible.
- Host: GitHub
- URL: https://github.com/stuffmatic/microdsp
- Owner: stuffmatic
- License: mit
- Created: 2020-09-14T13:18:50.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-17T10:15:11.000Z (4 months ago)
- Last Synced: 2025-06-05T04:45:54.124Z (29 days ago)
- Topics: adaptive-filtering, audio, dsp, embedded, no-std, novelty-detection, pitch-detection, rust
- Language: Rust
- Homepage:
- Size: 3.44 MB
- Stars: 20
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# microdsp
[](https://crates.io/crates/microdsp)
[](https://docs.rs/microdsp)microdsp is a collection of [DSP](https://en.wikipedia.org/wiki/Digital_signal_processing)
algorithms and utilities written in Rust. The code is `no_std` compatible and suitable for use in embedded systems. Available algorithms include* Monophonic [pitch](https://en.wikipedia.org/wiki/Pitch_%28music%29) detection using the [MPM algorithm](http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf). Supports downsampling and overlapping windows.
* [Audio onset detection](https://en.wikipedia.org/wiki/Onset_(audio)) using [spectral flux novelty](https://krishnasubramani.web.illinois.edu/data/Energy-Weighted%20Multi-Band%20Novelty%20Functions%20for%20Onset%20Detection%20in%20Piano%20Music.pdf). Used to detect transients and "starts of sounds". Supports downsampling and overlapping windows.
* [Normalized least mean squares](https://en.wikipedia.org/wiki/Least_mean_squares_filter#Normalized_least_mean_squares_filter_(NLMS)) adaptive filter. Can for example be used for signal cancellation and time delay estimation.To see microdsp in action on a microcontroller, check out [these videos](https://github.com/stuffmatic/microdsp-zephyr-demos#demos).
## Installing
Add the following line to your Cargo.toml file:
```
microdsp = "0.1"
```microdsp is `no_std` compatible and relies
on [`alloc`](https://doc.rust-lang.org/alloc/).
When building for targets without a default allocator,
one must be provided by the user. This can be accomplished in stable Rust 1.68 and higher
using `#[global_allocator]` and `#[default_alloc_error_handler]`.## Usage
See [the crate documentation](https://docs.rs/microdsp).
## Demos
### Cargo examples
The [`examples`](examples) folder contains a number of demos that can be run with
```
cargo run --example [filename without .rs extension]
```for example `cargo run --example mpm`. Some of these use `rust-portaudio` for real time audio input. If you run into portaudio related issues, you may find some pointers [here](https://github.com/RustAudio/rust-portaudio).
### Embedded
The [microdsp-zephyr-demos](https://github.com/stuffmatic/microdsp-zephyr-demos/) repo contains demos showing how to do real time audio processing on a microcontroller using microdsp and [Zephyr](https://zephyrproject.org/).
## License
This project is released under the MIT license.