Clojure library that helps with creating data sets from midi files.
- only intereseted in midi note on events
- processes those events per track and outputs all events for each track
- produces multiline string of 0s and 1s on stdout
00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000
^ ^
bit 127, which corresponds to note G9 bit 0, which corresponds to note C-1
- each line represents a single step of note on events
- each "step" lists all notes playin at the same timestamp
- notes that plays at given step are encoded as
1
and all other are0
(this allows for encoding chords) - each line has 128 characters, which is a binary number, little endian encoded, which means bit 0 is on the right and bit 127 is on the left
- each bit corresponds to midi note number, from 0 to 127
The following output will be produced for a step where only one note, C4
plays:
00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000
^
bit 60 is set to true, which corresponds to note C4
The following output corresponds to Cmajor scale played up and down, at 4th octave:
00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000
Just download midi2stepfile
from latest release and run it, passing path to one or multiple midi files, like this:
midi2stepfile resources/c_major_scale.mid
midi2stepfile some/path/to/*.mid
Each track from each file will be printed to stdout encoded as 0
s and 1
s.
Run tests with lein midje
.
lein bin
The binary will be put into bin/midi2stepfile
- add time quantization for steps
- add some way to consume streams (stdin first?)
Copyright © 2020 Wojciech Majewski
MIT License