I repeatedly create rehearsal files for my choir from midi files, meaning I download a midi file of the song (or create it myself), import it into a sequencer, and then bounce different audio files, where the parts have been mixed so that one of them can be heard better than the others.

This is quite a time consuming process, and even though I've been able to script away some parts of it (by mixing down each track as an individual audio file and then using sox in a bash script to crate all the files), I'm still on the lookout for something even more efficient.

Is there some kind of program out there that takes midi files and input and create rehersal audio files as output?

1 Answer 1


If I understand correctly, you have a midi file with N different tracks, and you want to create N sound files out of that where for each sound file, one of the tracks is proportionately louder than all the other tracks.

If that's the case, you can do this with python and the fantastic music21 library:

from music21 import *
##Load in a MIDI file
st = converter.parse(filePath)

Then, for each file you want to create, and for each part in the music21 stream, adjust the volume of all the notes + chords

for n in streamPart.notes:
    n.volume.velocity = (n.volume.velocity * scaleFactorForPart)

where scaleFactorForPart is (for example) 1 if the part is the one you're wanting to be louder, or 0.8 (eg) for all other parts.

Finally, save out the MIDI files:

mf = midi.translate.streamToMidiFile(finalStream)
fileName ="whatever.mid"
mf.open(fileName, 'wb')

Obviously these example bits of code are pseudo-code and I've left out a bit of logic. Once you've saved out all the MIDI files, you can use a bash script and converter to convert the MIDI files to MP3/Wav/Whatever.

  • Thanks! I'll check this package out and then get back to you, reporting how it all went.
    – Speldosa
    Commented Jun 23, 2015 at 14:05
  • I figured there were no pre-built packages for this kind of thing and ended up scripting the whole thing myself, although by utilizing midicsv instead of the proposed program in this answer. I'm still trying to figure out the midi to audio part though (it can be done through fluidsynth and soundfonts but that doesn't sound particularly well, even when using the highest quality ones).
    – Speldosa
    Commented Jun 24, 2015 at 12:07
  • btw -- the last section can be done simply with finalStream.write('midi', fp="whatever.mid"). Commented Dec 16, 2016 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.