-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
48 lines (40 loc) · 1.04 KB
/
main.js
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
d = document;
c = d.body.appendChild(d.createElement("canvas"));
c.width = 1280;
c.height = 720;
for (i in g = c.getContext("webgl")) {
g[i[0] + i[6]] = g[i];
}
for (i in a = new AudioContext) {
a[i[6]] = a[i];
}
f = requestAnimationFrame;
cs = (src, type, shader = g.cS(type)) => {
g.sS(shader, src);
g.compileShader(shader);
return shader;
}
d = _ => {
g.uniform1f(g.gf(p, "t"), a.currentTime);
g.dr(6, 0, 3);
f(d);
}
c.onclick = _ => {
c.requestFullscreen();
c = a.B();
c.buffer = a.createBuffer(1, q = 8000 * 45, 8000);
for (t = q; t--;) {
//Write tune here
c.buffer.getChannelData(0)[t] = (
("34"[t>>8&t])*70.0|((t^(t>>50))-(t&(t>>5))-(t^(2*t>>3)))
& 255) / 127 - 1;
}
c.connect(a.a);
c.start();
g.aS(p = g.cP(), cs(`attribute vec4 p;void main(){gl_Position=p;}`, 35633));
g.aS(p, cs(shader_frag, 35632));
g.lo(p);
g.vA(g.ug(p), 2, 5120, g.bf(34962, g.cB()), 1, g.bD(34962, new Int8Array([1, -3, 1, 1]), 35044));
g.eV(0);
f(d);
}