Skip to content

Instantly share code, notes, and snippets.

@arnaldorusso
Forked from kroger/midi2mp3
Created January 24, 2016 13:45
Show Gist options
  • Save arnaldorusso/e6a955415d0a15fd99bf to your computer and use it in GitHub Desktop.
Save arnaldorusso/e6a955415d0a15fd99bf to your computer and use it in GitHub Desktop.
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