An optional BasePlayerCallback, specifies an object that contains run() and stop() methods to invode during playback.
Returns the playback state of the player, either "started", "stopped", or "paused".
Returns false iff the player is completely stopped. This will only be false after creating the player or after calling stop(), and will be true after calling start(), pause() or resume().
Pause playing the currently playing sequence right away. Call resume() to resume.
Requests MIDI access from the user, and stores all available MIDI outputs.
Resume playing the sequence after pause().
Resumes the Audio context. Due to autoplay restrictions, you must call this function in a click handler (i.e. as a result of a user action) before you can start playing audio with a player. This is already done in start(), but you might have to call it yourself if you have any deferred/async calls.
Seek to a number of seconds in the NoteSequence.
Changes the tempo of the playback.
The new qpm to use.
Starts playing a
NoteSequence (either quantized or unquantized), and
returns a Promise that resolves when it is done playing.
NoteSequence to play.
(Optional) If specified, will play back at this qpm. If not specified, will use either the qpm specified in the sequence or the default of 120. Only valid for quantized sequences.
(Optional) The time to start playing from.
a Promise that resolves when playback is complete.
Stop playing the currently playing sequence right away.
Generated using TypeDoc
NoteSequenceplayer that uses a MIDI output for playing. Note that WebMIDI is not supported in all browsers. A polyfill exists, but it too requires a plugin to be installed on the user's computer, so it might not work in all cases.
If you want to use a particular MIDI output port, you must update the
outputproperty before calling
start, otherwise a message will be sent to all connected MIDI outputs:
Example (easy mode):
If you want to specify which MIDI channel the messages should be sent on, you can set the
outputChannelproperty before calling
start. By default, the
You can also explicitly request MIDI access outside of the player, in your application, and just update the
outputproperty before playing:
Example (advanced mode):