This article needs a technical review. How you can help.

The OscillatorNode interface represents a periodic waveform, like a sine wave. It is an AudioNode audio-processing module that causes a given frequency of sine wave to be created — in effect, a constant tone.

An OscillatorNode is created using the AudioContext.createOscillator method. It always has exactly one output and no inputs, both with the same amount of channels. Its basic property defaults (see AudioNode for definitions) are:

Number of inputs 0
Number of outputs 1
Channel count mode max
Channel count 2 (not used in the default count mode)
Channel interpretation speakers


Creates a new instance of an OscillatorNode object.


Inherits properties from its parent, AudioNode.

An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is read-only, the value it represents is not.)
An a-rate AudioParam representing detuning of oscillation in cents (though the AudioParam returned is read-only, the value it represents is not.)
Represents the shape of the oscillator wave generated. Different waves will produce different tones.


Inherits methods from its parent, AudioNode.

This method specifies the exact time to start playing the tone.
This method specifies the exact time to stop playing the tone.
Used to point to a PeriodicWave defining a periodic waveform that can be used to shape the oscillator's output, when type = "custom" is used. This replaces the now-obsolete OscillatorNode.setWaveTable.

Event handlers

Used to set the event handler for the ended event, which fires when the tone has stopped playing.


The following example shows basic usage of an AudioContext to create an oscillator node. For an applied example, check out our Violent Theremin demo (see app.js for relevant code).

// create web audio api context
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();

// create Oscillator node
var oscillator = audioCtx.createOscillator();

oscillator.type = 'square';
oscillator.frequency.value = 440; // value in hertz


Specification Status Comment
Web Audio API
The definition of 'OscillatorNode' in that specification.
Working Draft  

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 14 webkit (Yes) 23 No support 15 webkit
22 (unprefixed)
6 webkit
constructor 55.0 ? ? ? 42 ?
Feature Android Android Webview Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support No support (Yes) (Yes) 25 1.2 No support No support webkit 28 webkit
constructor No support 55.0 ? ? ? ? 42 ? 55.0

See also

Document Tags and Contributors

 Last updated by: abbycar,