EZ Web Audio / GainEffect
Class: GainEffect
Defined in: effects/gain-effect.ts:21
GainEffect - A thin wrapper around GainNode that implements the Effect interface.
For a single-node effect like GainEffect:
inputandoutputboth point to the same GainNodebypasssets gain to 1.0 (passthrough), stores/restores the previous valuemixcontrols how much of the effect is applied (0=passthrough, 1=full effect)valueis the gain amount applied when not bypassed
Example
const gain = createGainEffect(audioContext, 0.5)
gain.value = 0.8 // Set gain to 80%
gain.bypass = true // Passthrough (gain becomes 1.0)
gain.bypass = false // Restore to 0.8Implements
Constructors
Constructor
new GainEffect(
audioContext,initialValue):GainEffect
Defined in: effects/gain-effect.ts:27
Parameters
audioContext
AudioContext
initialValue
number = 1.0
Returns
GainEffect
Accessors
bypass
Get Signature
get bypass():
boolean
Defined in: effects/gain-effect.ts:59
When true, gain becomes 1.0 (passthrough). When false, restores the previous gain value.
Returns
boolean
Set Signature
set bypass(
v):void
Defined in: effects/gain-effect.ts:63
When true, effect is bypassed (passthrough)
Parameters
v
boolean
Returns
void
When true, effect is bypassed (passthrough)
Implementation of
input
Get Signature
get input():
AudioNode
Defined in: effects/gain-effect.ts:34
The input AudioNode (same as output for single-node effect)
Returns
AudioNode
The input AudioNode that receives signal from the chain
Implementation of
mix
Get Signature
get mix():
number
Defined in: effects/gain-effect.ts:79
Wet/dry mix: 0 = passthrough (gain of 1.0), 1 = full effect. Mix interpolates between 1.0 and the set value.
Returns
number
Set Signature
set mix(
v):void
Defined in: effects/gain-effect.ts:83
Wet/dry mix: 0 = fully dry (no effect), 1 = fully wet (full effect)
Parameters
v
number
Returns
void
Wet/dry mix: 0 = fully dry (no effect), 1 = fully wet (full effect)
Implementation of
output
Get Signature
get output():
AudioNode
Defined in: effects/gain-effect.ts:39
The output AudioNode (same as input for single-node effect)
Returns
AudioNode
The output AudioNode that sends signal to the next in chain
Implementation of
value
Get Signature
get value():
number
Defined in: effects/gain-effect.ts:44
The gain value (0.0 to any positive number)
Returns
number
Set Signature
set value(
v):void
Defined in: effects/gain-effect.ts:48
Parameters
v
number
Returns
void