Class: SynthesizerPlayer

SynthesizerPlayer(audioContext, synthesizer, notes, duration)

A SynthesizerPlayer uses the specified synthesizer to play the specified notes.

Constructor

new SynthesizerPlayer(audioContext, synthesizer, notes, duration)

Create a SynthesizerPlayer.
Parameters:
Name Type Description
audioContext Object An AudioContext.
synthesizer Object A synthesizer for playing notes.
notes Object The notes to play.
duration number The duration of the notes.
Author:
  • Lawrence Fyfe
Source:

Methods

(async) isReady() → {Promise}

Is this player ready to play? This returns a Promise that is already resolved to true. Returning a Promise makes this method compatible with the isReady() method of the AudioFilePlayer.
Source:
Returns:
A promise resolved to true.
Type
Promise

pause()

Pause playing.
Source:

play()

Play the notes with this synthesizer.
Source:

playNotes()

Plays notes by determining which notes need to be played and starting note scheduling via setInterval().
Source:

scheduleCurrentNotes()

Schedules notes to be played in the current scheduling interval when called by setInterval().
Source:

setTimeRange(start, stop)

Sets the specified time range for playing notes.
Parameters:
Name Type Description
start number The start time.
stop number The end time.
Source:

skip(time)

Skip to playing at the specified time. If this player is not paused, playing will stop and then immediately continue at the specified time.
Parameters:
Name Type Description
time number The time to skip to.
Source:

stop()

Stop playing.
Source:

stopNotes()

Stops notes by clearing both the note scheduling interval and the ending interval.
Source: