Last active
December 18, 2023 17:03
-
-
Save kroger/6211862 to your computer and use it in GitHub Desktop.
Convert MIDI files to MP3 using fluidsynth. See
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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