AudioOscillatorType

View source

Numeric waveform choices for an AudioOscillator.

Set an oscillator’s type to one of these members to select the matching native OscillatorNode waveform: AudioOscillatorType.SawTooth selects sawtooth, AudioOscillatorType.Sine selects sine, AudioOscillatorType.Triangle selects triangle, and AudioOscillatorType.Square selects square. AudioOscillatorType.Sine is the default selected by the AudioOscillator constructor.

The values are plain numbers. The constructor accepts and stores any number, and AudioOscillator.validateSerial accepts any numeric waveform value. If a number outside these members is used, playback throws before an oscillator is created. Use one of these members for a waveform value the playback path recognizes.

Examples

import { AudioOscillator, AudioOscillatorType } from '@wimaengine/audio'

const component = new AudioOscillator({ type: AudioOscillatorType.Square })
console.log(component.type) // 3; the oscillator produces a square waveform.

Variants


SawTooth

View source

Selects the native sawtooth waveform (0) for oscillator playback.

Sine

View source

Selects the native sine waveform (1); the component default.

Triangle

View source

Selects the native triangle waveform (2) for oscillator playback.

Square

View source

Selects the native square waveform (3) for oscillator playback.