mwg API
    Preparing search index...

    Interface RenderMidiOptions

    A Standard MIDI File rendered to stereo PCM frames, the same bridge the RPG Maker player crosses with an offline audio context: browsers cannot decode MIDI, so the file is synthesized once, faster than real time, and what comes out is an ordinary buffered track with a loop region, ready for a Channel, a seek and a pitch and pan control that MIDI bytes on their own could never answer.

    Two voicings. With a SoundFont every note plays the real instrument sample for its bank, program, key and velocity, with the font's loops, envelope, tuning and pan. Without one a small General MIDI approximation voices it instead: each program family maps to a waveform and envelope recipe and channel 10 is a noise and sine drum kit. Both honour channel volume, expression and pan per note; the synth keeps melody, rhythm and structure while its timbre stays approximate, which is why a SoundFont makes such a difference. Pitch bend is voiced as the bend in effect when each note starts (two semitones either way); a bend that moves while a note holds does not glide it.

    interface RenderMidiOptions {
        channels?: readonly number[];
        gain?: number;
        maxDuration?: number;
        sampleRate?: number;
        soundfont?: SoundFont | null;
        synth?: MidiSynthRequest;
    }
    Index
    channels?: readonly number[]

    voices only these channels (0 to 15) and drops the rest, to render one stem of a file

    gain?: number

    master level, 0 to 1

    maxDuration?: number

    hard cap on rendered seconds; longer tails are cut

    sampleRate?: number

    output sample rate in Hz

    soundfont?: SoundFont | null

    voices every note from these samples; without one the built-in synth plays

    voices the file through a MidiSynth instead: a registered engine name ('retro:mt32'), a factory, or an ordered list tried until one works. Takes precedence over soundfont, which stays the next choice when the synth cannot be used (see onMidiSynthFallback).