PDA

View Full Version : welp, here goes nothing


unchained
13th November 2001, 23:45
This preset is the result of many days of thought and effort. I'm sure many of you won't like it, as it tends to be jerky. It runs at a solid 23FPS on my system, so those of you with higher-end machines should have no trouble with it. Fair warning, it's very much a work-in-progress, but I'm proud of what I've done so far.

This is my first shot at a "real" BPM detection, and if you look at it with that in mind, I think that you'll probably agree with the friend that I just showed it to, that it's about 50% beat-driven and 50% random motion. What makes it unique compared to other BPM schemes that I've seen is that it will NOT lose the beat, no matter how fast it changes. If anybody out there mathematically minded can at least TRY to figure out what I'm doing, and offer advice and/or criticism, I'd be glad to hear it, and I'm more than willing to explain what/why I'm doing what I'm doing.

The per_pixel stuff is another ball of wax entirely. My aim was to generate effects based entirely on the BPM information generated by the per_frame code, rather than trying to do any specific "draw a box, shift from left-to-right" type motions. Again, this leads to a rather jerky and seemingly random motion, but this is my best attempt at getting MD to show you what the music "looks like". I used a LOT of information-theoretic logic in compressing/optimizing the code (It originally took up about 70 lines and ran at 7FPS for the same effect) and would probably be difficult for me to explain to anybody not at least a little bit knowledgable in those areas, though I can give a hint that if you want to play with it a bit, the power I'm raising the x, y, and rad variables to is the number of beat-patterns I'm tracking at any given time. It doesn't use any "geometry" as I know it whatsoever, my use of sin/cos is based entirely upon their Euler-expansions, although if somebody like Krash wants to try to figure out what the hell I'm doing and show it to me on a graph I'd *LOVE* to see it. Again, I'm more-than-willing to go into the details of what I'm doing if anybody out there understands the rudiments.

Well, I've babbled and built it up enough, here it is...my baby :)

===============
Proof of Poison
===============
[preset00]
fRating=4.000000
fGammaAdj=2.000000
fDecay=0.986000
fVideoEchoZoom=1.006442
fVideoEchoAlpha=0.500000
nVideoEchoOrientation=3
nWaveMode=1
bAdditiveWaves=1
bWaveDots=0
bModWaveAlphaByVolume=0
bMaximizeWaveColor=0
bTexWrap=0
bDarkenCenter=0
bMotionVectorsOn=0
bRedBlueStereo=0
nMotionVectorsX=12
nMotionVectorsY=9
bBrighten=0
bDarken=1
bSolarize=0
bInvert=0
fWaveAlpha=1.868299
fWaveScale=1.136001
fWaveSmoothing=0.540000
fWaveParam=0.200000
fModWaveAlphaStart=0.950000
fModWaveAlphaEnd=0.750000
fWarpAnimSpeed=1.000000
fWarpScale=1.000000
fZoomExponent=1.008151
fShader=0.200000
zoom=0.999800
rot=0.000000
cx=0.470000
cy=0.500000
dx=0.000000
dy=0.000000
warp=0.010000
sx=1.000000
sy=1.000000
wave_r=0.500000
wave_g=0.500000
wave_b=0.500000
wave_x=0.500000
wave_y=0.500000
ob_size=0.000000
ob_r=0.000000
ob_g=0.000000
ob_b=0.000000
ob_a=0.000000
ib_size=0.000000
ib_r=0.250000
ib_g=0.250000
ib_b=0.250000
ib_a=0.000000
per_frame_1=warp=0;
per_frame_2=old_bass_flop=bass_flop;
per_frame_3=old_treb_flop=treb_flop;
per_frame_4=old_mid_flop=mid_flop;
per_frame_5=chaos=bnot(pulse)*(.5+.5*sin(pulse));
per_frame_6=bass_thresh = above(bass_att,bass_thresh)*2 + (1-above(bass_att,bass_thresh))*((bass_thresh-1.3)*chaos+1.3);
per_frame_7=bass_flop=abs(bass_flop-equal(bass_thresh,2));
per_frame_8=treb_thresh=above(treb_att,treb_thresh)*2 + (1-above(treb_att,treb_thresh))*((treb_thresh-1.3)*chaos+1.3);
per_frame_9=treb_flop=abs(treb_flop-equal(treb_thresh,2));
per_frame_10=mid_thresh=above(mid_att,mid_thresh)*2 + (1-above(mid_att,mid_thresh))*((mid_thresh-1.3)*chaos+1.3);
per_frame_11=mid_flop=abs(mid_flop-equal(mid_thresh,2));
per_frame_12=bass_changed=bnot(equal(old_bass_flop,bass_flop));
per_frame_13=mid_changed=bnot(equal(old_mid_flop,mid_flop));
per_frame_14=treb_changed=bnot(equal(old_treb_flop,treb_flop));
per_frame_15=pulse=if(above(abs(pulse),5000),-5000,pulse+mid_att*sin(time*.21)*bor(bor(bass_changed*bnot(treb_changed),treb_changed*bnot(bass_changed))*bnot(mid_changed),mid_changed));
per_frame_16=effect_1=1+1*mid_flop*bass_flop*treb_flop;
per_frame_17=effect_2=1+2*treb_flop*above(sin(pulse),0);
per_frame_18=effect_3=1+4*bass_flop*below(sin(pulse),0);
per_frame_19=effect_4=1+6*bnot(treb_changed)*bass_flop;
per_frame_20=effect_5=1+10*bor(treb_flop,bass_flop)*bnot(mid_changed)*below(sin(pulse),0);
per_frame_21=q1=effect_1*effect_2*effect_3*effect_4*effect_5;
per_frame_22=q2=time*q1;
per_frame_23=q3=sin(pulse);
per_frame_24=q4=sin(q2*.004);
per_frame_25=wave_b=if(treb_changed,1,if(mid_flop,.5,-.5)*q3);
per_frame_26=wave_g=if(bass_flop,0,treb_flop/2+.5*q4);
per_frame_27=wave_r=if(mid_flop,1,.5*q4*treb_flop);
per_frame_28=zoom_fade=if(above(q3,0),if(above(q4,0),zoom_fade-.005*mid_att,zoom_fade+.005*mid_att),1);
per_frame_29=zoom=zoom_fade;
per_frame_30=ob_r=abs(wave_b-1);
per_frame_31=ob_g=abs(wave_r-1);
per_frame_32=ob_b=abs(wave_g-1);
per_frame_33=ob_a=.09+.05*q3;
per_frame_34=ob_size=.01+.009*q4;
per_frame_35=decay=.982+.01*q3*q4;
per_pixel_1=g1=sin(q2+time*.05);
per_pixel_2=g2=sin(q2+time*.04);
per_pixel_3=g3=sin(q2+time*.03);
per_pixel_4=x_shift=pow(x,5)+x*g1+sqr(g1);
per_pixel_5=y_shift=pow(y,5)+y*g2+sqr(g2);
per_pixel_6=r_shift=pow(rad,5)+rad*g3+sqr(g3);
per_pixel_7=dx=sin(x_shift+y_shift+r_shift)*g1*.1;
per_pixel_8=dy=if(above(q4,0),dx,cos(x_shift+y_shift+r_shift)*g2*.1);
per_pixel_9=rot=if(above(sin(q2*.003),0),0,rot+.1*min(q3,abs(1-dx))*sign(g3));

PS: Don't be afraid to cut up on it. As I said already, I'm sure it's not they type of thing the majority of y'all will like, but I appreciate knowing that somebody's at least looking at it, after all of the effort I put in to writing it. :) Ouch my hand hurts.

--
unchained
(love me)

Rovastar
14th November 2001, 00:36
Very nice unchained a loads going on there. I am impressed. I have been looking at it for the last 10 minutes.

One thing your BPM info is all in there but would it be possible for you to put this BPM code in a more simple preset. Like my 1 or 2 liners where not much happens so I could study it in more detail. I know it is difficult but I cannot really see how reponsive it is.

And don't SM, Illusion or anyone expect me to right I guide as to how to write a preset like this!!!!!!!

unchained
14th November 2001, 02:28
I'm passing what I call the "state variable" as q1. This variable is determined by assigning a prime number to each effect, as I've done in other "beat-driven" presets. There's quite a combination of things going on, so I'll try to explain by a simplified example:


effect_1=1+1*above(treb_att,1.3);


This will be 2 (the first prime number) if the treb_att went beyond the threshold value (1.3), and one otherwise.


effect_2=1+2*above(bass_att,1.3);


In the same way, this will be 3 (again a prime) if the bass_att hits its threshold value, and one otherwise.


q1=effect_1*effect_2;


We've now combined 2 pieces of state information into one variable, and we could do something like this.


zoom=if(equal(q1%2,0),.99,1.1);


Or, in human-readable form "If the state variable is evenly divisable by 2 (the prime we assigned for the treb effect) zoom out, otherwise zoom in."

Likewise


zoom=if(equal(q1%6,0 ),.99,1.1 );


will zoom out if BOTH the treb_att and bass_att are above the threshold during that frame, since the state variable will be evenly divisable by 6 (the least-common-multiple of 2 and 3, the primes we assigned to our effects).

If you have a lot of different effects (each with their own prime number) you can also do interesting things like


dx=sin(ang*(q1%9));


where q1%9 will generate a number from 0 to 8 (because in division the remainder, if any, is always less than the divisor).

or


zoom=zoom+.1*sin(time*q1*.1);
[CODE]

which in effect sets a different timer for each possible value of q1, but be careful as q1 can get quite high if you add more and more effects that might happen at the same time.

Also, as a shortcut, I often do something like:

[CODE]
zoom=zoom + .1 * bnot(q1%3);


Which would yield 1.1 if the bass changed in the above example, because bnot(x) gives a value of 1 if x = 0, and 1 otherwise.

Note that this is NOT what I'm doing with the state variable in this particular preset, but it's what most of my recent ones do, but if you get rid of my per_pixel stuff and write your own, you can use q1 in this manner. This one's pretty ugly to use as an example, because I also make heavy use of my "pulse" variable, which is part of a somewhat complicated feedback mechanism that I use to drive the thresholds, and thus the beat detection, but if you want to play around with it, all you really need to know is that the bass_changed, etc variables will be 1 if the the threshold was passed FOR THAT FRAME ONLY, whereas bass_flop, etc will toggle between 0 and 1 with every beat. Pulse can be used more or less as a drop-in replacement for time, as in


rot=.1 * sin(pulse)


but like I said, the pulse value is somewhat complicated, and probably won't do exactly what you want.

I hope that explained what I'm doing at least a little bit.

unchained
14th November 2001, 07:12
Here's a slightly "toned down" version using the same engine. I'm not tracking nearly as many patterns at once here, so it's not as jerky, but it's not quite as good at keeping up with the acidic stuff I listen to. :) I also turned off the alpha echo, so you can see what's going on a bit better.

Illusion
14th November 2001, 10:10
Don't worry Rovastar, I'll be here for about the next 8 hours trying to even understand half of it, don't need to worry about explaining this one.. haha :)

And nice work unchained.. roused from slumber runs great on my machine, and the beat detections is excellent. Well done.

Ultima
14th November 2001, 10:55
Wow! Seems to do pretty well on simpler beats. I'm really impressed!