| Crates.io | audio-midi-shell |
| lib.rs | audio-midi-shell |
| version | 0.1.0 |
| created_at | 2025-12-05 10:46:25.504355+00 |
| updated_at | 2025-12-05 10:46:25.504355+00 |
| description | Prototyping shell for audio development. |
| homepage | |
| repository | https://github.com/sourcebox/audio-midi-shell-rs |
| max_upload_size | |
| id | 1968001 |
| size | 35,012 |
Cross-platform wrapper around tinyaudio and midir for prototyping audio algorithms as standalone applications.
It opens the default audio output device with a given sample rate and buffer size. MIDI messages are received from all detected MIDI inputs ports. The process chunk size can be set independently from the buffer size.
use audio_midi_shell::{AudioMidiShell, AudioGenerator};
const SAMPLE_RATE: u32 = 44100;
const BUFFER_SIZE: usize = 1024;
const PROCESS_CHUNK_SIZE: usize = 16;
fn main() -> ! {
AudioMidiShell::run_forever(SAMPLE_RATE, BUFFER_SIZE, PROCESS_CHUNK_SIZE, TestGenerator);
}
struct TestGenerator;
impl AudioGenerator for TestGenerator {
fn init(&mut self, chunk_size: usize) {
// Optional function, called once on startup for initialization tasks.
}
fn process(&mut self, frames: &mut [[f32; 2]]) {
// Called periodically with a buffer of `PROCESS_CHUNK_SIZE` samples.
// Fill `frames` with sample data accordingly.
}
fn process_midi(&mut self, message: &[u8], timestamp: u64) {
// Optional function, called on each incoming MIDI message.
}
}
The examples directory contains a simple monophonic synthesizer playing a sine wave for each received note.
cargo run --example sine_synth
Published under the MIT license. Any contribution to this project must be provided under the same license conditions.
Author: Oliver Rockstedt info@sourcebox.de