Experimental music from very short C programs
category: code [glöplog]
http://www.youtube.com/watch?v=NPD9zCOpmuc
Oh I forgot you need bbcode and unicode.
Oh I forgot you need bbcode and unicode.
Info: you guys made it to the magazine of the TU Eindhoven's computer science & math study association.
Not that that's much of a feat, but it does mean that real paper mags are writing about this! :-)
Not that that's much of a feat, but it does mean that real paper mags are writing about this! :-)
@skrebbel
Is there a copy of the publication online somewhere?
Is there a copy of the publication online somewhere?
Haven't read all 22 pages, but just wanna say this is GENIUS!!
O hai, this is another necrobump!
And this is madness:
(t>0)?t:s=0,s=s+1.0/8,t=s,dt=t*4,drm=((((u=dt&0x3fff)&0+((u+1<<(18+(dt>>12&1*6)))/u)&255)/(u>>8))&240-128)*4,y=(1+sin(t*0.1)*sin(t*0.00001)*10),l=(127/(1+(t&0x3ff)*0.002)),t12=(t>>11)|(t>>9)&(t>>15),n=[0,3,7,5,2,9,10][t12%7],f=Math.pow(n/12,2),ww=f*t/8+y*(f+12),w=sin(ww),Math.min(Math.max((drm*10+w*5*l),-128),127)
With quality settings: (240p for fastest preview)
1080p
480p
240p
And this is madness:
(t>0)?t:s=0,s=s+1.0/8,t=s,dt=t*4,drm=((((u=dt&0x3fff)&0+((u+1<<(18+(dt>>12&1*6)))/u)&255)/(u>>8))&240-128)*4,y=(1+sin(t*0.1)*sin(t*0.00001)*10),l=(127/(1+(t&0x3ff)*0.002)),t12=(t>>11)|(t>>9)&(t>>15),n=[0,3,7,5,2,9,10][t12%7],f=Math.pow(n/12,2),ww=f*t/8+y*(f+12),w=sin(ww),Math.min(Math.max((drm*10+w*5*l),-128),127)
With quality settings: (240p for fastest preview)
1080p
480p
240p
mu6k, cool! you made that one?
xpansive, not sure, i think not.
xpansive, not sure, i think not.
For those who happen to own an iphone/ipad or similar, I made an app that uses this synthesis method, to play around in real-time, with 3d scope visuals. I think you'll like it.
It's called BitWiz Audio Synth. Demo vid and info here: http://kymatica.com/bitwiz
It's called BitWiz Audio Synth. Demo vid and info here: http://kymatica.com/bitwiz
yay $2.99!
L: x=t*0.1,(t<1)?(s=1/8,f=1<<16):0,(t%f)==0?(s=s*[3/2,2/3,4/3,3/4,5/4,4/5,6/5,5/6][(x^(x>>3))&7],e=1,f=1<<(14+sin(x*99)*2)):e*=0.9999,s>0.25?s*=0.5:s<0.02?s*=2:0,sin(sin(t*s)*e*9)*e*127; | R: sin(sin(t*s/2)*e*16)*e*127
Next note is generated based on previous note after a random waiting time.
Envelope is multiplied by 0.9999 every sample. It will approach 0. Resets on new note.
Frequency and envelope is used to generate a simple FMish sound using the sine function.
Increase time if you want to hear more awkwardly generated notes.
Next note is generated based on previous note after a random waiting time.
Envelope is multiplied by 0.9999 every sample. It will approach 0. Resets on new note.
Frequency and envelope is used to generate a simple FMish sound using the sine function.
Increase time if you want to hear more awkwardly generated notes.
Hi volks!
I use this formula to generate a chromatic scale (8000 Hz):
t * Math.pow (2.0, (((t>>11)%13)+20) / 12.0)
t * Math.pow (2.0, (((t>>11)%13)+20) / 12.0)
Q: Can that be optimized to get rid of pow or floating point completely?
I'm new to sound and don't know any tricks yet...
I use this formula to generate a chromatic scale (8000 Hz):
t * Math.pow (2.0, (((t>>11)%13)+20) / 12.0)
t * Math.pow (2.0, (((t>>11)%13)+20) / 12.0)
Q: Can that be optimized to get rid of pow or floating point completely?
I'm new to sound and don't know any tricks yet...
@pinsel: I'm pretty sure there isn't a way for getting rid of pow / floating point for chromatic scales (besides using tables of course).
Tried a little and must agree: That was a really silly question.
All approximizations sounded terrible :)
All approximizations sounded terrible :)
If you adopt just intonation (where notes are related by small integer ratios) instead of equal temperament (where everything is a 12th root of two) then you can avoid the Math.pow. Not sure how you'd make a full musical scale out of it without using tables, though...
(My 131-byte rickroll has an easily visible table of ratios in it)
(My 131-byte rickroll has an easily visible table of ratios in it)
I'll look at that. Maybe Intonation is what i've used here without knowing any background. Real Fun!
L: u=((t+0x3900)&0x2fff),(u*((u>>8)&4)*(((u>>13)&3)+((u>>10)&3))>>1) | R: u=(t+0x100)&0x3000?(-t+0x2700):(t+0x2700),u*((u>>7)&4)*(((u>>13)&3)+((u>>10)&3))>>1
"Fanfare Of The Happy Muncher"
L: u=((t+0x3900)&0x2fff),(u*((u>>8)&4)*(((u>>13)&3)+((u>>10)&3))>>1) | R: u=(t+0x100)&0x3000?(-t+0x2700):(t+0x2700),u*((u>>7)&4)*(((u>>13)&3)+((u>>10)&3))>>1
"Fanfare Of The Happy Muncher"
nice reverb or whatever that is @pinsel. ;)
"Just intonation" not just "intonation". (Thank ghawd for quotation marks. ;) ) "Just" is an adjective modifying "intonation".
And yes, unless you use some really weird tricks, (or floating point) you will have used just intonation by default. Every frequency you create will typically by an integer division of the sample rate, so as an effect of that, any two frequencies will also be an integer ratio of each other. And chances are that if you've found meaningful intervals, that they are simple ratios like 3/2 or 5/4 of each other.
And yes, unless you use some really weird tricks, (or floating point) you will have used just intonation by default. Every frequency you create will typically by an integer division of the sample rate, so as an effect of that, any two frequencies will also be an integer ratio of each other. And chances are that if you've found meaningful intervals, that they are simple ratios like 3/2 or 5/4 of each other.
Thx, i tried Just Intonation, but it limits creativity - reminds me on playing flagolets on guitar, which i never liked for that reason. approximating the curve with some spline method should work, but it's neither faster nor less code, so i'll keep using a table for my usecase. What i really want is generating procedural music for a small mobile game, and the ideas presented here are very inspiring. I dream of some kind of music, that changes during playng the game, and also reacts to the actions of the player, so you feel like creating some music yourself while playing. If someone of you guys knows another source of inspiration, pls let me know :)
You're searching for algorithmic composition, there's lots of research done in that respect by Albert Gräf and Clarence Barlow. With that information and the help of google you could spend many hours reading interesting stuff.
TY for the names, add "Joseph Schillinger" to the researcher list.
No idea what I'm doing, but I modified and mixed up a bit from xpansive (2012-02-25 23:08:57) and yumeji (2011-10-04 17:54:07):
L: t>>4|(t>>9|(t>>13)&3)|t>>5^t | R: t%(t/(t>>9|t>>13))^t
L: t>>4|(t>>9|(t>>13)&3)|t>>5^t | R: t%(t/(t>>9|t>>13))^t
This could go well as a nasty sound effect in a production:
Short:
L: y=((t*t>>20)&0xffff)*t>>8,u=((t*t>>19)&0xffff)*t>>9,p=u^y,(p>>4)^(p>>8) | R: (p>>5)^(p>>9)
Long:
L: y=((t*t>>20)&0xffff)*t>>8,u=((t*t>>19)&0xffff)*t>>9,p=u^y,(p>>4)^(p>>8) | R: (p>>5)^(p>>9)
Short:
L: y=((t*t>>20)&0xffff)*t>>8,u=((t*t>>19)&0xffff)*t>>9,p=u^y,(p>>4)^(p>>8) | R: (p>>5)^(p>>9)
Long:
L: y=((t*t>>20)&0xffff)*t>>8,u=((t*t>>19)&0xffff)*t>>9,p=u^y,(p>>4)^(p>>8) | R: (p>>5)^(p>>9)
All right. Today I made my first real Bytebeat creation:
Für Elise
It features a repeating pattern, a sine wave synth and an envelope, using techniques I picked up from some examples much earlier in this topic. I'm quite pleased with it. Right now it is 244b(not counting comments, spaces and newlines), but of course, it should be trivial to minify this much further since much of the pattern is repeated.
Für Elise
It features a repeating pattern, a sine wave synth and an envelope, using techniques I picked up from some examples much earlier in this topic. I'm quite pleased with it. Right now it is 244b(not counting comments, spaces and newlines), but of course, it should be trivial to minify this much further since much of the pattern is repeated.
I might be cheating a little bit. Let's hope my bbcode works! Here's my first composition:
((((Math.sqrt(t%16384)<<5)&64)*[1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1][(t>>14)%32]>>1 | ((t*[22, -14, 108, 2, -80, -99, 62, -62, -11, -127, -102, -80, -114, -66, -2, 68, -63, -101, 0, -13, 37, 55, 104, 61, 125, 101, -54, 60, -91, -102, -127, 17, 26, -23, -97, 80, 43, -77, 117, -71, 66, -59, 30, -86, 111, 112, 65, -49, 85, -95, 38, 27, -39, 80, 94, 44, 20, 116, 36, -74, -106, -57, 57, 96, -37, 39, -72, 21, -80, 121, -127, 88, -84, 54, 120, -6, -94, 41, -41, -22][t%77])&58)*[0,0,1,0,0,0,1,0][(t>>14)%8] | ((((t*(5<<t)/5))*([16,4,7,12,8]["01234234"[(t>>13)&7]&17]))/([6,5,8,12][(t>>17)%4])&16512)>>2))
((((Math.sqrt(t%16384)<<5)&64)*[1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1][(t>>14)%32]>>1 | ((t*[22, -14, 108, 2, -80, -99, 62, -62, -11, -127, -102, -80, -114, -66, -2, 68, -63, -101, 0, -13, 37, 55, 104, 61, 125, 101, -54, 60, -91, -102, -127, 17, 26, -23, -97, 80, 43, -77, 117, -71, 66, -59, 30, -86, 111, 112, 65, -49, 85, -95, 38, 27, -39, 80, 94, 44, 20, 116, 36, -74, -106, -57, 57, 96, -37, 39, -72, 21, -80, 121, -127, 88, -84, 54, 120, -6, -94, 41, -41, -22][t%77])&58)*[0,0,1,0,0,0,1,0][(t>>14)%8] | ((((t*(5<<t)/5))*([16,4,7,12,8]["01234234"[(t>>13)&7]&17]))/([6,5,8,12][(t>>17)%4])&16512)>>2))
clone45: good job! I love the crazy high-pitched pulse waves. And of course the acid sqrt bass always works.
Today I went ahead and implemented a Low-Pass Filter using Floatbeat.
It's a work-in-progress though, since I don't yet know how to do Amplitude-Rescaling. (the sound now quickly becomes inaudible when increasing the effect).
Also made the High-pass variant, by the way.
Today I went ahead and implemented a Low-Pass Filter using Floatbeat.
It's a work-in-progress though, since I don't yet know how to do Amplitude-Rescaling. (the sound now quickly becomes inaudible when increasing the effect).
Also made the High-pass variant, by the way.