Skip to main content
Version: Next

PeriodicWave

The PeriodicWave interface defines a periodic waveform that can be used to shape the output of an OscillatorNode.

Constructor

constructor(context: BaseAudioContext, options?: PeriodicWaveOptions)

PeriodicWaveOptions

ParameterTypeDefaultDescription
real
Optional
Float32Array-Cosine terms.
imag
Optional
Float32Array-Sine terms.
disableNormalization
Optional
booleanfalseWhen true, disables normalization of the periodic wave.

You can also create a PeriodicWave via the BaseAudioContext.createPeriodicWave(real, imag, constraints?: PeriodicWaveConstraints) factory method.

Properties

PeriodicWave neither owns nor inherits any properties.

Methods

PeriodicWave neither owns nor inherits any methods.

Remarks

real and imag

  • If only one is specified, the other one is treated as an array of 0.0 values of the same length.
  • If neither is given, values are equivalent to the default 'sine' waveform.
  • If both are given, they must have the same length.
  • See the Web Audio spec for how values correspond to the output wave.