Create a gist now

Instantly share code, notes, and snippets.

@kroger /midi2mp3
Last active Jan 24, 2016

Convert MIDI files to MP3 using fluidsynth. See
#!/usr/bin/env bash
SOUNDFONT=/Users/kroger/Dropbox/Sfonts/BOPLMEVF16.sf2
TMPDIR=/tmp
if [[ ! -f $SOUNDFONT ]]
then
echo "Couldn't find the soundfont: $SOUNDFONT"
exit 1
fi
if [ "$#" -eq 0 ]
then
echo "usage: midi2mp3 file1.mid [file2.mid, file3.mid, ...]"
exit 0
else
for filename in "$@"
do
echo "${filename}"
WAVFILE="$TMPDIR/${filename%.*}"
fluidsynth -F "${WAVFILE}" $SOUNDFONT "${filename}" && \
lame "${WAVFILE}" && \
rm "${WAVFILE}"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment