Options for playing an instrument.
Requires
- module:modules/sonification
Members
-
duration :number
-
The duration of the note in milliseconds.
Type:
- number
-
frequency :number|function
-
The frequency of the note to play. Can be a fixed number, or a function. The function receives one argument: the relative time of the note playing (0 being the start, and 1 being the end of the note). It should return the frequency number for each point in time. The poll interval of this function is specified by the Instrument.playCallbackInterval option.
Type:
- number | function
-
masterVolume :number|undefined
-
The master volume multiplier to apply to the instrument, regardless of other volume changes. Defaults to 1.
Type:
- number | undefined
-
maxFrequency :number|undefined
-
The maximum frequency to allow. If the instrument has a set of allowed frequencies, the closest frequency is used by default. Use this option to stop too high frequencies from being used.
Type:
- number | undefined
-
minFrequency :number|undefined
-
The minimum frequency to allow. If the instrument has a set of allowed frequencies, the closest frequency is used by default. Use this option to stop too low frequencies from being used.
Type:
- number | undefined
-
onEnd :function|undefined
-
Callback function to be called when the play is completed.
Type:
- function | undefined
-
pan :number|function|undefined
-
The panning of the instrument. Can be a fixed number between -1 and 1, or a function. The function receives one argument: the relative time of the note playing (0 being the start, and 1 being the end of the note). It should return the panning value for each point in time. The poll interval of this function is specified by the Instrument.playCallbackInterval option. Defaults to 0.
Type:
- number | function | undefined
-
volume :number|function|undefined
-
The volume of the instrument. Can be a fixed number between 0 and 1, or a function. The function receives one argument: the relative time of the note playing (0 being the start, and 1 being the end of the note). It should return the volume for each point in time. The poll interval of this function is specified by the Instrument.playCallbackInterval option. Defaults to 1.
Type:
- number | function | undefined