Experimental music from very short C programs (now with Amen break)
category: offtopic [glöplog]
Bleepy amen.
S(t & ~(t>>8))
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+floor(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).
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+floor(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).
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
@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
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
Simple low-pass filter:
(S(t) + S(t+1))/2
(S(t) + S(t+1))/2
Spin up:
S(t*(t/10)>>16)
S(t*(t/10)>>16)
Amen break getting faster and faster blended to itself in an endless loop (doesn't seem to work well with amen break) l=65536*4,d=l*Math.log(2),t%=d,i=256,f=function(t){return Math.pow(2,t/d)*d/Math.log(2)+sin(sin(t)*t)*30},u=t%i,(S(u+f(t-u)*.5)*(1-u/i)+S(u-i+f(t-u+i)*.5 )*u/i)*Math.pow(t/d,.5)+(S(u+f(t-u))*(1-u/i)+S(u-i+f(t-u+i))*u/i)*Math.pow(1-t/d,.5)
Turn up da speakers.
((cos((t&4095)*3.14/11000)*(t*8-9999))&0x7f)+S(t/2)*6
((cos((t&4095)*3.14/11000)*(t*8-9999))&0x7f)+S(t/2)*6