The AudioNode interface has a context property which returns the related BaseAudioContext, which is the object that represents the process graph the node that has participated.
Syntax:
var ctx = anAudioNode.context;
Return Value: It returns a AudioContext or OfflineAudioContext object.
Example 1:
<!DOCTYPE html> <html> <head> <title> AudioNode context property </title> </head> <body> <h1 style="color:green"> GeeksforGeeks </h1> <h2>AudioNode context property</h2> <script> const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCnt = new AudioContext(); // Oscillator const osciltr = audioCnt.createOscillator(); // Gain node const GainNode = audioCnt.createGain(); osciltr.connect(GainNode).connect(audioCnt.destination); console.log(osciltr.context); </script> </body> </html> |
chevron_right
filter_none
Output:

Example 2:
<!DOCTYPE html> <html> <head> <title> AudioNode context property </title> </head> <body> <h1 style="color:green"> GeeksforGeeks </h1> <h2>AudioNode context property</h2> <script> const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCnt = new AudioContext(); // Oscillator const osciltr = audioCnt.createOscillator(); // Gain_node const gNode = audioCnt.createGain(); osciltr.connect(gNode).connect(audioCnt.destination); console.log(osciltr.context === audioCnt); </script> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browsers supported by AudioNode context property are listed below:
- Google Chrome 35.0
- Firefox 25.0
- Apple Safari 6 -x-
- Opera 22.0
Recommended Posts:
- Web Audio API | AudioNode numberOfOutputs property
- Web Audio API | AudioNode numberOfInputs Property
- Audio Context.close() in Web APIs
- jQuery | context Property
- HTML | DOM Audio src Property
- HTML | DOM Audio ended Property
- Web Audio API | AudioContext outputLatency property
- HTML | DOM Audio duration Property
- HTML | DOM Audio defaultPlaybackRate Property
- HTML | DOM Audio currentTime Property
- HTML | DOM Audio currentSrc Property
- HTML | DOM Audio controls Property
- HTML | DOM Audio loop Property
- HTML | DOM Audio defaultMuted Property
- HTML | DOM Audio playbackRate Property
- HTML | DOM Audio paused Property
- HTML | DOM Audio startDate Property
- HTML | DOM Audio preload Property
- HTML | DOM Audio readyState Property
- HTML | DOM Audio networkState Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


