Experimental music from very short C programs (now with Amen break)
category: offtopic [glöplog]
@knoeki: and yet you (and Gasman) show instant Jungleism *BUK'EM BUK'EM* :D
And of course I posted the wrong link, here's the correct one: click!
walla walla bing bang
chiptune version
double whammy (inspired by this lovely thing by Cassetteboy)
Tried to do a swing version (timestretching/contracting alternate beats)... can't make it work. Anyone up for the challenge?
chiptune version
double whammy (inspired by this lovely thing by Cassetteboy)
Tried to do a swing version (timestretching/contracting alternate beats)... can't make it work. Anyone up for the challenge?
Lots of sound variations: sh=t>>14^t>>15,tf=1-sh%5*.4,fs=(sh%3-1)*.1,t^=t>>12<<11,d=(S(t+1)+S(t+3)/3+S(t+5)/5+S(t+7)/7-S(t-1)-S(t-3)/3-S(t-5)/5-S(t-7)/7)*.7,atan((S(t)*cos(fs*t)+d*sin(fs*t))*Math.pow((S(t)*S(t)+d*d)/2000,tf/2)*.004)*81
Short explanation:
d=(S(t+1)+S(t+3)/3+S(t+5)/5+S(t+7)/7-S(t-1)-S(t-3)/3-S(t-5)/5-S(t-7)/7)*.7
This creates a complex signal first by doing a (cheap) 90° phase shift and using that as imaginary component.
sh=t>>14^t>>15
fs=(sh%3-1)*.1
(S(t)*cos(fs*t)+d*sin(fs*t))
One interesting property of such a complex sound signal is that by multiplying it with a complex sine wave one gets a frequency shift, either up or down (not both at once as one gets when simply multiplying the original signal with a sine wave). This is what happens here, fs is either -.1, 0 or .1 and thus shifts the frequency spectrum.
sh=t>>14^t>>15
tf=1-sh%5*.4
...*Math.pow((S(t)*S(t)+d*d)/2000,tf/2)
This is a kind of compressor. It stretches or compresses the amplitude of the complex signal. tf = 0 -> original signal, tf = 1 -> heavily stretched (thin sound), -1 = compressed to the max (everything at maximum volume), -0.6 (the minimum value used here) = rather fat sound.
Short explanation:
d=(S(t+1)+S(t+3)/3+S(t+5)/5+S(t+7)/7-S(t-1)-S(t-3)/3-S(t-5)/5-S(t-7)/7)*.7
This creates a complex signal first by doing a (cheap) 90° phase shift and using that as imaginary component.
sh=t>>14^t>>15
fs=(sh%3-1)*.1
(S(t)*cos(fs*t)+d*sin(fs*t))
One interesting property of such a complex sound signal is that by multiplying it with a complex sine wave one gets a frequency shift, either up or down (not both at once as one gets when simply multiplying the original signal with a sine wave). This is what happens here, fs is either -.1, 0 or .1 and thus shifts the frequency spectrum.
sh=t>>14^t>>15
tf=1-sh%5*.4
...*Math.pow((S(t)*S(t)+d*d)/2000,tf/2)
This is a kind of compressor. It stretches or compresses the amplitude of the complex signal. tf = 0 -> original signal, tf = 1 -> heavily stretched (thin sound), -1 = compressed to the max (everything at maximum volume), -0.6 (the minimum value used here) = rather fat sound.
The sample in my previous post was a bit too silent. Here's a louder version: sh=t>>14^t>>15,tf=1-sh%5*.4,fs=(sh%3-1)*.1,t^=t>>12<<11,d=(S(t+1)+S(t+3)/3+S(t+5)/5+S(t+7)/7-S(t-1)-S(t-3)/3-S(t-5)/5-S(t-7)/7)*.7,atan((S(t)*cos(fs*t)+d*sin(fs*t))*Math.pow((S(t)*S(t)+d*d)/2000,tf/2)*.004)*81
Fail on my behalf. I somehow still got the wrong one in my clipboard. This time the correct version (double-checked :-) ): sh=t>>14^t>>15,tf=1-sh%5*.4,fs=(sh%3-1)*.1,t^=t>>12<<11,d=(S(t+1)+S(t+3)/3+S(t+5)/5+S(t+7)/7-S(t-1)-S(t-3)/3-S(t-5)/5-S(t-7)/7)*.7,atan((S(t)*cos(fs*t)+d*sin(fs*t))*Math.pow((S(t)*S(t)+d*d)/2000,tf/2)*.02)*81
@Kabuto: how do you do the phase shift? the S(t+1)+S(t+3)/3... that's some kind of numerical integrator?
As for the compressor, that looks just like ordinary wave-shaping (it doesn't take into account any other sample than the current). Or did I miss something?
As for the previous stupid-bass-chords oneliner - function(a){r=cos(...);... return sin(p(r*s,...)*s)} - the sin() acts purely as a limiter or does it have any other function? And the f(0)+f(7)+f(14) ... that's a really good trick to get both minor and major chords!
Anyway, great work.
As for the compressor, that looks just like ordinary wave-shaping (it doesn't take into account any other sample than the current). Or did I miss something?
As for the previous stupid-bass-chords oneliner - function(a){r=cos(...);... return sin(p(r*s,...)*s)} - the sin() acts purely as a limiter or does it have any other function? And the f(0)+f(7)+f(14) ... that's a really good trick to get both minor and major chords!
Anyway, great work.
Kabuto: Awesome
@ment (and whoever else is interested in the gory details :-)):
This S(t+1)+S(t+3)/3... thing is a convolution that rotates the phase of all frequencies at once, i.e. sin(f*t) becomes cos(f*t), cos(f*t) becomes -sin(f*t). This series should in theory go on infinitely but that would make sample generation too long. The scale factor 0.7 is also not the real thing - for this coarse approximation it fits good enough but the real scale factor should be pi/4.
The compressor takes the current sample - and the phase-shifted version. So it also considers a few neighbour samples.
I'll disassemble the stupid-chords oneliner for everyone.
Let's start with the end:
atan(...)*81 avoids clipping. As ... I use:
S(t)+(f(0)+f(7)+f(14))*20)*.1 f is the synthesizer function, I use 3 voices, added to the amen loop. The previous
n=S(t>>14)&127%24 picks amen loop samples and uses these as bass notes for the synth func. The sync func combines n (base note) and its parameter a (note offset) using:
((n+a)>>1), thus, depending on n being odd or even, giving actual note offsets of 0,4,7 (major chord) or 0,3,7 (minor chord) for the 3 paramter values 0,7,14. Next step is to convert note to frequency, that's done with:
p(2, .../12-4) where p is a short-hand for Math.pow here. Then I do a simple
cos(...*t) around that to get a simple sine wave. But sines sound a bit boring. The synthesizer first scales the wave with
...*1.15, then computes the sign (so the power function to follow doesn't have to handle negative values):
s = r<0?-1:1 followed by the power function itself, now having to deal with non-negative values only:
p(r*s, ...)*s ... is the power, valuse from 0 (rect), 1 (almost sine), 2 (few harmonics) up to 15 (lots of harmonics) are used, computed from the time using
(t>>10^(3*(t>>11)))%16 And finally there's a
sin(...) around the power function's result. Remember that the original sine wave was scaled with 1.15, so with increasing power this increases as well, for 15 we get a value of about 8. The sin around that converts the sharp peaks to sharp ripples which are the cause of those many harmonics.
That's it for the stupid chords. The horribly-sounding ones are similar except that they use a different formula for the chords which yields tritonus-like stuff.
This S(t+1)+S(t+3)/3... thing is a convolution that rotates the phase of all frequencies at once, i.e. sin(f*t) becomes cos(f*t), cos(f*t) becomes -sin(f*t). This series should in theory go on infinitely but that would make sample generation too long. The scale factor 0.7 is also not the real thing - for this coarse approximation it fits good enough but the real scale factor should be pi/4.
The compressor takes the current sample - and the phase-shifted version. So it also considers a few neighbour samples.
I'll disassemble the stupid-chords oneliner for everyone.
Let's start with the end:
atan(...)*81 avoids clipping. As ... I use:
S(t)+(f(0)+f(7)+f(14))*20)*.1 f is the synthesizer function, I use 3 voices, added to the amen loop. The previous
n=S(t>>14)&127%24 picks amen loop samples and uses these as bass notes for the synth func. The sync func combines n (base note) and its parameter a (note offset) using:
((n+a)>>1), thus, depending on n being odd or even, giving actual note offsets of 0,4,7 (major chord) or 0,3,7 (minor chord) for the 3 paramter values 0,7,14. Next step is to convert note to frequency, that's done with:
p(2, .../12-4) where p is a short-hand for Math.pow here. Then I do a simple
cos(...*t) around that to get a simple sine wave. But sines sound a bit boring. The synthesizer first scales the wave with
...*1.15, then computes the sign (so the power function to follow doesn't have to handle negative values):
s = r<0?-1:1 followed by the power function itself, now having to deal with non-negative values only:
p(r*s, ...)*s ... is the power, valuse from 0 (rect), 1 (almost sine), 2 (few harmonics) up to 15 (lots of harmonics) are used, computed from the time using
(t>>10^(3*(t>>11)))%16 And finally there's a
sin(...) around the power function's result. Remember that the original sine wave was scaled with 1.15, so with increasing power this increases as well, for 15 we get a value of about 8. The sin around that converts the sharp peaks to sharp ripples which are the cause of those many harmonics.
That's it for the stupid chords. The horribly-sounding ones are similar except that they use a different formula for the chords which yields tritonus-like stuff.
@ment: I thought again about the compressor. It's a bit like wave-shaping, just with the special property that it never causes distortions when fed with a single sine wave (just volume change). That's of course only true if the phase shift works perfectly as in theory on an infinite number of samples.
Amen waltz: S(t%(3<<12)^t*4/3&-1<<14)
kambuto!
RESPECT! What you did is awesome. Doing a crude hilbert-transform to do frequency shift has been an awesome idea..
I * am * impressed
RESPECT! What you did is awesome. Doing a crude hilbert-transform to do frequency shift has been an awesome idea..
I * am * impressed
My DSP-heart jumps up and down in joy!
What Torus said.
whoa :O
:D. Good to see this thing is still kickin!
@Kabuto: thanks for the explanation!
I had no idea what could be hilbert transform good for :-) I was trying to replace that formula with simple numerical integrator, not realizing that the cos/sins would come out scaled (\int cos(2x) -> sin(2x)/2)
I had no idea what could be hilbert transform good for :-) I was trying to replace that formula with simple numerical integrator, not realizing that the cos/sins would come out scaled (\int cos(2x) -> sin(2x)/2)
S(t)|t>>4
I have no idea what I'm doing
I have no idea what I'm doing
Super awesome, why didn't you use a clean amen break tho? this one has a bassnote on the one?