OfflineAudioContext
The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes. In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer.
EventTarget BaseAudioContext OfflineAudioContext
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 35 | 12 | 25 | 14.1 | 35 | 14.5 | |
| The Web Audio API OfflineAudioCompletionEvent interface represents events that occur when the processing of an OfflineAudioContext is terminated. The OfflineAudioContext/complete_event event uses this interface. | 14 | 12 | 25 | 6 | 18 | 6 |
| The OfflineAudioCompletionEvent() constructor of the Web Audio API creates a new OfflineAudioCompletionEvent object. | 57 | 79 | 53 | 14 | 57 | 14 |
| The renderedBuffer read-only property of the OfflineAudioCompletionEvent interface is an AudioBuffer containing the result of processing an OfflineAudioContext. | 14 | 12 | 25 | 6 | 18 | 6 |
| The complete event of the OfflineAudioContext interface is fired when the rendering of an offline audio context is complete. | 25 | 12 | 25 | 7 | 25 | 7 |
| The length property of the OfflineAudioContext interface returns an integer representing the size of the buffer in sample-frames. | 51 | 14 | 49 | 14.1 | 51 | 14.5 |
| The OfflineAudioContext() constructor—part of the Web Audio API—creates and returns a new OfflineAudioContext object instance, which can then be used to render audio to an AudioBuffer rather than to an audio output device. | 35 | 12 | 25 | 14.1 | 35 | 14.5 |
OfflineAudioContext (options parameter) `options` parameter (accepts all parameters as a single dictionary) | 62 | 79 | 57 | 14.1 | 62 | 14.5 |
| The resume() method of the OfflineAudioContext interface resumes the progression of time in an audio context that has been suspended. The promise resolves immediately because the OfflineAudioContext does not require the audio hardware. | 41 | 14 | 40 | 9 | 41 | 9 |
| The startRendering() method of the Interface starts rendering the audio graph, taking into account the current connections and the current scheduled changes. | 25 | 12 | 25 | 7 | 25 | 7 |
startRendering (returns promise) Returns a `Promise` | 42 | ≤18 | 37 | 14.1 | 42 | 14.5 |
| The suspend() method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise. This is generally useful at the time of manipulating the audio graph synchronously on OfflineAudioContext. | 41 | 14 | | 9 | 41 | 9 |
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (14.1)
- Available with a vendor prefix: webkit (7)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (14.5)
- Available with a vendor prefix: webkit (7)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (14.1)
- Available with a vendor prefix: webkit (7)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (14.5)
- Available with a vendor prefix: webkit (7)
- This browser only partially implements this feature
- The method exists but always rejects with `NotSupportedError`. See bug 1265406.
Use cases
-
Using OfflineAudioContext
The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.