Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
Created September 13, 2014 19:16
Show Gist options
  • Save mvasilkov/352f863e38989aa89127 to your computer and use it in GitHub Desktop.
Save mvasilkov/352f863e38989aa89127 to your computer and use it in GitHub Desktop.
Collection of oneliner music formulas. Version 2011-10-18
I've tried to collect all the formulas in the related threads etc.
(excluding those that clearly sound like random first experiments or total
crap; when several variants are available, i've chosen the shortest one)
If you think I've missed something that should be here, please let me know.
====== 1ST ITERATION ======
// viznut 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>12)|(t>>8))&(63&(t>>4)))
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
(t*(t>>5|t>>8))>>(t>>16)
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>9)|(t>>13))&(25&(t>>6)))
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>11)&(t>>8))&(123&(t>>3)))
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(t>>8*((t>>15)|(t>>8))&(20|(t>>19)*5>>t|(t>>3)))
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
(-t&4095)*(255&t*(t&(t>>13)))>>12)+(127&t*(234&t>>8&t>>3)>>(3&t>>14))
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg "Space Invaders vs Pong"
t*(t>>((t>>9)|(t>>8))&(63&(t>>4)))
====== 2ND ITERATION ======
// viznut 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
(t>>6|t|t>>(t>>16))*10+((t>>11)&7)
// pyryp 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
v=(v>>1)+(v>>4)+t*(((t>>16)|(t>>6))&(69&(t>>9)))
// red- 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
(t|(t>>9|t>>7))*t&(t>>11|t>>9)
// miiro 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
t*5&(t>>7)|t*3&(t*4>>10)
// viznut 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y (xpansive+varjohukka)
(t>>7|t|t>>6)*10+4*(t&t>>13|t>>6)
// skurk+raer 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
((t&4096)?((t*(t^t%255)|(t>>4))>>1):(t>>3)|((t&8192)?t<<2:t))
// xpansive 2011-09-29 http://pouet.net/topic.php?which=8357&page=2 "Lost in Space"
((t*(t>>8|t>>9)&46&t>>8))^(t&t>>13|t>>6)
====== 3RD ITERATION ======
// viznut 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(t*5&t>>7)|(t*3&t>>10)
// bst 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(int)(t/1e7*t*t+t)%127|t>>4|t>>5|t%127+(t>>16)|t
// kb 2011-10-04 http://pouet.net/topic.php?which=8357&page=8 44kHz
((t/2*(15&(0x234568a0>>(t>>8&28))))|t/2>>(t>>11)^t>>12)+(t/16&t&24)
// viznut 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(t&t%255)-(t*3&t>>13&t>>6)
// droid 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
t>>4|t&((t>>5)/(t>>7-(t>>15)&-t>>7-(t>>15)))
// ryg 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o 44.1 kHz
((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127)
// stephth 2011-10-03 http://news.ycombinator.com/item?id=3063359
(t*9&t>>4|t*5&t>>7|t*3&t/1024)-1
// viznut+oasiz 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o "Dante's Inferno" short version
((t*(t>>12)&(201*t/100)&(199*t/100))&(t*(t>>14)&(t*301/100)&(t*399/100)))+((t*(t>>16)&(t*202/100)&(t*198/100))-(t*(t>>17)&(t*302/100)&(t*298/100)))
// viznut+oasiz 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o "Dante's Inferno" long version
((t*(t>>12)&(201*t/100)&(199*t/100))&(t*(t>>14)&(t*301/100)&(t*399/100)))+((t*(t>>16)&(t*202/100)&(t*198/100))-(t*(t>>18)&(t*302/100)&(t*298/100)))
// mu6k 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o "Long-line Theory", Chaos Theory cover, optimized by ryg, p01 et al., JS-only
w=t>>9,k=32,m=2048,a=1-t/m%1,d=(14*t*t^t)%m*a,y=[3,3,4.7,2][p=w/k&3]*t/4,h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(w/2&15|p/3<<4)/33*t-t,s=y*.98%80+y%80+(w>>7&&a*((5*t%m*a&128)*(0x53232323>>w/4&1)+(d&127)*(0xa444c444>>w/4&1)*1.5+(d*w&1)+(h%k+h*1.99%k+h*.49%k+h*.97%k-64)*(4-a-a))),s*s>>14?127:s
// 216 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
t*(t^t+(t>>15|1)^(t-1280^t)>>10)
// mu6k http://www.youtube.com/watch?v=tCRPUv8V22o 32.0 kHz
(3e3/(y=t&16383)&1)*35 +(x=t*"6689"[t>>16&3]/24&127)*y/4e4 +((t>>8^t>>10|t>>14|x)&63)
====== 0XA VIDEOS ======
// harism 2011-10-09 http://0xa.kuri.mu/2011/10/09/bitop-videos/
((t>>1%128)+20)*3*t>>14*t>>18
// tangent128 2011-10-09 http://0xa.kuri.mu/2011/10/09/bitop-videos/
t*(((t>>9)&10)|((t>>11)&24)^((t>>10)&15&(t>>15)))
// ultrageranium 2011-10-12 http://0xa.kuri.mu/2011/10/09/bitop-videos/
(t*t/256)&(t>>((t/1024)%16))^t%64*(0xC0D3DE4D69>>(t>>9&30)&t%32)*t>>18
====== ALL COLLECTED FORMULAS (length order) ======
// trivial minimum: plain sawtooth
t
// minimal sierpinski harmony
t&t>>8
// "the 42 melody", separately discovered by several people on irc etc
t*(42&t>>10)
// danharaj 2011-10-03 http://www.reddit.com/r/programming/comments/kyj77/algorithmic_symphonies_from_one_line_of_code_how/ "fractal trees", 216's version
t|t%255|t%257
// droid 2011-10-05 http://pouet.net/topic.php?which=8357&page=10
t>>6&1?t>>5:-t>>4
// Niklas_Roy 2011-10-14 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
t*(t>>9|t>>13)&16
// krcko 2011-10-04 http://rafforum.rs/index.php/topic,123.0.html
(t&t>>12)*(t>>4|t>>8)
// viznut 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(t*5&t>>7)|(t*3&t>>10)
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
(t*(t>>5|t>>8))>>(t>>16)
// miiro 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
t*5&(t>>7)|t*3&(t*4>>10)
// robert 2011-10-11 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
(t>>13|t%24)&(t>>7|t%19)
// Niklas_Roy 2011-10-14 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
(t*((t>>9|t>>13)&15))&129
// viznut 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(t&t%255)-(t*3&t>>13&t>>6)
// krcko 2011-10-04 http://rafforum.rs/index.php/topic,123.0.html
(t&t>>12)*(t>>4|t>>8)^t>>6
// blueberry 2011-10-05 http://pouet.net/topic.php?which=8357&page=12 11kHz
t*(((t>>9)^((t>>9)-1)^1)%13)
// rrola 2011-10-04 http://pouet.net/topic.php?which=8357&page=9 optimized by ryg
t*(0xCA98>>(t>>9&14)&15)|t>>8
// tonic 2011-10-01 http://pouet.net/topic.php?which=8357&page=5 "mr. arpeggiator playing a solo"
(t/8)>>(t>>9)*t/((t>>14&3)+4)
// FreeFull 2011-10-12 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
(~t/100|(t*3))^(t*3&(t>>5))&t
// red- 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
(t|(t>>9|t>>7))*t&(t>>11|t>>9)
// harism 2011-10-09 http://0xa.kuri.mu/2011/10/09/bitop-videos/
((t>>1%128)+20)*3*t>>14*t>>18
// droid 2011-10-04 http://pouet.net/topic.php?which=8357&page=9
t&(sin(t&t&3)*t>>5)/(t>>3&t>>6)
// viznut 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>12)|(t>>8))&(63&(t>>4)))
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>9)|(t>>13))&(25&(t>>6)))
// 216 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
t*(t^t+(t>>15|1)^(t-1280^t)>>10)
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(((t>>11)&(t>>8))&(123&(t>>3)))
// viznut 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y (xpansive+varjohukka)
(t>>7|t|t>>6)*10+4*(t&t>>13|t>>6)
// stephth 2011-10-03 http://news.ycombinator.com/item?id=3063359
(t*9&t>>4|t*5&t>>7|t*3&t/1024)-1
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg "Space Invaders vs Pong"
t*(t>>((t>>9)|(t>>8))&(63&(t>>4)))
// viznut 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
(t>>6|t|t>>(t>>16))*10+((t>>11)&7)
// yumeji 2011-10-04 http://pouet.net/topic.php?which=8357&page=9
(t>>1)*(0xbad2dea1>>(t>>13)&3)|t>>5
// ryg 2011-10-04 http://pouet.net/topic.php?which=8357&page=8
(t>>4)*(13&(0x8898a989>>(t>>11&30)))
// marmakoide 2011-10-04 http://pouet.net/topic.php?which=8357&page=8
(t>>(t&7))|(t<<(t&42))|(t>>7)|(t<<5)
// robert 2011-10-11 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
(t>>7|t%45)&(t>>8|t%35)&(t>>11|t%20)
// lucasvb 2011-10-03 http://www.reddit.com/r/programming/comments/kyj77/algorithmic_symphonies_from_one_line_of_code_how/
(t>>6|t<<1)+(t>>5|t<<3|t>>3)|t>>2|t<<1
// bear @ celephais
t+(t&t^t>>6)-t*((t>>9)&(t%16?2:6)&t>>9)
// xpansive 2011-09-29 http://pouet.net/topic.php?which=8357&page=2 "Lost in Space"
((t*(t>>8|t>>9)&46&t>>8))^(t&t>>13|t>>6)
// rez 2011-10-05 http://pouet.net/topic.php?which=8357&page=11 js-only optimized by ryg
t*(1+"4451"[t>>13&3]/10)&t>>9+(t*0.003&3)
// marmakoide 2011-10-03 http://pouet.net/topic.php?which=8357&page=7 "Lemmings March"
(t>>5)|(t<<4)|((t&1023)^1981)|((t-67)>>4)
// droid 2011-10-04 http://pouet.net/topic.php?which=8357&page=9
t>>4|t&(t>>5)/(t>>7-(t>>15)&-t>>7-(t>>15))
// rez 2011-10-03 http://pouet.net/topic.php?which=8357&page=7
t*(t/256)-t*(t/255)+t*(t>>5|t>>6|t<<2&t>>1)
// viznut 2011-10-06 #countercomplex "moon scanner generalization", based on jaffa's formula
((t>>5&t)-(t>>5)+(t>>5&t))+(t*((t>>14)&14))
// viznut 2011-10-04 http://pouet.net/topic.php?which=8357&page=9
(t*((3+(1^t>>10&5))*(5+(3&t>>14))))>>(t>>8&3)
// droid 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
t>>4|t&DIV((t>>5),(t>>7-(t>>15)&-t>>7-(t>>15)))
// pyryp 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
v=(v>>1)+(v>>4)+t*(((t>>16)|(t>>6))&(69&(t>>9)))
// bst 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o
(int)(t/1e7*t*t+t)%127|t>>4|t>>5|t%127+(t>>16)|t
// tangent128 2011-10-09 http://0xa.kuri.mu/2011/10/09/bitop-videos/
t*(((t>>9)&10)|((t>>11)&24)^((t>>10)&15&(t>>15)))
// tejeez 2011-10-05 #countercomplex
(~t>>2)*((127&t*(7&t>>10))<(245&t*(2+(5&t>>14))))
// lokori 2011-10-04 #suomiscene
(t+(t>>2)|(t>>5))+(t>>3)|((t>>13)|(t>>7)|(t>>11))
// visy 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
t*(t>>8*((t>>15)|(t>>8))&(20|(t>>19)*5>>t|(t>>3)))
// Aaron_Krister_Johnson 2011-10-14 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
(t>>4)|(t%10)|(((t%101)|(t>>14))&((t>>7)|(t*t%17)))
// jounim 2011-10-04 #suomiscene
((t&((t>>5)))+(t|((t>>7))))&(t>>6)|(t>>5)&(t*(t>>7))
// spikey 2011-10-04 #suomiscene based on jounim's formula
((t&((t>>23)))+(t|(t>>2)))&(t>>3)|(t>>5)&(t*(t>>7))
// akx 2011-10-05 http://twitter.com/#!/akx
(((((t*((t>>9|t>>13)&15))&255/15)*9)%(1<<7))<<2)%6<<4
// bst 2011-10-05 http://pouet.net/topic.php?which=8357&page=10
((t%42)*(t>>4)|(0x15483113)-(t>>4))/(t>>16)^(t|(t>>4))
// skurk 2011-10-04 http://pouet.net/topic.php?which=8357&page=8
t*(t>>((t&4096)?((t*t)/4096):(t/4096)))|(t<<(t/256))|(t>>4)
// skurk+raer 2011-09-30 http://www.youtube.com/watch?v=qlrs2Vorw2Y
((t&4096)?((t*(t^t%255)|(t>>4))>>1):(t>>3)|((t&8192)?t<<2:t))
// yumeji 2011-10-06 http://pouet.net/topic.php?which=8357&page=12 "badbeats & safe"
t*((0xbadbea75>>((t>>12)&30)&3)*0.25*(0x5afe5>>((t>>16)&28)&3))
// bst 2011-10-11 http://pouet.net/topic.php?which=8357&page=18
t>>16|((t>>4)%16)|((t>>4)%192)|(t*t%64)|(t*t%96)|(t>>16)*(t|t>>5)
// bear @ celephais
t>>6^t&37|t+(t^t>>11)-t*((t%24?2:6)&t>>11)^t<<1&(t&598?t>>4:t>>10)
// kb 2011-10-04 http://pouet.net/topic.php?which=8357&page=8 44kHz
((t/2*(15&(0x234568a0>>(t>>8&28))))|t/2>>(t>>11)^t>>12)+(t/16&t&24)
// bst 2011-10-05 http://pouet.net/topic.php?which=8357&page=12
(t>>5)|(t>>4)|((t%42)*(t>>4)|(0x15483113)-(t>>4))/(t>>16)^(t|(t>>4))
// tejeez 2011-09-18 http://www.youtube.com/watch?v=GtQdIYUtAHg
(-t&4095)*(255&t*(t&(t>>13)))>>12)+(127&t*(234&t>>8&t>>3)>>(3&t>>14))
// ultrageranium 2011-10-12 http://0xa.kuri.mu/2011/10/09/bitop-videos/
(t*t/256)&(t>>((t/1024)%16))^t%64*(0xC0D3DE4D69>>(t>>9&30)&t%32)*t>>18
// visy 2011-10-06 http://pouet.net/topic.php?which=8357&page=13
(t%25-(t>>2|t*15|t%227)-t>>3)|((t>>5)&(t<<5)*1663|(t>>3)%1544)/(t%17|t%2048)
// ryg 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o 44.1 kHz
((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127)
// mu6k http://www.youtube.com/watch?v=tCRPUv8V22o 32.0 kHz
(3e3/(y=t&16383)&1)*35 +(x=t*"6689"[t>>16&3]/24&127)*y/4e4 +((t>>8^t>>10|t>>14|x)&63)
// Ola 2011-10-11 http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
((1-(((t+10)>>((t>>9)&((t>>14))))&(t>>4&-2)))*2)*(((t>>10)^((t+((t>>6)&127))>>10))&1)*32+128
// raer 2011-10-07 http://pouet.net/topic.php?which=8357&page=16 stereo 11kHz
L: ((t&4096)?((t*(t^t%255)|(t>>4))>>1):(t>>3)|((t&8192)?t<<2:t)) R: t*(((t>>9)^((t>>9)-1)^1)%13)
// ryg 2011-10-04 http://pouet.net/topic.php?which=8357&page=8
((t>>4)*(13&(0x8898a989>>(t>>11&30)))&255)+((((t>>9|(t>>2)|t>>8)*10+4*((t>>2)&t>>15|t>>8))&255)>>1)
// gasman 2011-10-05 http://pouet.net/topic.php?which=8357&page=12 js-only
(t<<3)*[8/9,1,9/8,6/5,4/3,3/2,0][[0xd2d2c8,0xce4088,0xca32c8,0x8e4009][t>>14&3]>>(0x3dbe4688>>((t>>10&15)>9?18:t>>10&15)*3&7)*3&7]
// a1k0n http://news.ycombinator.com/item?id=3063359 js-only
SS=function(s,o,r,p){var c=s.charCodeAt((t>>r)%p);return c==32?0:31&t*Math.pow(2,c/12-o)},SS("0 0 7 7 037:<<",6,10,32) + (t&4096?SS("037",4,8,3)*(4096-(t&4095))>>12 : 0)
// mu6k 2011-10-10 http://www.youtube.com/watch?v=tCRPUv8V22o "Long-line Theory", Chaos Theory cover, optimized by ryg, p01 et al., JS-only
w=t>>9,k=32,m=2048,a=1-t/m%1,d=(14*t*t^t)%m*a,y=[3,3,4.7,2][p=w/k&3]*t/4,h="IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(w/2&15|p/3<<4)/33*t-t,s=y*.98%80+y%80+(w>>7&&a*((5*t%m*a&128)*(0x53232323>>w/4&1)+(d&127)*(0xa444c444>>w/4&1)*1.5+(d*w&1)+(h%k+h*1.99%k+h*.49%k+h*.97%k-64)*(4-a-a))),s*s>>14?127:s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment