electronjoe / noise-generator-rust-on-pi-pico

A brown noise generator in a small Pi Pico package (RPi Pico plus Pimoroni Pico Audio Pack). Authored in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brown Noise Generator for Pimoroni Pico Audio on Pi Pico in Rust

Acknowledgements

  • A great deal of the Rust in this repo is thanks to ramenspazz's Pico_I2S project for this same hardware set (Pimoroni Pico Audio shield on the Pi Pico) - in Rust.
  • This project uses the pio I2S assembly provided by raspberrypi/pico-extras.

Building and Flashing

You'll need to install Rust Embedded toolchains, see the Rust Embedded book for details there.

cargo run --release

Will flash a Pi Pico that is in USB boot mode.

Filter Design

Butterworth first order filter

  • center_frequency = 146 # Center frequency in Hz
  • sample_rate = 44100 # Sample rate in Hz
  • bandwidth = 0.2 # Bandwidth as a percentage

Butterworth Filter Coefficients for DSP Implementation:

  • Numerator (b): [ 0.00414308 0. -0.00414308]
  • Denominator (a): [ 1. -1.99130017 0.99171384]

y[n]=b[0]×x[n]+b[1]×x[n−1]+⋯+a[1]×y[n−1]+…

  • where x[n] is your input signal, and y[n] is your filtered output signal.

Host Testing

I've authored a test binary to generate WAV file outputs for debug iteration in the host environment.

cargo test --test main --target x86_64-unknown-linux-gnu

About

A brown noise generator in a small Pi Pico package (RPi Pico plus Pimoroni Pico Audio Pack). Authored in Rust.

License:MIT License


Languages

Language:Rust 87.5%Language:Python 12.5%