Converts MIDI files into music box scores that are ready to print.
This is a command-line program that converts MIDI files to scores that can be printed for any music box.
If you are unsure of how to create a MIDI file for this program to consume, I recommend Musescore, which is a free and open source music notation program that has a MIDI export function.
You can also download a pre-compiled binary and run that over here
- To build this just install rust via the Rust toolchain installer
- Run 'cargo build --release'
- The binary will be under './target/release/music_box_converter' (Path might vary depending on the OS)
# Convert midi (*.mid|*.midi) => svg (*.svg)
music_box_converter convert --input 'Path to your midi file' --output 'Path to your output folder'
There are two commands for this:
music_box_converter convert
music_box_converter config
The convert option lets you convert a midi file to a svg file. To do this it need a couple of things:
- Your midi file
- An output directory
- A json file with your music box configuration
- A json file with general settings for svg writing
This project provides both files. More in the Configuration part.
There are the following options:
- -i, --input <FILE>
The input file to use. - -o, --output <FILE>
The output directory to output to.
- -s, --settings <FILE>
Specifies which settings file to use.
[default: ./settings.json] - -b, --box <FILE>
Specifies which box file to use.
[default: ./box.json] - -T, --track <TRACK_NUMBER>
Specifies which track from the midi file to use. Zero-based.
[default: 0] - -O, --midi-out When set outputs a midi file with transposed notes on one track and the original track.
- -t, --transpose Wether to transpose notes that can't normally be played.
- -v, --verbose... Increases verbosity. Can be used multiple times to raise log level.
- -q, --quiet No Output. Exclusive to verbosity
- --force Allows to output into the current working directory.
- -h, --help Print help
- -V, --version Print version
Short options that don't require a value can be put together
# Verbose is set to two, transpose is set and track number is 1
music_box_converter convert -i 'PATH' -o 'PATH' -vvtT 1
The config option lets you edit a settings.json file with a gui editor. It only has three optional option:
- -s, --settings <FILE>
Specifies which settings file to use.
[default: ./settings.json] - -h, --help Print help
- -V, --version Print version
There are two files you can change to your liking. The first is the settings.json file.
This file is read by the convert program and includes settings primarly for svg writing. This file is best edited with the config command and so this part is dedicated to the config editor.
The editor, Credit: background image
To change between settings use the up and down arrow keys or alternatively ^E and ^D respectively. You can use ^L to clear the line and ^S to open a pop up dialogue for saving and ^O to open a dialogue for opening a file. The path that is displayed will be the path that was used for opening or saving a file.
Note: Should the editor crash the terminal will be messed up. I recommend just creating a new instance. To fix this I somehow need to catch a panic and I don't really know how to do this just yet.
The editor includes tips and help for each item. Should you find that there aren't enough options and settings for you to tweak don't hesitate to write me an e-mail. I might take a while to respond because I don't read my e-mails frequently enough.
This was inspired by a similar project by starbeamrainbowlabs: Repo, Blog