Object containing all data needed to record and render a MIDI audio clip.
Methods
-
async finalize()
-
Stops recording any future MIDI data within the MidiClip, finalizes the internal storage of all recorded data, and calls the user-completion notification callback, if registered.
Note that this function is called automatically if the original call to recordMidiClip() specified a concrete duration for the clip. If no duration was specified, then this function must be called in order to stop recording. A MidiClip is unable to be used or played back until this function has been called.
-
getDuration() → {number}
-
Returns the total duration of the MIDI clip in seconds.
Returns:
number -Duration of the MIDI clip in seconds
-
async getEncodedData(encodingType) → {Blob}
-
Encodes this MidiClip into a Blob containing raw audio data according to the EncodingType specified in the
encodingTypeparameter.Parameters:
Name Type Description encodingTypenumber Numeric value corresponding to the desired EncodingType
- See:
-
getRawData() → {Object}
-
Returns a dictionary of all MIDI event data within the MidiClip, stored according to the relative times (in seconds) that they were received.
Returns:
Object -Dictionary containing MIDI event data stored according to their relative reception times
-
notifyWhenComplete(notificationCallback)
-
Allows a user to register a callback for notification when all MIDI recording activities have been completed for this MidiClip. This corresponds to the time when the finalize() function gets called, either manually or automatically.
A user-defined notification callback will be called with a single parameter which is a reference to this MidiClip.
Parameters:
Name Type Description notificationCallbackRecordCompleteCallback Callback to fire when recording of this clip has completed