-
Notifications
You must be signed in to change notification settings - Fork 1
/
minimalPanning.html
53 lines (51 loc) · 1.21 KB
/
minimalPanning.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
<!doctype html>
<html>
<head>
<title>minimal panning</title>
</head>
<body>
<p>minimal panning.</p>
<p>
Reload to restart.
<button onclick="oscillator.stop(0)">Stop</button>
</p>
<span>
<input id="pan" type="range" min="-3" max="3" step="0.1" value="0" oninput="panX(this.value);">
X
</span>
<br />
<span>
<input id="pan" type="range" min="-3" max="3" step="0.1" value="0" oninput="panY(this.value);">
Y
</span>
<br />
<span>
<input id="pan" type="range" min="-3" max="3" step="0.1" value="0" oninput="panZ(this.value);">
Z
</span>
<p>tested with Chrome only (Version 44.0.2403.155 m, Aug 2015)</p>
</body>
<script>
var audioContext = new window.AudioContext
var oscillator = audioContext.createOscillator()
var panner = audioContext.createPanner()
oscillator.connect(panner)
panner.connect(audioContext.destination)
oscillator.start(0)
var X = 0
var Y = 0
var Z = 0
function panX(x) {
X = x
panner.setPosition(X,Y,Z)
}
function panY(y) {
Y = y
panner.setPosition(X,Y,Z)
}
function panZ(z) {
Z = z
panner.setPosition(X,Y,Z)
}
</script>
</html>