mwg API
    Preparing search index...

    Function requestWebMidiInput

    • Asks the browser for Web MIDI and wires it to synth: null where the browser has no Web MIDI (or the player refused it), so a game offers the live keyboard only where it can exist. System-exclusive is requested, since a bank dump arrives as sysex; a refusal of sysex alone still connects, without it.

      Parameters

      Returns Promise<WebMidiConnection | null>

      import { requestWebMidiInput, type MidiSynth } from '@datamoc/mwg/audio';

      declare const synth: MidiSynth;

      const link = await requestWebMidiInput(synth);
      console.log(link === null ? 'no live input here' : `${link.ports} port(s) live`);