mwg API
    Preparing search index...

    Function connectWebMidi

    • Wires every input of a Web MIDI access to a MidiSynth: channel messages go to event, system-exclusive ones (framed by 0xF0 and 0xF7) to sysex, and everything else (clock, active sensing, a message with no data) is dropped, because a synth voices notes, not transport. The access is taken as a value, so a test hands in a fake and a browser hands in navigator.requestMIDIAccess()'s answer through requestWebMidiInput.

      Parameters

      Returns WebMidiConnection

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

      declare const access: WebMidiAccess;
      declare const synth: MidiSynth;

      const link = connectWebMidi(access, synth);
      console.log(link.ports); // how many keyboards are playing into the synth
      link.disconnect();