forked from mdn/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (41 loc) · 1.43 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: AudioNode.context
slug: Web/API/AudioNode/context
tags:
- API
- AudioNode
- Context
- Property
- Reference
- Web Audio API
browser-compat: api.AudioNode.context
---
<div>{{APIRef("Web Audio API")}}</div>
<p>The read-only <code>context</code> property of the
{{domxref("AudioNode")}} interface returns the associated
{{domxref("BaseAudioContext")}}, that is the object representing the processing graph
the node is participating in.</p>
<h2 id="Syntax">Syntax</h2>
<pre
class="brush: js">var <em>aContext</em> = <em>anAudioNode</em>.context;</pre>
<h3 id="Value">Value</h3>
<p>The {{domxref("AudioContext")}} or {{domxref("OfflineAudioContext")}} object that was
used to construct this <code>AudioNode</code>.</p>
<h2 id="Example">Example</h2>
<pre class="brush: js;">const AudioContext = window.AudioContext || window.webkitAudioContext;
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
</pre>
<h2 id="Specifications">Specifications</h2>
{{Specifications}}
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio
API</a></li>
</ul>