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
added on the 2012-08-14 11:27:17 by d0DgE d0DgE
Almost like schranz (except not really :D).

Sorry Gasman... :(
added on the 2012-08-14 11:49:36 by Tomoya Tomoya
And of course I posted the wrong link, here's the correct one: click!
added on the 2012-08-14 11:50:59 by Tomoya Tomoya
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?
added on the 2012-08-14 14:06:47 by gasman gasman
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:


This creates a complex signal first by doing a (cheap) 90° phase shift and using that as imaginary component.


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.


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.
added on the 2012-08-14 14:13:04 by Kabuto Kabuto
@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.
added on the 2012-08-14 15:18:34 by ment ment
Kabuto: Awesome
added on the 2012-08-14 15:39:40 by noby noby
@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.
added on the 2012-08-14 16:16:26 by Kabuto Kabuto
@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.
added on the 2012-08-14 17:01:03 by Kabuto Kabuto

RESPECT! What you did is awesome. Doing a crude hilbert-transform to do frequency shift has been an awesome idea..

I * am * impressed
added on the 2012-08-14 22:36:22 by torus torus
My DSP-heart jumps up and down in joy!
added on the 2012-08-14 22:50:59 by torus torus
What Torus said.
added on the 2012-08-15 04:52:55 by trc_wm trc_wm
whoa :O
added on the 2012-08-15 06:25:25 by shuffle2 shuffle2
:D. Good to see this thing is still kickin!
added on the 2012-08-15 09:43:13 by raer raer
@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)
added on the 2012-08-15 11:00:23 by ment ment
I have no idea what I'm doing
added on the 2012-08-15 11:16:48 by botjao botjao
Super awesome, why didn't you use a clean amen break tho? this one has a bassnote on the one?
I think it could be nice to to try another sample.
TR-808 sounds for example give tons of possibilities and it is as popular as the amen break.

example : sample1 or sample2
added on the 2012-08-15 13:32:07 by Tigrou Tigrou