This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

stop

Summary

Schedules a sound to stop playback at an exact time.

Method of apis/webaudio/OscillatorNodeapis/webaudio/OscillatorNode

Syntax

var  = OscillatorNode.stop(when);

Parameters

when

Data-type
Number

Describes at what time (in seconds) the sound should stop playing. It is in the same time coordinate system as AudioContext.currentTime. If 0 is passed in for this value or if the value is less than currentTime, then the sound will stop playing immediately. stop must only be called one time and only after a call to start or stop, or an exception will be thrown.

Return Value

Returns an object of type

Examples

var oscillator = audioCtx.createOscillator();
oscillator.type = 'square';
oscillator.frequency.value = 3000; // value in hertz
oscillator.start();
oscillator.stop(2); // stop after 2 seconds

Related specifications

W3C Web Audio API
W3C Editor’s Draft