Experimental music from very short C programs
category: code [glöplog]
Bleh, one more for the generations to come.
((t>>1)^(t>>6))|((t>>1)^(t>>7))+sin(t>>13)
And thou shall I be celebrated like Steve Jobs once my time here is done.
((t>>1)^(t>>6))|((t>>1)^(t>>7))+sin(t>>13)
And thou shall I be celebrated like Steve Jobs once my time here is done.
sin-less: replace "+sin(t>>13)" by "-(t/24e3&1)"
This could lead to a new, ultra compact tracker format, for an ultrasmall tracker.
First one must decide which subset of the highlevel language is allowed ; logic, arithmetic (initially it stops here, even mul is questionable in spirit), transcendental, conditional (paradigm shift, it induces machine code flow control ie jumps), local vars and assigments (another step in losing the "formula" spirit), arrays (wat?).
Then make a binary format for this, cause we're real men, not kiddies (more, it's smaller).
Maybe permit direct repetition of sounds explicitly like in a tracker to avoid the burden of masking time by hand etc.
At that point, might aswell define a little instruction set and virtual machine.
However I cant see the interpreter fit in 256b or the like so maybe it's pointless.
First one must decide which subset of the highlevel language is allowed ; logic, arithmetic (initially it stops here, even mul is questionable in spirit), transcendental, conditional (paradigm shift, it induces machine code flow control ie jumps), local vars and assigments (another step in losing the "formula" spirit), arrays (wat?).
Then make a binary format for this, cause we're real men, not kiddies (more, it's smaller).
Maybe permit direct repetition of sounds explicitly like in a tracker to avoid the burden of masking time by hand etc.
At that point, might aswell define a little instruction set and virtual machine.
However I cant see the interpreter fit in 256b or the like so maybe it's pointless.
Mu6k: awesome, please more!!
how do you do that ryg? its twice as fast. cool math. ;)
yumeji, do what exactly? getting rid of sines?
Hello: The tool can be 8meg for all intent purposes. What matter is that your little melody is dumped into some .asm text file that you can include in your 256b / 4K project.
Some of those tunes come out to no more then a dozen instructions, much smaller then having to include a compact evaluation + the interpreter.
Some of those tunes come out to no more then a dozen instructions, much smaller then having to include a compact evaluation + the interpreter.
This is Mu6k's "Longline Theory" resampled to 44.1khz (Because QUINTIX mentioned that the higher samplerate improves the sound)
((sb=(t*80/441)>0xffff)&0)+Math.max(Math.min(((y=Math.pow(2,[15,15,23,8][(t*80/441)>>14&3]/12))&0)+(((y*(t*80/441)*0.241)&127-64)+((y*(t*80/441)*0.25)&127-64))*1.2+ (((a=1-((t*80/441)&0x7ff)/0x7ff)&0)+(((5*(t*80/441)&0x7ff)*a)&255-127)*((0x53232323>>((t*80/441)>>11&31))&1)*a*1.0+(((d=(14*(t*80/441)*(t*80/441)^(t*80/441))&0x7ff)*a)&255-128)*((0xa444c444>>((t*80/441)>>11&31))&1)*a*1.5+((a*a*d*((t*80/441)>>9&1)&0xff-0x80)*0.1337))*sb+ ((g=((t*80/441)&0x7ff)/0x7ff)&0)+((g=1-(g*g))&0)+((h=Math.pow(2,([[15,18,17,17,17,17,999,999,22,22,999,18,999,15,20,22],[20,18,17,17,10,10,999,999,20,22,20,18,17,18,17,10]][(((t*80/441)>>14&3)>2)&1][(t*80/441)>>10&15])/12))&0)+(((h*(t*80/441)&31)+(h*(t*80/441)*1.992&31)+(h*(t*80/441)*.497&31)+(h*(t*80/441)*0.977&31)-64))*g*2.0*sb,127),-128)
I'm not claiming credit for anything! Don't kill me please!
((sb=(t*80/441)>0xffff)&0)+Math.max(Math.min(((y=Math.pow(2,[15,15,23,8][(t*80/441)>>14&3]/12))&0)+(((y*(t*80/441)*0.241)&127-64)+((y*(t*80/441)*0.25)&127-64))*1.2+ (((a=1-((t*80/441)&0x7ff)/0x7ff)&0)+(((5*(t*80/441)&0x7ff)*a)&255-127)*((0x53232323>>((t*80/441)>>11&31))&1)*a*1.0+(((d=(14*(t*80/441)*(t*80/441)^(t*80/441))&0x7ff)*a)&255-128)*((0xa444c444>>((t*80/441)>>11&31))&1)*a*1.5+((a*a*d*((t*80/441)>>9&1)&0xff-0x80)*0.1337))*sb+ ((g=((t*80/441)&0x7ff)/0x7ff)&0)+((g=1-(g*g))&0)+((h=Math.pow(2,([[15,18,17,17,17,17,999,999,22,22,999,18,999,15,20,22],[20,18,17,17,10,10,999,999,20,22,20,18,17,18,17,10]][(((t*80/441)>>14&3)>2)&1][(t*80/441)>>10&15])/12))&0)+(((h*(t*80/441)&31)+(h*(t*80/441)*1.992&31)+(h*(t*80/441)*.497&31)+(h*(t*80/441)*0.977&31)-64))*g*2.0*sb,127),-128)
I'm not claiming credit for anything! Don't kill me please!
MidKnight, protip: don't replace t everywhere, just prepend "t*=80/441," :)
What does
Code:
do in JS?"36364689"[i]
It's the short for: "36364689".charAt(i);
poi/las: and because chars in JS are effectively single-char strings, this will in turn get converted into the corresponding integer. i.e.
is just a shorter way of writing
Code:
"36364689"[i]
is just a shorter way of writing
Code:
(array literal)[3,6,3,6,4,6,8,9][i]
ryg+las: nitpicking, but "36364689"[i] returns a one character long string while [3,6,3,6,4,6,8,9][i] gives you a Number. ;)
Ahhh ouch, need more coffee ;)
Thanks ryg.
Thanks ryg.
poi, but that's just what i said in the first line of my reply!
oh silly me, I overlooked something obvious :)
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5)*t*.96&63)+(y*t&63))*1.2+((t>>16)?(((5*t&(m=2047))*(a=1-(t&m)/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)&m)*a&127)*(0xa444c444>>z&1)*a*1.5+((a*a*d*(t>>9&1)&127)*0.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|(p>2?16:0))/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*0.977&31)-64))*a*(2-a)*2:0))<-(M=127)?-M:s>M?M:s
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5)*t*.96&63)+(y*t&63))*1.2+((t>>16)?(((5*t&(m=2047))*(a=1-(t&m)/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)&m)*a&127)*(0xa444c444>>z&1)*a*1.5+((a*a*d*(t>>9&1)&127)*0.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|(p>2?16:0))/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*0.977&31)-64))*a*(2-a)*2:0))<-(M=127)?-M:s>M?M:s
WHAT THE FUCK.
another 4 chars less :) okay i'll stop now. for today. since it's bedtime. :)
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5*t)*.96&63)+(y&63))*1.2+((t>>16)?(((5*t%(m=2048))*(a=1-t%m/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)%m*a)&127)*(0xa444c444>>z&1)*a*1.5+((a*d*(t>>9&1)&127)*0.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|p/3<<4)/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*0.977&31)-64))*a*(2-a)*2:0))<-(M=127)?-M:s>M?M:s
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5*t)*.96&63)+(y&63))*1.2+((t>>16)?(((5*t%(m=2048))*(a=1-t%m/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)%m*a)&127)*(0xa444c444>>z&1)*a*1.5+((a*d*(t>>9&1)&127)*0.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|p/3<<4)/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*0.977&31)-64))*a*(2-a)*2:0))<-(M=127)?-M:s>M?M:s
And another 4 bytes less ( based on the one from 2011-10-07 10:04:19 ) ;)
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5*t)*.96&63)+(y&63))*1.2+(t>>16?(((5*t&(m=2047))*(a=1-(t&m)/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)&m)*a&(M=127))*(0xa444c444>>z&1)*a*1.5+((a*a*d*(t>>9&1)&M)*.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|p/3<<4)/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*.977&31)-64))*a*(2-a)*2:0))<-M?-M:s>M?M:s
(s=(((y=[3,3,4.7,2][p=t>>14&3]/5*t)*.96&63)+(y&63))*1.2+(t>>16?(((5*t&(m=2047))*(a=1-(t&m)/m)&128)*(0x53232323>>(z=t>>11&31)&1)*a+((d=(14*t*t^t)&m)*a&(M=127))*(0xa444c444>>z&1)*a*1.5+((a*a*d*(t>>9&1)&M)*.1337))+((((h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(t>>10&15|p/3<<4)/33*t-t)&31)+(h*1.992&31)+(h*.497&31)+(h*.977&31)-64))*a*(2-a)*2:0))<-M?-M:s>M?M:s
what the fuck
nice, the two changes combine
357 chars. original was 607 chars. if we manage to get something resembling the original down to <=303 bytes (less than half), i vote for calling the result "information theory" :)
357 chars. original was 607 chars. if we manage to get something resembling the original down to <=303 bytes (less than half), i vote for calling the result "information theory" :)