OfflineAudioContext() constructor creates a new
OfflineAudioContext object instance.
var myOfflineAudio = new OfflineAudioContext(numOfChannels,length,sampleRate);
- An integer representing the number of channels this buffer should have. Implementations must support a minimum 32 channels.
- An integer representing the size of the buffer in sample-frames.
- The sample-rate of the linear audio data in sample-frames per second. An implementation must support sample-rates in at least the range 22050 to 96000, with 44100 being the most commonly used.
It is important to note that, whereas you can create a new
AudioContext using the
new AudioContext() constructor with no arguments, the
OfflineAudioContext() constructor requires three arguments. This works in exactly the same way as when you create a new
AudioBuffer with the
AudioContext.createBuffer method. For more detail, read Audio buffers: frames, samples and channels from our Basic concepts guide.
Note: Like a regular
OfflineAudioContext can be the target of events, therefore it implements the
// define online and offline audio context var audioCtx = new AudioContext(); var offlineCtx = new OfflineAudioContext(2,44100*40,44100); source = offlineCtx.createBufferSource(); // etc...
|Web Audio API
The definition of 'OfflineAudioContext' in that specification.
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Feature||Android||Android Webview||Firefox Mobile (Gecko)||IE Phone||Opera Mobile||Safari Mobile||Chrome for Android|
|Basic support||No support||(Yes)
||(Yes)||No support||(Yes)||No support||(Yes)|