Experimental music from very short C programs

category: code [glöplog]
#countercomplex @ IRCnet is there for more immediate collaboration!
Whoa that's nice :D
Very annoying horrorfilm soundtrack :)
kind of green beret (cpc version) rhythm
sample rate 8000
(1/t&0x1^t/99>>2/t)+(661110&t>>1/2)/0.1*(t/(16*sin(t/600)^3) >>t/160)
recharging some kind of lazer-weapon: (t*0.1)*cos(t*.002)
added on the 2011-10-03 23:27:49 by rudi rudi
HeLLoWorld: lol at your horror film soundtrack :)
added on the 2011-10-03 23:55:02 by xpansive xpansive
For some reason (I guess 8khz is interpolated poorly), multiplying t by 80/441 and sampling at 44.1khz improves the quality of every example I tried immensly without changing the character of the sound.

I would think the the 8khz and the strecthed 44.1khz musix would sound absolutely identical.
added on the 2011-10-04 00:57:25 by QUINTIX QUINTIX
QUINTIX: Bad interpolation might be a part of it. 44100/8000=5.5125, which is not a very nice round number. But this would mainly manifest itself in aliasing artifacts, i.e. extra harmonics.

What you're hearing is more likely the Nyquist filter used when upsampling. Per the Nyquist theorem, audio sampled at 8 kHz can't contain frequencies above 4 kHz. So in the upsampling process, the audio is low-passed at 4 kHz. This may be unwanted for oneliners, but a natural sound would sound slightly distorted without this filter.

Then there's of course possible that there's some aliasing in the actual generation of the sound, in particular when it comes to the oh so popular bitwise operations which only work on integers. For example, if your 8 kHz audio stream would output the two samples 1,2 your multiplied audio stream might contain 1,1,1,1,1,1,2,2,2,2,2 i.e. 6*1 and 5*2. (The ratio is ~5.5 so two samples must be converted to approximately 11 samples.) You might hear this as a minor change of timbre in the sound.
added on the 2011-10-04 02:25:51 by nitro2k01 nitro2k01
Here's a really nice one: it has many layers (well, 8) of overlapping patterns, with the tempo of each pattern going up by powers of 2, but also the amplitude goes down as the tempo goes up, so you can't hear the fastest ones. There's also a hard-sync sort of effect to keep it interesting.
added on the 2011-10-04 03:50:50 by zdubs zdubs
Here's a couple variations: the first sounds like LFO weirdness, the second more like a melody.(t<<2|t<<(t>>10))*(t>>6&t>>11)
added on the 2011-10-04 04:17:58 by zdubs zdubs
just the bassline, for reference:
i'm not sure if the shift-register-as-step-sequencer violates the spirit of the whole thing, but making it a bit more controllable seems like a good move overall.
added on the 2011-10-04 10:09:57 by ryg ryg
A nice riff, somehow sounds like string instruments, with a metallic triangle
That one, would totally fit in some dramatic 1ko demo O_o
That one and the one I posted just before have the same pattern, just different parameters. Change the constants, and you'll get many nice tunes. I found maybe ten cool ones with that line.
t*(t>>((t&4096)?((t*t)/4096):(t/4096)))|(t<<(t/256))|(t>>4 )

Reminds me a bit about the music for a C64 game, can't remember which at the moment...
added on the 2011-10-04 14:42:42 by skurk skurk
The shift register trick is a good one, here, have some chip arpeggio that eats itself:

(((t>>1)*(15&(0x234568a0>>((t>>8)&28))))|((t>>1) >>(t>>11))^(t>>12))+((t>>4)&(t&24))
added on the 2011-10-04 15:06:03 by kb_ kb_
great, kb_ :)
added on the 2011-10-04 15:29:01 by Hyde Hyde
These are amazing and inspired me to make a jeskola buzz generator to do the same thing. I guess a musician could play with adding small effects to the sounds for a 4k or such if you can fit it in, but mainly it's because I like droning noises....

Anyway, you can find an alpha version here: http://www.buzzchurch.com/viewtopic.php?t=8150