--- title: AudioNode slug: Web/API/AudioNode translation_of: Web/API/AudioNode ---
{{ APIRef("Web Audio API") }}
A interface AudioNode é uma interface genérica para representar um módulo de processamento como uma fonte de áudio (ex. um elemento HTML {{HTMLElement("audio")}} ou {{HTMLElement("video")}} , um {{domxref("OscillatorNode")}}, etc.), um destino do áudio, um módulo intermediário de processamento (ex. um filtro como {{domxref("BiquadFilterNode")}} ou {{domxref("ConvolverNode")}}), ou um controle de volume (como o {{domxref("GainNode")}}).
Um AudioNode
tem entradas (inputs) e saídas (outputs), cada uma delas com uma determinada quantidade de canais. Um AudioNode
sem nenhuma entrada e uma ou múltiplas saídas é chamado de source node. The exact processing done varies from one AudioNode
to another but, in general, a node reads its inputs, does some audio-related processing, and generates new values for its outputs, or simply lets the audio pass through (for example in the {{domxref("AnalyserNode")}}, where the result of the processing is accessed separately).
Different nodes can be linked together to build a processing graph. Such a graph is contained in an {{domxref("AudioContext")}}. Each AudioNode
participates in exactly one such context. In general, processing nodes inherit the properties and methods of AudioNode
, but also define their own functionality on top. See the individual node pages for more details, as listed on the Web Audio API homepage.
Note: An AudioNode
can be target of events, therefore it implements the {{domxref("EventTarget")}} interface.
numberOfInputs
property with a value of 0
.0
for this attribute."speakers"
or "discrete"
.Also implements methods from the interface {{domxref("EventTarget")}}.
This simple snippet of code shows the creation of some audio nodes, and how the AudioNode
properties and methods can be used. You can find examples of such usage on any of the examples linked to on the Web Audio API landing page (for example Violent Theremin.)
var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var oscillator = audioCtx.createOscillator(); var gainNode = audioCtx.createGain(); oscillator.connect(gainNode); gainNode.connect(audioCtx.destination); oscillator.context; oscillator.numberOfInputs; oscillator.numberOfOutputs; oscillator.channelCount;
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Audio API', '#the-audionode-interface', 'AudioNode')}} | {{Spec2('Web Audio API')}} |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(10.0)}}{{property_prefix("webkit")}} | {{CompatGeckoDesktop(25.0)}} | {{CompatNo}} | 15.0{{property_prefix("webkit")}} 22 (unprefixed) |
{{CompatVersionUnknown}} |
channelCount channelCountMode |
{{CompatVersionUnknown}} {{property_prefix("webkit")}} | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatNo}} |
connect (AudioParam) |
{{CompatVersionUnknown}} {{property_prefix("webkit")}} | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | 25.0 | 1.2 | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
channelCount channelCountMode |
{{CompatNo}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
connect (AudioParam) |
{{CompatNo}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |