https://github.com/davidlang42/midi-sampler
A CLI tool which reads notes from MIDI-IN and plays corresponding WAV samples to audio out
https://github.com/davidlang42/midi-sampler
midi
Last synced: 4 months ago
JSON representation
A CLI tool which reads notes from MIDI-IN and plays corresponding WAV samples to audio out
- Host: GitHub
- URL: https://github.com/davidlang42/midi-sampler
- Owner: davidlang42
- License: gpl-3.0
- Created: 2024-03-10T01:44:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-21T01:28:02.000Z (about 2 years ago)
- Last Synced: 2024-04-21T02:44:34.573Z (about 2 years ago)
- Topics: midi
- Language: Rust
- Homepage:
- Size: 3.85 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# midi-sampler
A CLI tool which reads notes from MIDI-IN and plays corresponding WAV samples to audio out
From https://github.com/RustAudio/cpal:
```
Note that on Linux, the ALSA development files are required. These are provided as part of the libasound2-dev package on Debian and Ubuntu distributions and alsa-lib-devel on Fedora.
```
For simplicity, the current CLI interface takes only 1 argument, the path to the SETTINGS file, which defaults to `settings.json`. The SETTINGS file is expected to be valid json representing a single or comma separated list of the settings objects described below. For ease of use, the surrounding `[` and `]` are implied and should not be included in the file.
```
{
"msb": 0-127, "lsb": 0-127, "pc": 1-128 // sets which program change will trigger this set of settings
"name": "A label for this set of samples", // currently only used for debugging
"samples": { // the mapping of note names to WAV files
"A0": "/home/pi/lightning-low.wav",
"C8": "/home/pi/lightning-high.wav",
...
}
}
```
Upon starting, it expects there to be no MIDI devices (to ensure that the audio device has connected cleanly) then waits for exactly 1 MIDI device to be connected. This device is then used as MIDI-IN.
In order to use multiple sets of samples, the sampler listens to MIDI program changes matching the msb/lsb/pc of each settings object in the SETTINGS file.
For instructions on how to run this on a Raspberry Pi Zero 2w, click [here](hardware/SETUP.md).