-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (68 loc) · 3.9 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2-D standing waves demo</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/addons/p5.sound.min.js"></script>
<script src="sketch.js"></script>
</head>
<body>
<header>
<h1>2-D Standing Waves Demo</h1>
<p>This demo contains a top-down view of a room, with dimensions of <span id="xSize">X</span>m by <span id="ySize">Y</span>.
<br>There are two oscillators (representing a left-right and a front-back standing wave), which can be set to one of the 1st, 2nd or 3rd harmonic.
<br>Visualisation of the amplitude (where dark represents zero) can also be enabled.</p>
</header>
<div>
<p>Use the WASD keys to move around.<br>Use the mouse to move somewhere else within the room.<br>Use the switches to turn the left-right and front-back standing waves on and off.</p>
<em>This room has a lowest standing wave of <span id="lowestMode">X</span>Hz. This may not be audible - if this is the case, try the multiply switch to make the room smaller.</em>
<span>
<p><strong><i class="fa-solid fa-arrow-right-arrow-left"></i> Oscillator: <span id="xDirection">Freq x</strong>
<label class="switch">
<input id="toggleAudioX" type="checkbox" onclick="playPauseAudioX()">
<span class="slider round"></span>
</label>
<label><input type="radio" name="harmonicSelectRadioX" id="harmonicX_1" value="1" onclick="selectHarmonicX()" checked>1st harmonic</label>
<label><input type="radio" name="harmonicSelectRadioX" value="2" onclick="selectHarmonicX()">2nd harmonic</label>
<label><input type="radio" name="harmonicSelectRadioX" value="3" onclick="selectHarmonicX()">3rd harmonic</label>
</p>
<p><strong><i class="fa-solid fa-arrow-up"></i><i class="fa-solid fa-arrow-down"></i> Oscillator: <span id="yDirection">Freq y</span></strong>
<label class="switch">
<input id="toggleAudioY" type="checkbox" onclick="playPauseAudioY()">
<span class="slider round"></span>
</label>
<label><input type="radio" name="harmonicSelectRadioY" id="harmonicY_1" value="1" onclick="selectHarmonicY()" checked>1st harmonic</label>
<label><input type="radio" name="harmonicSelectRadioY" value="2" onclick="selectHarmonicY()">2nd harmonic</label>
<label><input type="radio" name="harmonicSelectRadioY" value="3" onclick="selectHarmonicY()">3rd harmonic</label>
</p>
</span>
<span>
<button type="button" onclick="resetAll()">Reset</button><br>
Visualisation:
<label class="switch">
<input id="toggleVisualisation" type="checkbox" onchange="toggleVisualisation()">
<span class="slider round"></span>
</label>
</span>
<span>
Multiply harmonics by 3 (make room dimensions 3x smaller):
<label class="switch">
<input id="toggleHarmonicMultiplier" type="checkbox" onclick="multiplyHarmonics()">
<span class="slider round"></span>
</label><br>
</span>
</div>
<div id="demo">
<noscript><p>Please use a modern browser with JavaScript enabled to see the demo.</p></noscript>
</div>
<div id="nodemodisplay">
<p>This content requires a wider browser window.</p>
</div>
<div><br></div>
</body>
<footer>© 2022 Kat Young</footer>
</html>