OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
Documentation OscillatorNode by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Instance Members
type: OscillatorTypeA string which specifies the shape of waveform to play; this can be one of a number of standard values, or custom to use a PeriodicWave to describe a custom waveform. Different waves will produce different tones. Standard values are "sine", "square", "sawtooth", "triangle" and "custom". The default is "sine".
frequency: AudioParamAn a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam` returned is read-only, the value it represents is not). The default value is 440 Hz (a standard middle-A note).
detune: AudioParamAn a-rate AudioParam representing detuning of oscillation in cents (though the AudioParam` returned is read-only, the value it represents is not). The default value is 0.
setPeriodicWave(periodicWave: PeriodicWave): VoidSets a PeriodicWave which describes a periodic waveform to be used instead of one of the standard waveforms; calling this sets the type to custom. This replaces the now-obsolete OscillatorNode.setWaveTable() method.
| Name | Type |
|---|---|
periodicWave |
PeriodicWave |
new(context: BaseAudioContext, ?options: Null<OscillatorOptions>): Void| Name | Type | Default |
|---|---|---|
context |
BaseAudioContext | |
options |
Null<OscillatorOptions> | (optional) |