Skip to content

Commit 63404a0

Browse files
low cut
1 parent 017afe1 commit 63404a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@ <h1>Hear the Traffic</h1>
2929

3030
let ac = null;
3131
let osc = null;
32+
let freq = 30;
3233

3334
const update = () => {
3435
fetch('https://metrics.nc.menhera.org/_traffic.json').then(async (res) => {
3536
if (!res.ok) return;
3637
const data = await res.json();
37-
realData = data;
38+
freq = data[0] * 2;
39+
realData = [0, ... data.slice(7, 126)];
3840

3941
if (osc) {
4042
let len = realData.length;
4143
const imagData = new Array(len).fill(0);
4244
const periodicWave = ac.createPeriodicWave(realData, imagData);
43-
osc.frequency.value = realData[0] * 2;
45+
osc.frequency.value = freq;
4446
osc.setPeriodicWave(periodicWave);
4547
}
4648
}).catch((e) => {
@@ -53,7 +55,7 @@ <h1>Hear the Traffic</h1>
5355
function sound_start() {
5456
ac = new AudioContext();
5557
osc = ac.createOscillator();
56-
osc.frequency.value = realData[0] * 2;
58+
osc.frequency.value = freq;
5759
let len = realData.length;
5860
const imagData = new Array(len).fill(0);
5961
const periodicWave = ac.createPeriodicWave(realData, imagData);

0 commit comments

Comments
 (0)