Introduction to Web MIDI
获得midi设备 navigator.requestMIDIAccess if ( navigator . requestMIDIAccess ) { console . log ( 'Browser supports MIDI!' ) ; } if ( navigator . requestMIDIAccess ) { navigator . requestMIDIAccess ( ) . then ( success , failure ) ; } navigator.requestMIDIAccess() returns a promise, function success ( midi ) { console . log ( 'Got midi!' , midi ) ; } function failure ( ) { console . error ( 'No access to your midi devices.' ) } success function takes a MIDI parameter in the form of a MIDIAccess object. MIDIAccess object is the key to receiving midi data. Inputs represent any MIDI devices you have