midi.js
A modern JavaScript port of MIDI.js.
Basic Examples
Installtion
$ npm install midi.js
Import
import MIDI from 'midi.js'
Usage & APi
loader.js - Decides which framework is best to use
// interface to download soundfont, then execute callbackMIDI// simple example to get startedMIDI;
plugins/webaudio.js - Controls MIDI output
MIDIMIDIMIDIMIDIMIDIkeyToNote = object // A0 => 21MIDInoteToKey = object // 21 => A0
player.js - Plays MIDI stream
MIDIPlayercurrentTime = integer // time we are at now within the song.MIDIPlayerendTime = integer // time when song ends.MIDIPlayerplaying = boolean // are we playing? yes or no.MIDIPlayer // load .MIDI from base64 or binary XML request.MIDIPlayerstart // start the MIDI track (you can put this in the loadFile callback)MIDIPlayer // resume the MIDI track from pause.MIDIPlayer // pause the MIDI track.MIDIPlayer // stops all audio being played, and resets currentTime to 0.
Listener for when notes are played
MIDIPlayer // removes current listener.MIDIPlayer
Smooth animation interpolating between onMidiEvent calls
MIDIPlayer; // clears current animation.MIDIPlayer
Refer to https://github.com/mudcube/MIDI.js#api for more details.