little_weirdo

Crates.iolittle_weirdo
lib.rslittle_weirdo
version0.1.1
created_at2025-10-26 15:15:37.023684+00
updated_at2025-10-28 08:49:31.36472+00
descriptionA Rust #no-std optimized wave table synthesizer for embedded devices.
homepage
repositoryhttps://github.com/hi-squeaky-things/little-weirdo
max_upload_size
id1901527
size175,805
Daniël (foldingbeauty)

documentation

README

 ⡇ ⡇⢹⠁⢹⠁⡇ ⣏⡉ ⡇⢸⣏⡉⡇⣏⡱⡏⢱⡎⢱
 ⠧⠤⠇⠸ ⠸ ⠧⠤⠧⠤ ⠟⠻⠧⠤⠇⠇⠱⠧⠜⠣⠜

GitHub Actions Workflow Status GitHub License Deps.rs Crate Dependencies (specific version) docs.rs (with version)

A Rust #no-std optimized wave table synthesizer for embedded devices.

[!CAUTION] This project is actively being developed with frequent breaking changes. APIs may shift, features are incomplete, and stability is not guaranteed. Use at your own risk and expect regular updates that might require code adjustments. Have fun!

[!IMPORTANT] Hi Squeaky Things can happen at any time. Little Weirdo is ready to squeak, squuuueak, squeeeeeaak, squeaaaaaaaaak!

How to use it

Get the library!

$ cargo add little_weirdo

Start using it in your own code:

use little_weirdo::synth::{
    self,
    data::wavetables::{BoxedWavetable, BoxedWavetables},
};
 
 use std::{
    fs,
    sync::Arc,
};

 const SAMPLE_RATE: u16 = 44_100; // Audio sample rate in Hz
 
 fn main() {
     // Create a collection of wavetables and load them from files
    let mut wt_on_heap = BoxedWavetables::new();
    for id in 0..10 {
        let filename = format!("examples/soundbank/soundbank_pure_elektro/src/wav{}.raw", id);
        let contents = fs::read(filename).unwrap();
        let bytes: &[u8] = &contents;
        wt_on_heap.add(BoxedWavetable::new(bytes));
    }
    // Wrap wavetables in an Arc for thread-safe sharing
    let wt = Arc::new(wt_on_heap);
    
    // Load a synth patch from a JSON file
    let patch = serde_json::from_slice(include_bytes!("patches/bass.json")).unwrap();

    // Create a new synthesizer instance with specified parameters
    let mut synth: synth::Synth = synth::Synth::new(SAMPLE_RATE as u16, &patch, Arc::clone(&wt));

    // Trigger a note
    synth.note_on(60, 100);

    loop {
        let _sample:[i16;2] = synth.clock_and_output();
        // do something with the sample, stream it to a audio device for example
        break;
    }
    
 }

Run Little Weirdo as a MIDI device while outputting to a local Audio Output, check out Little Weirdo Streaming Audio With MIDI

If you just want to play with a patch for Little Weirdo, check out Little Weirdo Patch Tester

To generate you own Soundbank, download some Wavetable samples from AKWF and run Little Weirdo Generate Soundbank

Performance

The performance tests on real embedded hardware can be found here Little Weirdo ESP32

Patches

Patches can be fully programmed in Rust or loaded using JSON (Testing) or Postcard (Embedded Devices). Checkout the patches

🎹 Listen to the Ebass patch (unmute the audio 🔇 ➡️ 🔊) :

https://github.com/user-attachments/assets/56b9666d-ab76-4716-8fe9-58ffc7642058

Credits

Commit count: 0

cargo fmt