Skip to main content
Version: Latest

WaveShaperNode

The WaveShaperNode interface represents non-linear signal distortion effects. Non-linear distortion is commonly used for both subtle non-linear warming, or more obvious distortion effects.

Constructor​

constructor(context: BaseAudioContext, waveShaperOptions?: WaveShaperOptions)

WaveShaperOptions​

Inherits all properties from AudioNodeOptions

ParameterTypeDefaultDescription
curve
Optional
Float32Array-Array representing curve values
oversample
Optional
OverSampleType-Value representing oversample property

Or by using BaseAudioContext factory method: BaseAudioContext.createStereoPanner()

Properties​

It inherits all properties from AudioNode.

AudioNodeproperties
NameTypeDescription
curveFloat32Array | nullThe shaping curve used for waveshaping effect.
oversampleOverSampleTypeSpecifies what type of oversampling should be used when applying shaping curve.

Methods​

WaveShaperNode does not define any additional methods. It inherits all methods from AudioNode.

Remarks​

curve​

  • Default value is null
  • Contains at least two values.
  • Subsequent modifications of curve have no effects. To change the curve, assign a new Float32Array object to this property.

oversample​

  • Default value none
  • Value of 2x or 4x can increases quality of the effect, but in some cases it is better not to use oversampling for very accurate shaping curve.

OverSampleType​

Type definitions

// Do not oversample | Oversample two times | Oversample four times
type OverSampleType = 'none' | '2x' | '4x';