Class MidiAccess

The MidiAccess class provides an interface for fetching MIDI ports which data can be sent to, or received from.

The recommended way to get a new instance of this class is through the asynchronous request() method.

Example:

const midiAccess = await MidiAccess.request();
console.log(midiAccess.getOutPortNames());

Hierarchy

  • MidiAccess

Constructors

  • Please use the MidiAccess.request() method instead.

    Parameters

    • baseAccess: any

    Returns MidiAccess

Accessors

  • get portChanged(): MidiAccessPortEvent
  • The portChanged event dispatches an event whenever a new port is added, or an existing port is removed/modified.

    Returns MidiAccessPortEvent

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

Methods

  • Disconnects the MidiAccess object from its baseAccess. This is called to free things up for garbage collection. The MidiAccess object is entirely useless after this method has been called on it.

    Returns void

  • This method searches through all MIDI in ports for a specific one by name, and returns the port object.

    Returns

    Parameters

    • portName: string

      The name of the expected MIDI in port.

    Returns any

  • This method returns the names of all available MIDI in ports.

    Returns

    Returns string[]

  • This method searches through all MIDI out ports for a specific one by name, and returns the port object.

    Returns

    Parameters

    • portName: string

      The name of the expected MIDI out port.

    Returns any

  • This method returns the names of all available MIDI out ports.

    Returns

    Returns string[]

  • Calling this static method is the recommended way to get new instances of this class. It waits for the MIDI access request to be confirmed before returning a new MidiAccess instance.

    Returns Promise<MidiAccess>

Generated using TypeDoc