u(t) is called 60 times per second.
t: Elapsed time in seconds.
S: Shorthand for Math.sin.
C: Shorthand for Math.cos.
T: Shorthand for Math.tan.
R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
//Assumes 8-bit bitdepth r=8e3//Sample rate (hertz/sec) l=8//Number of lines/seconds to display //d is divisor to shorten lines when over 4 for(i=r*l,d=1+((i-1)/32e3|0);i--;x.fillRect(i%r/r*c.width,(((i/r|0)+1)*256-(m)%256)/d,9,9)){ m=i*(42&i>>10)//<-Music algo here! x.fillStyle=hsl(${(i>>7)*99} 99 50)}
I made a #static visualizer to help me with bytebeats. This is a sample displaying 8 seconds of the famous forty-two melody: t*(42&t>>10). I posted it here incase anyone might find it useful...
u(t) is called 60 times per second.
t: elapsed time in seconds.
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
S: Math.sin
C: Math.cos
T: Math.tan
R: Generates rgba-strings, ex.: R(255, 255, 255, 0.5)