Skip to content

Instantly share code, notes, and snippets.

@hadess
Last active June 24, 2019 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadess/59cda27c83f3555966b8d1df85422c13 to your computer and use it in GitHub Desktop.
Save hadess/59cda27c83f3555966b8d1df85422c13 to your computer and use it in GitHub Desktop.
SMF (Standard Midi File) 1 format to SMF 0 format converter using ALSA's arecordmidi
#!/bin/sh
#
# Adapted from https://music.stackexchange.com/questions/39040/how-can-i-convert-a-standard-midi-file-from-type-1-to-type-0
if [ $# != 2 ] ; then
echo "Usage: $0 infile.mid outfile.mid"
exit 1
fi
arecordmidi -p 14:0 "$2" &
PORT=`aplaymidi -l | grep arecordmidi | cut -d " " -f 1` # to identify 'arecordmidi port 0' device (e.g. 129:0)
aplaymidi -p $PORT "$1"
kill %%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment