PeriodicWave
The PeriodicWave interface defines a periodic waveform that can be used to shape the output of an OscillatorNode.
Press play, then pick a preset or shape the wave yourself: each slider sets the sine term of one harmonic, a multiple of the oscillator frequency. The upper plot shows the shape of the wave as the harmonics add up, before you play it; the lower one shows the live output.
Loading...
Constructor
constructor(context: BaseAudioContext, options?: PeriodicWaveOptions)
PeriodicWaveOptions
| Parameter | Type | Default | Description |
|---|---|---|---|
real Optional | Float32Array | - | Cosine terms. |
imag Optional | Float32Array | - | Sine terms. |
disableNormalization Optional | boolean | false | When 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.0values 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.