Back to Content

AudioNode: context property

files/en-us/web/api/audionode/context/index.md

latest863 B
Original Source

{{APIRef("Web Audio API")}}

The read-only context property of the {{domxref("AudioNode")}} interface returns the associated {{domxref("BaseAudioContext")}}, that is the object representing the processing graph the node is participating in.

Value

The {{domxref("AudioContext")}} or {{domxref("OfflineAudioContext")}} object that was used to construct this AudioNode.

Examples

js
const audioCtx = new AudioContext();

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.context); // AudioContext
console.log(oscillator.context === audioCtx); // true

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also