Activity Class
A model plays back the source at various speeds based on the movement of the activity parameter.
Constructor
Activity
-
[context]
-
[source]
-
[onLoadProgress]
-
[onLoadComplete]
-
[onAudioStart]
-
[onAudioEnd]
Parameters:
-
[context]
AudioContext optionalAudioContext to be used.
-
[source]
Array/String/AudioBuffer/File optionalSingle or Array of either URLs or AudioBuffers or File Object of the audio source.
-
[onLoadProgress]
Function optionalCallback when the audio file is being downloaded.
-
[onLoadComplete]
Function optionalCallback when the source has finished loading.
-
[onAudioStart]
Function optionalCallback when the audio is about to start playing.
-
[onAudioEnd]
Function optionalCallback when the audio has finished playing.
Item Index
Methods
connect
-
destination
-
[output]
-
[input]
If the parameter output
is an AudioNode, it connects to the releaseGainNode.
If the output is a BaseSound, it will connect BaseSound's releaseGainNode to the output's inputNode.
disconnect
-
[outputIndex]
Disconnects the Sound from the AudioNode Chain.
Parameters:
-
[outputIndex]
Number optionalIndex describing which output of the AudioNode to disconnect.
listParams
-
[paramArray]
List all SPAudioParams this Sound exposes
Parameters:
-
[paramArray]
Array optionalArray of all the SPAudioParams this Sound exposes.
pause
()
Pause the currently playing source at the current position.
play
-
[when]
Enable playback.
Parameters:
-
[when]
Number optionalAt what time (in seconds) the source be triggered
release
-
[when]
-
[fadeTime]
Linearly ramp down the gain of the audio in time (seconds) to 0.
setOutputEffect
-
effect
Adds an sound effect to the output of this model, and connects the output of the effect to the Audio Destination
Parameters:
-
effect
ObjectAn Sound Effect of type BaseEffect to be appended to the output of this Sound.
setSources
-
source
-
[onLoadProgress]
-
[onLoadComplete]
Reinitializes a Activity and sets it's sources.
start
-
when
-
[offset]
-
[duration]
-
[attackDuration]
Start playing after specific time and from a specific offset.
stop
-
when
Stops the source and resets play head to 0.
Parameters:
-
when
NumberTime offset to stop
Properties
action
SPAudioParam
Controls the playback of the source. The more this parameter is moved, the higher the speed of playback.
Default: 0
audioContext
AudioContext
Web Audio API's AudioContext. If the context passed to the constructor is an AudioContext, a new one is created here.
easeIn
SPAudioParam
Rate of increase of Play Speed. It is the time-constant value of first-order filter (exponential) which approaches the target speed set by the playSpeed property.
Default: 1
easeOut
SPAudioParam
Rate of decrease of Play Speed. It is the time-constant value of first-order filter (exponential) which approaches the target speed set by the playSpeed property.
Default: 1
inputNode
Object
The input node that the output node will be connected to.
Set this value to null if no connection can be made on the input node
Default: null
maxSpeed
SPAudioParam
Maximum value at which the playback speed of the source will be capped to.
Default: 1
onLoadComplete
Function
Callback for when loading of audio files is done and the the model is initalized.
Default: null
onLoadProgress
Function
Callback for handling progress events thrown during loading of audio files.
Default: null
releaseGainNode
GainNode
final
Release Gain Node
Default: Internal GainNode
sensitivity
SPAudioParam
Maximum value for random pitch shift of the triggered voices in semitones.
Default: 0.5