- AVS
- Superscope: 'v' variable in frame code
Archive: Superscope: 'v' variable in frame code
z33m
16th June 2013 21:50 UTC
Superscope: 'v' variable in frame code
Hi,
Im trying to figure out how some of the superscope codes work. Im checking
"Marco - science of superscope" preset from classic winamp presets list.
here is the code:
init: n=800
frame: t=t-v*0.5
beat: t=t+0.3;n=100+rand(900);
point: d=D/n;r=(i-(t*3));
x=(atan(r+d-t)*cos(r+d-t+i));
y=((i+cos(d+v*1.2))-1.5)*1.7;
z=-(cos(t+i)+log(v)*cos(r*3))*3;
red=cos(r)+1;
blue=sin(r);
green=sin(i)/2
Here,
- what does the value of variable 'v' hold inside the frame section? I know it holds the spectrum data at point 'i' inside the point section, but what does it mean in the frame section?
- what is the variable 'D'?
- does the z variable actually do anything?
QOAL
16th June 2013 22:53 UTC
Open the (Settings -> )debug window and add reg00 = var; then you can watch the value, and see if it does anything. (reg goes from 00 to 99)
1:
I will take a guess at v being the same as i=0 at that point as it's ran before the point section.
In fact it does.
frame:
reg00 = v;
point:
reg01 = if(equal(i, 0), v, reg01);
Both reg00 and reg01 show the same value.
I am an idiot and it's too late to be thinking. The code I tested was wrong, which I've now amended and it looks like they're different values. It's not equal to i=1 either.
2: Variables aren't case sensitive. (I can't remember if I knew that :))
Example: D=1; d=0; reg02=D; (this will show 0)
3: Doesn't look like it, nope.
InCUbuS-94
16th June 2013 23:54 UTC
Well, "V" in this case is used to change the speed of the scope, and it's excecuted every frame, stating the obvious.
Z is useless, so go ahead, annihilate it.
It's 1 A.M. here and I'm tired, so my answer may not be what you're seeking.
z33m
17th June 2013 07:25 UTC
Originally posted by QOAL
Open the (Settings -> )debug window and add reg00 = var; then you can watch the value, and see if it does anything. (reg goes from 00 to 99)
1:
I will take a guess at v being the same as i=0 at that point as it's ran before the point section.
In fact it does.
frame:
reg00 = v;
point:
reg01 = if(equal(i, 0), v, reg01);
Both reg00 and reg01 show the same value.
I am an idiot and it's too late to be thinking. The code I tested was wrong, which I've now amended and it looks like they're different values. It's not equal to i=1 either.
2: Variables aren't case sensitive. (I can't remember if I knew that :))
Example: D=1; d=0; reg02=D; (this will show 0)
3: Doesn't look like it, nope.
Thanks, didnt know how to use the debugger. This is really useful. still dont understand what v in frame code does. if i remove it the scope moves more uniformly and looks different.
Also the d=D/n; code doesnt do anything either since D was never initialized, will always be zero (im assuming this is the case, the debugger confirms: uninitialized variables are 0)
Originally posted by InCUbuS-94
Well, "V" in this case is used to change the speed of the scope, and it's excecuted every frame, stating the obvious.
Z is useless, so go ahead, annihilate it.
It's 1 A.M. here and I'm tired, so my answer may not be what you're seeking.
how does it control the speed? what values is assigned to it? is 'v' something provided internally by the Superscope?
InCUbuS-94
17th June 2013 10:12 UTC
Using 'v' should be the same as using the getosc(), the only difference is that with the getosc function you can control more parameters (that is: band, width or channel)
For example:
POINT
x=i*2-1;
y=v*0.5
is the same as
POINT
x=i*2-1;
y=getosc(i,0.0,0)*0.5
That being said, with "control the speed" I mean you use a variable, called 't', where its value depends on 'v', and you use it on the point section to change the speed of the scope. It all depends where you put the 't'.
z33m
17th June 2013 18:20 UTC
I think value of 'v' maintains the last assigned value. ie. 'v' in frame section will be equal to last 'v' from the point section ie. when i = 1. I tried the following code
init: n=800
frame: t=t-v*0.5;
reg01 = if(equal(reg00, v), 1, 0);
beat: t=t+0.3;n=100+rand(900);
point: d=D/n;r=(i-(t*3));
x=(atan(r+d-t)*cos(r+d-t+i));
y=((i+cos(d+v*1.2))-1.5)*1.7;
z=-(cos(t+i)+log(v)*cos(r*3))*3;
red=cos(r)+1;
blue=sin(r);
green=sin(i)/2
reg00 = v;
and reg01 shows up as 1 in the debug window.
InCUbuS-94
17th June 2013 18:51 UTC
Ugh, that if statement is superfluous, at least use this
reg01=equal(reg00,v)
Warrior of the Light
17th June 2013 19:42 UTC
No need for debugging, the answer is rather low-tech.
When that preset was created, we didn't have a rand() function yet (AVS 2.5). We used the audio to generate random values.
In this case I assume (as I don't have the preset installed here) that v is used as a waveform and varies between -1 and 1. That means that t increases or decreases with that value. Today you'd have used something like t=t-(100-rand(200))*.005;
D and z are normal variables with no special meaning in a ssc
Looking more closely, d is never really used. It's set to be 0 like stated above, and its always added. Adding 0 does nothing. The preset would be the same without it.