(Description copied from StephanShi's website)
Bytebeat
Bytebeat music (or one-liner music) was invented in September 2011. They're generally a piece of rhythmic and somewhat melodic music with no score, no instruments, and no real oscillators. It's simply a single-line formula that defines a waveform as a function of time, processed (usually) 8000 times per second, resulting in an audible waveform with a 256-step resolution from silence (0) to full amplitude (256). If you put that formula into a program with a loop that increments time variable (t), you can generate the headerless unsigned 8 bit mono 8kHz audio stream on output, like in this application. Since these directly output a waveform, they have great performance in compiled languages and can often be ran on even the weakest embedded devices.
Famous bytebeats
- 42 Melody:
t*(42&t>>10)
(8000Hz, 8s) - Neurofunk:
t*((t&4096?t%65536<59392?7:t&7:16)+(1&t>>14))>>(3&-t>>(t&2048?2:10))|t>>(t&16384?t&4096?10:3:2)
(8000Hz, 32s) - Moon Scanner Generalization:
2*(t>>5&t)-(t>>5)+t*(t>>14&14)
(8000Hz, 32s) - Sierpinski Harmony:
5*t&t>>7|3*t&4*t>>10
(8000Hz, 8s) - Street Surfer:
t&4096?t/2*(t^t%255)|t>>5:t/8|(t&8192?4*t:t)
(8000HZ, 4s) - Fanfare:
(t&8192?t&4096?t&1024?2*t:4*t:t&512?4*t:4.2*t:(t&4096?t&1024?2*t:10*t:t&512?2*t:8*t)>>2)*(t&16384?3:2)|t*(t&16384?1/8:1/(.01*t))
(8000HZ, 4s)
There are many more out there.
The sample bytebeat for my project:t*=4/3,e=(a,b)=>a>=0?a%b:(a-Math.floor(a/256)*256),f=(x,v)=>(e(x,256))/v,g=(...a)=>a.map(it=>f(it,a.length)).reduce((a,c)=>a+c),h=a=>t<65536?0:(t*a)^(42-(t*a)),kick=10000/(t%4096),g(h([1.5,1.5,1,1.5,1.6,1.6,1,1.6,1.667,1.667,1,1.667,1.6,1.6,1,1.6][(t>>11)%16]*2),h(4/[4,5,6,5][(t>>13)%4]),t/131072%5<1?0:t/131072%5<3?h([4,4.5,0,4.5,0,4,0,4,4,4.75,0,4.75,0,4.5,0,4.5,4,4.5,0,4.5,0,4,0,4,4,4.75,0,4.75,0,4.5,0,4.5,4,4.5,0,4.5,0,4,0,4,4,4.75,0,4.75,0,4.5,4.2,4,7.5,7,7,7,0,0,6,5.25,6,6,6,6,0,0,0,0][(t>>11)%64]):t/131072%5<4?h([4,4,0,4,4.5,4,4.5,0,4.75,4.75,0,4.75,4.5,4.75,4.5,0][(t>>11)%16]):h([4,0][(t>>16)%2]),t*[128,0,0,0,128,0,0,0,128,0,0,0,128,0,0,0,128,128,128,128,0,0,0,0,128,0,0,0,128,0,0,0][(t>>8)%32],kick,kick,kick,kick,[0,0,1,0,1,0,1,1][(t>>10)%8]*Math.random()*256)
(8000HZ, 61.46s)