-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
170 lines (164 loc) · 5.61 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dance 4 me !</title>
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.9.17/Tone.js"></script>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="controls">
<li id="top-left"><a id="openInfo">?</a></li>
<div id="infoPopup" class="popup">
<div class="popup-content">
<pre>hi!
welcome to dance4me — an interactive audio manipulator that uses <a href="https://developers.google.com/mediapipe/solutions/vision/pose_landmarker" target="_blank">mediapipe pose landmark detection</a> and <a href="https://tonejs.github.io/" target="_blank">tone.js</a> audio effects to create a sound experience <span style="color: lightcoral;">that reacts to you as you react to it</span>
1. click "enable webcam" to turn on the camera to begin using pose landmark detection
2. use "sound settings" to change the number of people that show up in view and add/remove sound manipulation effects to the sample
3. select a .wav file using "upload sample" in order to use it for audio manipulation
4. position yourself within view of the webcam
5. dance 4 me ! ! !</pre>
<!-- <pre>4. use "switch view" to toggle between stick figure mode and webcam mode </pre> -->
<br />
<a id="closeInfo">– close —</a>
<br />
</div>
</div>
<script>
openInfo.addEventListener("click", function () {
infoPopup.classList.add("show");
});
closeInfo.addEventListener("click", function () {
infoPopup.classList.remove("show");
});
window.addEventListener("click", function (event) {
if (event.target == infoPopup) {
infoPopup.classList.remove("show");
}
});
</script>
<li id="top-right"><a id="webcamButton">enable webcam</a></li>
<li id="top-right2"><a id="openSettings">sound settings</a></li>
<div id="settingsPopup" class="popup">
<div class="popup-content">
<!-- <pre> : * ・゚゚✼ :‧₊˚ ‧₊˚ ‧₊˚ ₊ *・゚゚</pre> -->
<p>sound manipulation effects</p>
<br />
<br />
<small>
check/uncheck any combination of the sound effects below to use on
the song sample
</small>
<br />
<br />
<div id="checkboxes"></div>
<br />
<br />
<p>
number of people =
<label style="color: #0d1321"><output id="value"></output></label>
</p>
<br />
<br />
<small>
move the slider to adjust the # of people detected by the webcam —
<br />
min is 1 and max is 5
<br />
<br />
total # of people must be in frame in order to view webcam feed
</small>
<br />
<br />
<div>
<input
id="numPeople"
type="range"
min="1"
max="5"
step="1"
value="1"
/>
<script>
const value = document.querySelector("#value");
const numPeople = document.querySelector("#numPeople");
value.textContent = numPeople.value;
numPeople.addEventListener("input", (event) => {
value.textContent = event.target.value;
});
</script>
</div>
<br />
<a id="closeSettings">– close —</a>
<br />
</div>
</div>
<li id="bottom-right2">
<audio controls id="audioElement">
Your browser does not support the audio element.
</audio>
</li>
<li id="bottom-right"><a id="openSamples">upload sample</a></li>
<div id="samplesPopup" class="popup">
<div class="popup-content">
<input type="file" id="audioFileInput" />
<br />
<br />
<small>only accepts .wav file type</small>
<br />
<br />
<br />
<a id="closeSamples">– close —</a>
</div>
</div>
<script>
openSamples.addEventListener("click", function () {
samplesPopup.classList.add("show");
});
closeSamples.addEventListener("click", function () {
samplesPopup.classList.remove("show");
});
window.addEventListener("click", function (event) {
if (event.target == samplesPopup) {
samplesPopup.classList.remove("show");
}
});
</script>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<div id="liveView" class="videoView">
<div style="width: 100%; height: 100%; position: relative">
<video
id="webcam"
style="width: 100%; height: 100%; position: absolute"
autoplay
playsinline
></video>
<canvas
class="output_canvas"
id="output_canvas"
width="1280px"
height="720px"
style="left: 0px; top: 0px; background: rgb(253, 18, 92)"
></canvas>
</div>
</div>
<script type="module" src="script.js"></script>
</body>
</html>