MIDI assembler/disassembler to convert between standard MIDI files and a text/JSON equivalent.
A Go reimplementation of Jeff Glatt's long defunct Windows-only MIDIASM (last seen archived at MIDI Technical Fanatic's Brainwashing Center). Because sometimes it's easier to just programmatically deal with text or JSON.
Executables for all the supported operating systems are packaged in the releases. Installation is straightforward - download the archive and extract it to a directory of your choice.
midiasm help
will list the available commands and associated options (documented below).
Required tools:
- Go 1.23+
- make (optional but recommended)
To build using the included Makefile:
git clone https://github.com/transcriptaze/midiasm.git
cd midiasm
make build
Without using make
:
git clone https://github.com/transcriptaze/midiasm.git
cd midiasm
go build -trimpath -o bin/ ./...
The above commands build the midiasm
executable to the bin
directory.
None
Usage: midiasm <command> <options>
Supported commands:
Defaults to disassemble
if the command is not provided.
Disassembles a MIDI file and displays the tracks in a human readable format.
Command line:
midiasm [--debug] [--verbose] [--C4] [--split] [--out <file>] <MIDI file>
--out <file> Writes the disassembly to a file. Default is to write to stdout.
--split Writes each track to a separate file. Default is `false`.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm --debug --verbose --out one-time.txt one-time.mid
Assembles a MIDI file from a text or JSON source.
Command line:
midiasm assemble [--debug] [--verbose] [--C4] [--out <MIDI file>] <file>
--out <file> Output MIDI file. Defaults to the input file with a .midi extension.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm assemble --debug --verbose --out one-time.mid one-time.json
Extracts the MIDI information as JSON for use with other tools (e.g. jq).
Command line:
midiasm export [--debug] [--verbose] [--C4] [--out <file>] <MIDI file>
--out <file> Writes the JSON to a file. Default is to write to stdout.
--json Formats the output as JSON - the default is human readable text.
--transpose <N> Transposes the notes up or down by N semitones.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm notes --debug --verbose --out one-time.json one-time.mid
Extracts the NoteOn and NoteOff events to generate a list of notes with start times and durations.
Command line:
midiasm notes [--debug] [--verbose] [--C4] [--out <file>] <MIDI file>
--out <file> Writes the notes to a file. Default is to write to stdout.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm notes --debug --verbose --out one-time.notes one-time.mid
Extracts the beats from the MIDI file in a format that can be used to create a click track.
Command line:
midiasm click [--debug] [--verbose] [--C4] [--out <file>] <MIDI file>
--out <file> Writes the click track to a file. Default is to write to stdout.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm click --debug --verbose --out one-time.click one-time.mid
Transposes the key of the notes (and key signature) and writes it back as MIDI file.
Command line:
midiasm transpose [--debug] [--verbose] [--C4] --semitones <steps> --out <file> <MIDI file>
--semitones <N> Number of semitones to transpose up or down. Defaults to 0.
--out <file> (required) Destination file for the transposed MIDI.
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm transpose --debug --verbose --semitones +5 --out one-time+5.mid one-time.mid
Extracts the MIDI information as a TSV or fixed width file for use with other tools (e.g. miller)
Command line:
midiasm tsv [--debug] [--verbose] [--C4] [--out <file>] <MIDI file>
--out <file> Output filepath. Default is to write to stdout.
--delimiter Column delimiter for TSV files. Defaults to TAB.
--tabular Formats the outputs as fixed width columns
Options:
--C4 Uses C4 as middle C (Yamaha convention). Defaults to C3.
--debug Displays internal information while processing a MIDI file. Defaults to false
--verbose Enables 'verbose' logging. Defaults to false
Example:
midiasm tsv --debug --verbose --out one-time.tsv one-time.mid