JorenSix / Tarsos

Culture independent processing of MIR data
https://0110.be/tags/Tarsos
GNU General Public License v3.0
25 stars 12 forks source link

Converting midi to wav with custom SoundBank fails when reopening synth #2

Open k4pran opened 6 years ago

k4pran commented 6 years ago

https://github.com/JorenSix/Tarsos/blob/4b3f172314766f9d2ff85946f7c82d32e5d4b5a1/src/be/tarsos/midi/MidiToWavRenderer.java#L148

In the class MidiToWavRenderer the method createWavFile() that allows the user include a custom SoundBank calls the AudioSynthesizer's open() method. It is then calls its' overloaded method which attempts to reopen 'synth':

createWavFile(final Sequence sequence, final File outputFile) {
...
AudioInputStream stream = synth.openStream(format, map);
...
}

This throws an exception and synth is already open:

javax.sound.midi.MidiUnavailableException: Synthesizer is already open