-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
353 lines (320 loc) · 11.8 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<!-- @format -->
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8" />
<meta tag="nositelinkssearchbox" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="origin-trial" content="Ah+Gaagvf2Hnk5yshbNHYwzWyzzOvn+CwpGU+2Fhn1mrmREEC3471tCy1W0rbYB+BSaS84UU6ewo1sQLXVAUMA4AAABbeyJvcmlnaW4iOiJodHRwczovL3Nwb3RpZnkuYmVuamFtaW5nd3lubi5jb206NDQzIiwiZmVhdHVyZSI6Ildha2VMb2NrIiwiZXhwaXJ5IjoxNTk0MTY2Mzk5fQ==" />
<title>Spotify Starfield</title>
<link rel="stylesheet" href="/font/RedAlert.css" />
<link rel="stylesheet" href="index.css" />
<link rel="icon" type="image/png" sizes="192x192" href="/favicon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#000000" />
</head>
<body>
<main>
<article id="login">
<img src="/screenshot.png" />
<h1 id="logo">Spotify starfield</h1>
<a id="login-btn" href="https://accounts.spotify.com/authorize?client_id=6ed539a873ed442fac572b7f679833a9&redirect_uri=https%3A%2F%2Fspotify.benjamingwynn.com&scope=user-read-playback-state%20user-read-private%20user-read-email&response_type=token&state=123">Login through Spotify</a>
<p>Spotify starfield is a music visualizer made for Spotify. It generates a starfield of dots and lines, and then adjust the physics conditions and colors of the starfield as the music plays based off of data from the music, such as tempo, key, loudness and more.</p>
<h2>Privacy</h2>
<p>This website uses the official login portal provided by Spotify and has no access to your information other than current playback status, all data is processed locally and is never collected or sent to an external server.</p>
<p>This site contacts no other API other than Spotify.</p>
<h2>Technical</h2>
<p>This is is prototype, a proof-of-concept, performance won't be great.</p>
<p>Source code is <a href="https://github.com/benjamingwynn/spotify.benjamingwynn.com" target="noopener">available on Github.</a> This data is provided by <a href="https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-analysis" target="noopener">Spotify's Analytics API</a></p>
<h3>
<a href="https://benjamingwynn.com" target="noopener"><small>created by Benjamin Gwynn</small></a>
</h3>
<p>
<small>This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Spotify, or any of its subsidiaries or its affiliates. The official Spotify website can be found at <a href="https://spotify.com" target="noopener">https://spotify.com</a></small>
</p>
</article>
<article id="loading" hidden>
<h1>CONNECTING TO SPOTIFY...</h1>
<p>Loading visualization data from spotify. <a href="/">Cancel</a></p>
</article>
<article id="no-track" hidden>
<h2>No music playing</h2>
<p>To start the visualization you need to start playing music on Spotify.</p>
<p>You can play music using the Spotify app on any device, even this one.</p>
</article>
<article id="keyboard" hidden>
<div>
<h2>H</h2>
<h3>Hide all UI</h3>
</div>
<div>
<h2>F</h2>
<h3>Request fullscreen</h3>
</div>
<div>
<h2>D</h2>
<h3>Debugging information</h3>
</div>
<div>
<h2>R</h2>
<h3>Reload page</h3>
</div>
<div>
<h2>L</h2>
<h3>Toggle light/dark</h3>
</div>
<small>This overlay hides automatically if you don't move the mouse</small>
</article>
<div class="logger"><code class="logger-log"></code></div>
<article id="player" hidden>
<span id="player-meta">{song} - {artist}</span>
<span id="player-time">{current} / {end}</span>
</article>
<article id="settings" hidden>
<h1 style="margin: 0">secret settings</h1>
<h3 style="margin-bottom: 0.5em; color: pink">these are not supposed to be changed!</h3>
<div class="collection" id="spotify-settings">
<h2>Spotify</h2>
<label data-prop="BEAT_STRENGTH">
<span>beat strength</span>
<input type="range" min="0" max="60" value="30" step="1" />
<code>000</code>
</label>
<label data-prop="BEAT_RESISTANCE">
<span>beat resistance</span>
<input type="range" min="0" max="10" value="3" step="1" />
<code>000</code>
</label>
<label data-prop="BEAT_MIN_CONFIDENCE">
<span>beat min confidence</span>
<input type="range" min="0" max="2" value="0.15" step="0.05" />
<code>000</code>
</label>
<label data-prop="TATUM_MIN_CONFIDENCE">
<span>tatum min confidence</span>
<input type="range" min="0" max="2" value="0.45" step="0.05" />
<code>000</code>
</label>
<label data-prop="loudnessBaseline">
<span>loudnessBaseline</span>
<input type="range" min="1" max="50" step="1" />
<code>-</code>
</label>
<label data-prop="loudnessExtra">
<span>loudnessExtra</span>
<input type="range" min="1" max="50" step="1" />
<code>-</code>
</label>
<label data-prop="loudnessScale">
<span>loudnessScale</span>
<input type="range" min="1" max="50" step="1" />
<code>-</code>
</label>
<label data-prop="pushSpeedMax">
<span>pushSpeedMax</span>
<input type="range" min="0.1" max="5" step="0.1" />
<code>-</code>
</label>
<label data-prop="pushSpeedMin">
<span>pushSpeedMin</span>
<input type="range" min="0.1" max="5" step="0.1" />
<code>-</code>
</label>
<label data-prop="rotSpeedTempoDiv">
<span>rotSpeedTempoDiv</span>
<input type="range" min="1" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="connectionRadiusMinProduct">
<span>connectionRadiusMinProduct</span>
<input type="range" min="0.01" max="1" step="0.01" />
<code>-</code>
</label>
<label data-prop="tempoWorldSpeed">
<span>tempoWorldSpeed</span>
<input type="range" min="1" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="warpSpeedScaler">
<span>warpSpeedScaler</span>
<input type="range" min="0.001" max="1" step="0.001" />
<code>-</code>
</label>
<label data-prop="spawnRadiusProduct">
<span>spawnRadiusProduct</span>
<input type="range" min="1" max="10" step="1" />
<code>-</code>
</label>
<label data-prop="loudnessBaselineRadii">
<span>loudnessBaselineRadii</span>
<input type="range" min="1" max="100" step="1" />
<code>-</code>
</label>
<label data-prop="loudnessScaleRadii">
<span>loudnessScaleRadiir</span>
<input type="range" min="1" max="100" step="1" />
<code>-</code>
</label>
</div>
<div class="collection" id="starfield-settings">
<h2>Starfield</h2>
<label data-prop="rotationEnabled">
<span>rotation on</span>
<input type="range" min="0" max="1" step="1" value="1" />
<code>-</code>
</label>
<label data-prop="warpOn">
<span>warp on</span>
<input type="range" min="0" max="1" step="1" value="1" />
<code>-</code>
</label>
<label data-prop="starSpawnLimiter">
<span>starSpawnLimiter</span>
<input type="range" min="1" max="32" step="1" />
<code>-</code>
</label>
<label data-prop="STAR_RADIUS">
<span>star radius</span>
<input type="range" min="1" max="32" step="1" />
<code>-</code>
</label>
<label data-prop="minConnectionRadius">
<span>min c rad</span>
<input type="range" min="0" max="300" step="1" />
<code>-</code>
</label>
<label data-prop="maxConnectionRadius">
<span>max c rad</span>
<input type="range" min="0" max="300" step="1" />
<code>-</code>
</label>
<label data-prop="edgeSize">
<span>edge size</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="starPopulationDensity">
<span>population density</span>
<input type="range" min="0" max="0.01" step="0.000001" />
<code>-</code>
</label>
<label data-prop="starMinSpeed">
<span>min speed</span>
<input type="range" min="0" max="5" step="0.1" />
<code>-</code>
</label>
<label data-prop="starMaxSpeed">
<span>max speed</span>
<input type="range" min="0" max="5" step="0.1" />
<code>-</code>
</label>
<label data-prop="worldSpeed">
<span>target world speed</span>
<input type="range" min="0.001" max="1" step="0.001" />
<code>-</code>
</label>
<label data-prop="connectionStarPopulationDensity">
<span>connection density</span>
<input type="range" min="0" max="0.0001" step="0.000002" />
<code>-</code>
</label>
<label data-prop="starPulseSpeed">
<span>pulse speed</span>
<input type="range" min="0" max="0.01" step="0.00005" />
<code>-</code>
</label>
<label data-prop="lineWidth">
<span>line width</span>
<input type="range" min="1" max="16" step="1" />
<code>-</code>
</label>
</div>
<div class="collection" id="this-settings">
<h2>state</h2>
<label data-prop="maximumStarPopulation">
<span>max star population</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="maxConnectionStars">
<span>max connection stars</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="connectionRadiusProduct">
<span>connectionRadiusProduct</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="connectionRadiusProductActual">
<span>connectionRadiusProductActual</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="nStars">
<span>nStars</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="nConnectionStars">
<span>nConnectionStars</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
<label data-prop="actualWorldSpeed">
<span>real world speed</span>
<input type="range" min="0.001" max="1" step="0.001" />
<code>-</code>
</label>
<label data-prop="warpSpeed">
<span>warp speed</span>
<input type="range" min="0" max="0.001" step="0.0000r1" />
<code>-</code>
</label>
<label data-prop="rot">
<span>rot</span>
<input type="range" min="0" max="360" step="1" />
<code>-</code>
</label>
<label data-prop="rotSpeed">
<span>rot speed</span>
<input type="range" min="0" max="1" step="0.005" />
<code>-</code>
</label>
<label data-prop="spawnRadius">
<span>spawn radius</span>
<input type="range" min="0" max="1000" step="1" />
<code>-</code>
</label>
</div>
</article>
</main>
<script src="./stars.js"></script>
<script src="./wakelock.js"></script>
<script>
document.querySelector("main").addEventListener("touchend", () => {
if (document.body.webkitRequestFullscreen) document.body.webkitRequestFullscreen()
else document.body.requestFullscreen()
})
</script>
<script>
const tf = () => {
document.body.style.cursor = "none"
if (!document.querySelector("#player").hidden) {
document.querySelector("#keyboard").hidden = true
}
}
const tt = 3000
let t = setTimeout(tf, tt)
document.addEventListener("mousemove", () => {
if (!document.querySelector("#player").hidden) {
document.querySelector("#keyboard").hidden = false
}
document.body.style.cursor = ""
clearTimeout(t)
t = setTimeout(tf, tt)
})
</script>
<script></script>
</body>
</html>