# pouët.net

## Experimental music from very short C programs (now with Amen break)

category: offtopic [glöplog]
Bleepy amen.
S(t & ~(t>>8))
Thanks :-)

I thought the use of hilbert transforms for frequency shifts was pretty obvious (when starting with a complex function with audio signal being the real component and its hilbert transformed version being the imaginary component).

More stuff follows:

Timestretching: i=256,f=function(t){return t+sin(t*.00005)*10000+sin(sin(t)*t)*30},u=t%i,S(u+f(t-u))*(1-u/i)+S(u-i+f(t-u+i) )*u/i

Frequency stretching: i=512,s=80000,g=function(t){t/=s;t=Math.tan((t-floor(t)-.5)*Math.PI/2)*.5+.5+flo or(t);return t*=s},f=function(t){t/=s;t=atan((t-floor(t))*2-1)/(Math.PI/2)+.5+floor(t);return t*s+sin(sin(t)*t)*50;},t=g(t),u=t%i,S(u+f(t-u))*(1-u/i)+S(u-i+f(t-u+i))*u/i

i is interval length, f is the timebase function. The sin(sin(t)*t)*30 is a kind of randomness factor to reduce the flanger-like artifacts. The remainder blends 2 intervals together each.

Frequency stretching is basically timestretching with a tempo changing function that's undone by the timestretching function, leaving just the frequency changes. That's why it's so much longer as there's no inverse for t+sin(t)*.5 so I had to construct a function that has an inverse (here: the central piece of atan).
added on the 2012-08-15 16:48:41 by Kabuto
any idea for implementing a simple low / high pass filter ? i have one simple way to do it in mind but it requires having some global vars which is not possible here
added on the 2012-08-15 16:55:49 by Tigrou
@Tigrou: you can use global vars. Just write window.x instead of x. (Or shorter: self.x) Example: self.f=(self.f||0)*.9+S(t)*.1,self.f

Another frequency stretcher: i=512,s=80000,n=Math.tan(cos(t>>14)*.5+.7),f=function(t){return t*n+sin(sin(t)*t)*30;},t/=n,u=t%i,S(u+f(t-u))*(1-u/i)+S(u-i+f(t-u+i))*u/i
added on the 2012-08-15 17:14:26 by Kabuto
Simple low-pass filter:
(S(t) + S(t+1))/2
added on the 2012-08-16 12:48:42 by FreeFull
added on the 2012-08-16 12:55:27 by FreeFull
added on the 2012-08-16 14:32:50 by Kabuto
added on the 2012-08-16 17:12:06 by cruzer