Skip to content

Instantly share code, notes, and snippets.

@keiya
Last active September 26, 2016 00:53
Show Gist options
  • Save keiya/a16b0a28d21eca8cf743a7e0b400fd9d to your computer and use it in GitHub Desktop.
Save keiya/a16b0a28d21eca8cf743a7e0b400fd9d to your computer and use it in GitHub Desktop.
MIDI to WAV / WavPack. For extreme high audio quality, we use 64bit/32bit floating-point intermediate file.
#!/bin/bash
BANKSELECT='gm'
SF="$HOME/Timbres Of Heaven GM_GS_XG_SFX V 3.2 Final.sf2"
find "$1" -type f -iname "*.mid" -print0 | while IFS= read -r -d '' fullfile; do
file=`basename ${fullfile}`
fluidsynth -g 0.01 -o synth.midi-bank-select=$BANKSELECT -o synth.midi-channels=256 -o synth.polyphony=4096 -r 48000 -O double -F "${file}_raw.wav" "${SF}" "${fullfile}"
sox --norm=-1 "${file}_raw.wav" -b 32 -e signed-integer "${file}.wav"
rm "${file}_raw.wav" &
wavpack -q -f -x6 -m -d "${file}.wav" &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment