Path: blob/main/files/en-us/web/api/audioprocessingevent/index.md
6546 views
------{{APIRef("Web Audio API")}}{{deprecated_header}}
The Web Audio API AudioProcessingEvent represents events that occur when a {{domxref("ScriptProcessorNode")}} input buffer is ready to be processed.
Note: As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet.
{{InheritanceDiagram}}
Constructor
AudioProcessingEvent(){{Deprecated_Inline}}: Creates a new
AudioProcessingEventobject.
Instance properties
Also implements the properties inherited from its parent, {{domxref("Event")}}.
playbackTime{{ReadOnlyInline}} {{Deprecated_Inline}}: A double representing the time when the audio will be played, as defined by the time of {{domxref("BaseAudioContext/currentTime", "AudioContext.currentTime")}}.
inputBuffer{{ReadOnlyInline}} {{Deprecated_Inline}}: An {{domxref("AudioBuffer")}} that is the buffer containing the input audio data to be processed. The number of channels is defined as a parameter
numberOfInputChannels, of the factory method {{domxref("BaseAudioContext/createScriptProcessor", "AudioContext.createScriptProcessor()")}}. Note that the returnedAudioBufferis only valid in the scope of the event handler.
outputBuffer{{ReadOnlyInline}} {{Deprecated_Inline}}: An {{domxref("AudioBuffer")}} that is the buffer where the output audio data should be written. The number of channels is defined as a parameter,
numberOfOutputChannels, of the factory method {{domxref("BaseAudioContext/createScriptProcessor", "AudioContext.createScriptProcessor()")}}. Note that the returnedAudioBufferis only valid in the scope of the event handler.
Example
See BaseAudioContext.createScriptProcessor() for example code that uses an AudioProcessingEvent.
Browser compatibility
{{Compat}}