https://github.com/peternicholls/midi
A simple MIDI message stream, record and playback CLI and TUI utility for MacOS
https://github.com/peternicholls/midi
cli macos midi midi-player midi-recorder tui
Last synced: 12 days ago
JSON representation
A simple MIDI message stream, record and playback CLI and TUI utility for MacOS
- Host: GitHub
- URL: https://github.com/peternicholls/midi
- Owner: peternicholls
- Created: 2026-05-12T03:27:06.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2026-05-20T06:48:47.000Z (about 1 month ago)
- Last Synced: 2026-05-20T09:58:02.331Z (about 1 month ago)
- Topics: cli, macos, midi, midi-player, midi-recorder, tui
- Language: C
- Homepage:
- Size: 616 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MIDI Capture
Small macOS command-line tool in C that:
- lists available CoreMIDI sources and destinations
- records MIDI from a class-compliant USB MIDI interface into a Standard MIDI File
- plays that `.mid` file back to a chosen MIDI destination
- provides a terminal TUI mode for browsing takes, recording timestamped files, and previewing live MIDI traffic
## Build
```sh
make
```
## Test
```sh
make test
```
## Usage
List MIDI ports:
```sh
./midi-capture list
```
Record from source `0` for 10 seconds:
```sh
./midi-capture record take.mid 10 0
```
Record until `Ctrl-C`:
```sh
./midi-capture record take.mid
```
Play the file back to destination `0`:
```sh
./midi-capture play take.mid 0
```
Launch the TUI with the current directory as the recordings destination:
```sh
./midi-capture tui
```
Launch the TUI with a dedicated recordings directory:
```sh
./midi-capture tui recordings
```
## TUI Mode
The TUI presents three panes:
- a recordings list sourced from the selected output directory
- a MIDI event view for the currently selected file, with left and right stepping through the sequence
- a live stream pane that shows incoming `RX` bytes whenever MIDI arrives on source `0`, plus outgoing `TX` bytes during playback
Default file naming uses `YYYYMMDDhhmmss.mid` in the selected recordings directory.
Keys:
- `r` starts recording to a new timestamped `.mid` file in the current recordings directory
- `s` stops the active recording or playback transport
- `space` pauses or resumes the active recording or playback transport
- `p` plays the currently selected file from the currently selected MIDI event
- `up` and `down` change the selected `.mid` file
- `left` and `right` step through the selected file's MIDI event sequence
- `o` changes the recordings directory from inside the TUI
- `q` exits the TUI; an active recording is stopped and saved first
## Notes
- The tool is intentionally small and targets MIDI 1.0 byte-stream devices on macOS.
- It records channel voice messages, MIDI running-status channel messages, and SysEx into the MIDI file.
- It ignores MIDI clock, active sensing, and other unsupported or incomplete system messages.
- During `record`, the terminal shows `REC`, elapsed time, and an `RX.` flash when MIDI arrives.
- During `play`, the terminal shows `PLAY`, elapsed and total time, and a `TX.` flash when MIDI is sent.
- In `tui` mode, source `0` is monitored continuously for live `RX` logging, recording also uses source `0`, and playback uses destination `0`.