Search in sources :

Example 1 with MidiSequence

use of com.xenoage.zong.io.midi.out.MidiSequence in project Zong by Xenoage.

the class WavScoreFileOutput method writeWav.

/**
 * Writes the given score as a WAV file into the given stream.
 */
public static void writeWav(Score score, OutputStream stream) throws IOException {
    // save WAVE file
    try {
        // create midi sequence
        MidiSequence<Sequence> sequence = MidiConverter.convertToSequence(score, optionsForFileExport, new JseMidiSequenceWriter());
        // for all instruments
        MidiToWaveRenderer.render(SynthManager.getSoundbank(), sequence.getSequence(), null, new JseOutputStream(stream));
    } catch (Exception ex) {
        INSTANCE.log(Companion.warning(ex));
        throw new IOException(ex);
    }
}
Also used : JseOutputStream(com.xenoage.utils.jse.io.JseOutputStream) JseMidiSequenceWriter(com.xenoage.zong.desktop.io.midi.out.JseMidiSequenceWriter) MidiSequence(com.xenoage.zong.io.midi.out.MidiSequence) Sequence(javax.sound.midi.Sequence) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

JseOutputStream (com.xenoage.utils.jse.io.JseOutputStream)1 JseMidiSequenceWriter (com.xenoage.zong.desktop.io.midi.out.JseMidiSequenceWriter)1 MidiSequence (com.xenoage.zong.io.midi.out.MidiSequence)1 IOException (java.io.IOException)1 Sequence (javax.sound.midi.Sequence)1