mwg API
    Preparing search index...

    Interface MidiSynth

    A synthesiser that voices MIDI messages: the seam that lets something other than a SoundFont or the built-in approximation be the sound bank of a MIDI file. mwg owns the contract so the core never depends on whoever implements it; a retro-instrument package satisfies it from the outside and registers its engines by name.

    interface MidiSynth {
        sampleRate: number;
        event(status: number, data1: number, data2: number): void;
        render(
            left: Float32Array,
            right: Float32Array,
            start: number,
            count: number,
        ): void;
        reset(): void;
        sysex(bytes: Uint8Array): void;
    }

    Implemented by

    Index
    sampleRate: number

    rate the synth renders at; a render of a file through it comes out at this rate

    • a channel message as the three bytes a hardware synth would receive (the second data byte is 0 for a program change)

      Parameters

      • status: number
      • data1: number
      • data2: number

      Returns void

    • adds count frames of stereo output at start of both buffers, advancing the synth by that many samples

      Parameters

      • left: Float32Array
      • right: Float32Array
      • start: number
      • count: number

      Returns void

    • silences every voice and returns the synth to its power-on state

      Returns void

    • a system-exclusive message, with or without the leading 0xF0 and trailing 0xF7

      Parameters

      • bytes: Uint8Array

      Returns void