midi123
midi123 is a command line MIDI player and MIDI->WAV converter for Linux that uses Remilia's Haematite library for its audio engine. It is written entirely in the Crystal programming language.
Releases and AppImages for x86-64 Linux systems can be found on the Releases wiki page.
Wanna support this project? Buy Remilia a coffee on Ko-Fi, or support her through Liberapay.
Example videos
- Warcraft 2's "Human 1" by Glenn Stafford (midi123 v2.2.0)
- Rise of The Triad's "How'd I Do?" by Lee Jackson (midi123 v2.2.0)
- Virtua Racing's title theme, by Takenobu Mitsuyoshi, Naofumi Hataya, and Tomoko Sasaki (midi123 v2.2.0)
- The Secret of Monkey Island's intro theme by Michael Land and Patrick Mundy (midi123 v2.2.0)
- Sonic the Hedgehog's Green Hill Zone by Masato Nakamura (midi123 v2.0.0)
- Sonic the Hedgehog's Spring Yard Zone by Masato Nakamura (midi123 v2.0.0)
- Rise of The Triad's "Smoke and Mirros" by Lee Jackson (midi123 v2.0.0)
- Mega Man 2's Airman stage music by Takashi Tateishi (midi123 v2.0.0)
Basic Usage
midi123 is a command line program. To play a MIDI, run midi123 with the MIDI file as a parameter. Multiple MIDI files can be specified, and they will be played in the order that they appear on the command line.
The program will respond to various keys during playback. These are listed
below, and you can also press the h
key to see them while midi123 is running.
n
: Go to the next MIDI file.p
: Go to the previous MIDI file.e
: Toggle the EQ effect on and off.r
: Toggle the reverb effect on and off.c
: Toggle the chorus effect on and off.a
: Raise the volume.z
: Lower the volume.q
: Quit the program.
If you want to pause playback, the easiest way is just to do a Ctrl+Z to suspend
the program. Later you can use fg 1
to start the program running again
exactly where it left off (you may need to use a different number than 1
if
you have multiple programs suspended).
There is also a configuration file where
you can set various options so that you don't need to always type in the command
line parameters. The location for this file is
$XDG_CONFIG_HOME/midi123/midi123.hjson
(this usually means
~/.config/midi123/midi123.hjson
).
Below are various examples of how to call midi123 on the command line.
# Play a MIDI file using a SoundFont, and stop after it finishes.
$ midi123 -s TimGM6mb.sf2 "24 - I Choose the Stairs.mid"
# Play a MIDI file using a SoundFont, and loop at the end.
$ midi123 --loop -s sc-55.sf2 "11 - Goin' Down the Fast Way.mid"
# Render multiple MIDI files to WAVs in parallel.
$ midi123 --render -s "Arachno SoundFont.sf2" "15 - Spray.mid" "my playlist.xspf" "07 - How'd I Do.mid"
# Show the help information.
$ midi123 --help
# Show version information
$ midi123 --version
Notable Features
- [x] Supports both MIDI, RMI, and MUS files
- [x] Can automatically download music files from HTTP/HTTPS URLs
- [x] Can automatically download music files from Gemini URLs
- [x] Support for XSPF and JSPF playlists
- [x] PortAudio and PulseAudio backends available
- [x] Multiple files can be specified and they will play one after the other
- [x] Per-song configuration files
- [x] Loop support
- [x] Rendering to either WAV or Au format
- [x] Rendering multiple files to WAV or AU in parallel without excess memory usage
- [x] Support for multiple bit depths and sample rates, and both integer and floating point WAVs
- [x] Parametric EQ with an arbitrary number of bands
- [x] Multiple reverb models to choose from
- [x] Multiple filter models to choose from for both the voices, and the channels
- [x] Optional stereo enhancement effect
- [x] Optional soft clipping
- [x] Control over the reverb and chorus effects
- [x] VU meters
- [x] Keyboard control support
- [x] Configuration file support
Building from Source
You will need Fossil installed to clone this repo and the dependency. You will also need Shards v0.17.1 or later. If you have an earlier version of Shards, you will need to to build the latest version manually.
To build the program, start out by cloning this Fossil repository somewhere and changing into the directory.
fossil clone https://chiselapp.com/user/MistressRemilia/repository/midi123/
cd midi123
You can then use rake
to build things in the following ways:
rake
: Builds an optimized binary.rake help
: See the various options for building the binary.rake midi123[debug]
: Builds a non-optimized debug build.rake midi123[normal]
: Builds an optimized binary.rake midi123[fast]
: Builds an optimized, striped binary.
There are more detailed instructions in the wiki.
Development
Style info
I use a somewhat non-standard style for my code.
- Keep lines 118 characters or shorter. Obviously sometimes you can't, but please try.
- Please use pascalCase for variable and method names. Use CamelCase for type names. Use UPPER_SNAKE_CASE for constants.
- ALWAYS put parentheses around method parameters, except for these methods:
puts
,pp
,p
,raise
,sleep
,spawn
,loop
, andexit
. - Always the full
do |foo|...end
syntax with blocks, except when it's all on one line, then always use { and }. - The type name for exceptions end with Error. For example, an exception when
running and external program might be called
ExternalProgramError
.
How do I contribute?
- Go to https://chiselapp.com/user/MistressRemilia/repository/midi123/ and clone the Fossil repository.
- Create a new branch for your feature.
- Push locally to the new branch.
- Create a bundle with Fossil that contains your changes.
- Get in contact with me.
Contributors
- Remilia Scarlet - creator and maintainer
- Homepage: https://remilia.sdf.org/
- Mastodon: @MistressRemilia@social.sdf.org
- Email: zremiliaz@postzeoz.jpz My real address does not contain Z's
Links and Licenses
- CL-MeltySynth by Remilia Scarlet (AGPLv3)
- MeltySynth by Sinshu (MIT License)
midi123 is under the GNU Affero General Public License version 3.