SPAudioParam Class
Mock AudioParam used to create Parameters for Sonoport Sound Models. The SPAudioParam supports either a AudioParam backed parameter, or a completely Javascript mocked up Parameter, which supports a rough version of parameter automation.
Constructor
SPAudioParam
-
baseSound
-
[name]
-
[minValue]
-
[maxValue]
-
[defaultValue]
-
[aParams]
-
[mappingFunction]
-
[setter]
Parameters:
-
baseSound
BaseSoundA reference to the BaseSound which exposes this parameter.
-
[name]
String optionalThe name of the parameter.
-
[minValue]
Number optionalThe minimum value of the parameter.
-
[maxValue]
Number optionalThe maximum value of the parameter.
-
[defaultValue]
Number optionalThe default and starting value of the parameter.
-
[aParams]
AudioParam/Array optionalA WebAudio parameter which will be set/get when this parameter is changed.
-
[mappingFunction]
Function optionalA mapping function to map values between the mapped SPAudioParam and the underlying WebAudio AudioParam.
-
[setter]
Function optionalA setter function which can be used to set the underlying audioParam. If this function is undefined, then the parameter is set directly.
Item Index
Methods
Properties
Methods
cancelScheduledValues
-
startTime
Schedules a linear continuous change in parameter value from the previous scheduled parameter value to the given value.
Parameters:
-
startTime
NumberThe startTime parameter is the starting time at and after which any previously scheduled parameter changes will be cancelled.
createPsuedoParam
-
baseSound
-
name
-
minValue
-
maxValue
-
defaultValue
Static helper method to create Psuedo parameters which are not connected to any WebAudio AudioParams.
Parameters:
Returns:
SPAudioParam
exponentialRampToValueAtTime
-
value
-
endTime
Schedules an exponential continuous change in parameter value from the previous scheduled parameter value to the given value.
v(t) = V0 * (V1 / V0) ^ ((t - T0) / (T1 - T0))
linearRampToValueAtTime
-
value
-
endTime
Schedules a linear continuous change in parameter value from the previous scheduled parameter value to the given value.
Parameters:
-
value
Float32ArrayThe value parameter is the value the parameter will exponentially ramp to at the given time.
-
endTime
NumberThe endTime parameter is the time in the same time coordinate system as AudioContext.currentTime.
setTargetAtTime
-
target
-
startTime
-
timeConstant
Start exponentially approaching the target value at the given time with a rate having the given time constant.
During the time interval: T0 <= t < T1, where T0 is the startTime parameter and T1 represents the time of the event following this event (or infinity if there are no following events): v(t) = V1 + (V0 - V1) * exp(-(t - T0) / timeConstant)
Parameters:
-
target
NumberThe target parameter is the value the parameter will start changing to at the given time.
-
startTime
NumberThe startTime parameter is the time in the same time coordinate system as AudioContext.currentTime.
-
timeConstant
NumberThe timeConstant parameter is the time-constant value of first-order filter (exponential) approach to the target value. The larger this value is, the slower the transition will be.
setValueAtTime
-
value
-
startTime
Schedules a parameter value change at the given time.
setValueCurveAtTime
-
values
-
startTime
-
duration
Sets an array of arbitrary parameter values starting at the given time for the given duration. The number of values will be scaled to fit into the desired duration.
During the time interval: startTime <= t < startTime + duration, values will be calculated:
v(t) = values[N * (t - startTime) / duration], where N is the length of the values array.
Parameters:
-
values
Float32ArrayThe values parameter is a Float32Array representing a parameter value curve. These values will apply starting at the given time and lasting for the given duration.
-
startTime
NumberThe startTime parameter is the time in the same time coordinate system as AudioContext.currentTime.
-
duration
NumberThe duration parameter is the amount of time in seconds (after the startTime parameter) where values will be calculated according to the values parameter.
Properties
defaultValue
Number/Boolean
Initial value for the value attribute.
Default: 0
maxValue
Number/Boolean
Maximum value which the value attribute can be set to.
Default: 0
minValue
Number/Boolean
Minimum value which the value attribute can be set to.
Default: 0
value
Number/Boolean
The parameter's value. This attribute is initialized to the defaultValue. If value is set during a time when there are any automation events scheduled then it will be ignored and no exception will be thrown.
Default: 0