A lightweight tool to play audio samples in response to MIDI input events.
- Play audio samples triggered by MIDI notes
- Simple JSON configuration
- Low-latency audio via JACK
- JACK Audio Connection Kit (typically on Linux systems)
- Rust tool-chain (for building from source)
cargo install --git https://github.com/worikgh/midi_sample.git
cd midi_sample
cargo build --release
Create a JSON config file (config.json) specifying your samples and their corresponding MIDI notes:
{
"samples_descr": [
{
"path": "/path/to/sample1.wav",
"note": 60
},
{
"path": "/path/to/sample2.wav",
"note": 62
}
]
}
target/release/midi_sample /path/to/config.json
The program will:
Create a MIDI input port named MidiSampleQzn3tMidi
Create a JACK audio output port named MidiSampleQzn3tJack:output
Connect your MIDI controller to the input port and the audio output to your speakers/mixer.
The configuration uses these Rust structures:
struct SampleDescr {
path: String, // Path to audio sample file
note: u8, // MIDI note number (0-127)
}
struct Config {
samples_descr: Vec<SampleDescr>, // Collection of sample mappings
}
Any format supported by the symphonia
crate.
From that website:
The following container formats are supported.
- AIFF
- CAF
- ISO/MP4
- MKV/WebM
- OGG
- Wave
The following codecs are supported.
- AAC-LC
- ADPCM
- ALAC
- FLAC
- MP1
- MP2
- MP3
- PCM
- Vorbis