Constructor
new MidiAudioPlayer(data, optionsopt)
MidiAudioPlayer constructor
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data | external:ArrayBuffer | The MIDI file content, in ArrayBuffer format | ||
options | object | <optional> | {} | Optional params related to the type of soundfont used. Valid options inside this object are:
|
- Source
Members
currentTime
Gets the current time
- Source
currentTime
Sets the current time of this player (in milliseconds)
- Source
data :external:ArrayBuffer
The MIDI file data used by this MIDI player
- external:ArrayBuffer
- Source
ended
Checks if the current player has ended or is already playing
- Source
mainVolume :number
Main volume of this track (set with a MIDI message of type Controller Change
#7)
- number
- Source
paused
Gets the ' paused' state of the current player
- Source
playTo :number
When >0, time position at which the music must end
- number
- Source
player :external:MidiPlayerJS
The grimmdude's MidiPlayer used by this player
- Source
startedNotes :Array.<function()>
This array is used when processing 'Note off' events to stop notes that are currently playing.
It contains a collection of 'instrument.play' instances, one for each active note
- Array.<function()>
- Source
(static) MIDISoundFontBase :string
The URL used as base for the current collection of MIDI soundfonts.
This value can be overwritten by the global parameter MIDISoundFontBase
- string
- Source
(static) MIDISoundFontExtension :string
An extension to be added to MIDISoundFontName
in order to build the full file name of the soundfont JS file.
Current valid options are -mp3.js
and -ogg.js
This value can be overwritten by the global parameter MIDISoundFontExtension
- string
- Source
(static) MIDISoundFontName :string
The MIDI instrument name.
This value can be overwritten by the global parameter MIDISoundFontName
See MIDI.js Soundfonts for full lists of MIDI instrument names.
- string
- Source
(static) MIDISoundFontObject :object
An object containing the full soundfont data used by instrument
When this member is set, no other settings related to the sounfFont will be used.
This value can be overwritten by the global parameter MIDISoundFontObject
- object
- Source
(static) audioContext :external:AudioContext
The external:AudioContext
used by this MIDI player.
- Source
(static) instrument :external:Instrument
The "Instrument" object used by this MIDI player.
See: https://github.com/danigb/soundfont-player
- Source
(static) loadingInstrument :boolean
A flag used to avoid re-entrant calls to prepareInstrument
- boolean
- Source
Methods
pause()
Pauses the player
- Source
play()
Starts or resumes playing
- Source
playEvent(ev)
Plays a MIDI event
Name | Type | Description |
---|---|---|
ev | object | The event data. See http://grimmdude.com/MidiPlayerJS/docs/index.html for details |
- Source
(static) prepareInstrument(options, audioContext)
Initializes the soundfont instrument, loading data from GitHub
NOTE: This will not work when off-line!
TODO: Provided a basic, simple, static soundfont
Name | Type | Description |
---|---|---|
options | object | Optional param with options related to the MIDI soundfont. See details in |
audioContext | external:AudioContext | The AudioContext object (see: https://developer.mozilla.org/en-US/docs/Web/API/AudioContext) |
- Source