Archive: superscope


16th April 2004 22:15 UTC

superscope
why doesn't this

{superscope}
[init]
num=3;n=4*num;
[pixel]
cnt=if(equal(i, 0), 0, cnt+1);
x=1.4*i-0.7;
y=if(below(cnt, num*1), -0.75, y2);
y2=if(below(cnt, num*2), -0.25, y3);
y3=if(below(cnt, num*3), 0.25, y4);
y4=0.75;

look like this:

...
...
...
...

???
help me please!!!!


16th April 2004 22:17 UTC

sorry like that:

...---------
---...------
------...---
---------...
??


17th April 2004 11:02 UTC

That's about the most vague question ever posted here. :hang:


17th April 2004 11:28 UTC

try the superscope which i've written above and you'll see
these dots on your screen:
<pre>
...
....
....
.
</pre>
but if you swap these lines:
y=if(below(cnt, num*1), -0.75, y2);
y2=if(below(cnt, num*2), -0.25, y3);
y3=if(below(cnt, num*3), 0.25, y4);
y4=0.75;

so that you have this:
y4=0.75;
y3=if(below(cnt, num*3), 0.25, y4);
y2=if(below(cnt, num*2), -0.25, y3);
y=if(below(cnt, num*1), -0.75, y2);

you'll see the dots on their 'right' positions:
<pre>
...
...
...
...
</pre>

the lines are the same but the result is different


17th April 2004 12:00 UTC

i mean these 2:
1st:
[pre]
...
....
....
.
[/pre]

2nd:
[pre]
...
...
...
...
[/pre]


17th April 2004 12:02 UTC

why don't these pre-tags work?


17th April 2004 14:22 UTC

1st:


...
....
....
.


2nd:

...
...
...
...

17th April 2004 14:24 UTC

2 different pictures without changing the code!!


17th April 2004 15:01 UTC

first of all: use the edit function :) there's a button labeled "edit" in the lower right corner of each post

for that cnt variable, try
cnt=i*(n-1);
it will do exactly the same as your if()

and for the order of these assignments: i don't think you really understood the assignments. y, y2, y3, y4 are variables.
"y4=0.75;" for example assigns 0.75 to that variable. this means, y4 is equal to 0.75 --->from that code line on, but not earlier<---
after all this is not maths, but a programming language, so no forward uses of variables ;)


18th April 2004 09:41 UTC

and y4 is not a variable recognized by avs, it only knows x and y. You can declare values to y2, y3, and y4, but you never use them anywhere. It's like declaring a value to "poo" (poo=if(below(cnt, num*3), 0.25, y4); ), but poo is not used anymore after that in x and y, or in other expressions that do affect x and y.


18th April 2004 17:02 UTC

yes, but the line before refers to that variable(y3=if(below(cnt, num*3), 0.25, y4))


18th April 2004 17:04 UTC

the line order was incorrect, so that some variables were undeclared when they were used


18th April 2004 17:36 UTC

yup


18th April 2004 18:05 UTC

after all this is an imperative language without any sub-procedures and jumps (yet :D)
This means that lines cannot refer to each other.

So to make sure you understand what i mean, here's a little tutorial of the variable concept.

First, some terms (you don't need to read the details to understand AVS :)):
variable:
- a piece of memory which contains a number (approximates a "real" number in mathematics)
- details: AVS uses the "double" datatype for its variables, which is 64 bit or 8 bytes long. it consists of 1 bit for the sign(+/-), 11 bits for the exponent, and 52 bits for the mantissa. Its range is +/–1.7E308 with at least 15 digits of precision, meaning 15 digits total, from the first non-zero digit on.

command:
- an assignment or a single term.
- commands are separated by semicola ( ; ) from each other
- commands are executed one by one in the order you give them

assignment:
- something like "var=val" where "var" is the variable you want to assign to and "val" is a term you want to evaluate and assign to "var"
- the assignment changes the contents of the piece of memory that is labeled with the variable name

term:
- consists of functions, variables and operators

function:
- usually something that takes one or more parameters as input and returns a value. function calls look like "name(param1, param2)"
- the parameters can be terms themselves
- example: getosc(i, 1/n, 0)

operator:
- an operator is something like +-*/ for the basic arithmetic operations, % for modulo (divide and return the remainder), & for bitwise AND and | for bitwise OR

and again: There is an EDIT function in this forum, please use it :)


18th April 2004 18:23 UTC

Thanks Tomy. I have some experience with C/C++, Java, etc., so I know what the variables are.
One question: does every programming language use 11 bits for the exponent and 52 bits for the mantissa?
Thank you one more time for your tutorial, maybe it'll help other avs-juniors.


18th April 2004 18:40 UTC

ok i didn't know that :)
about the 11 bits/52 bits
there are various types of floating point values and one of them is double (it's Microsoft specific, btw and i don't how far the support for it in other OSs goes)
double is i think standardized to this format.
there is also the float (or single in some languages) data type which has 8 bits for the exponent and 23 bits for the mantissa.
this allows for a range of about +/-3.402E38 with a precision of at least 6 digits.
both types are part of the ANSI C standard, so they should be supported by all C compilers
the double type is also available in Basic and has the same range there. For other languages, I don't know.


18th April 2004 18:51 UTC

thans.
You know much about this avs stuff, right? Could you explain the difference between spectrum and oscilloscope, they both represent the sound vibrations but in different ways, do you know something about this?


18th April 2004 19:33 UTC

http://forums.winamp.com/images/edit.gif

USE IT.


18th April 2004 20:29 UTC

it? I wanted to know the way winamp converts sound into oscilloscope and spectrum, the one looks like waves the other like stairs.


18th April 2004 22:03 UTC

Wow 5 posts in a row, never seen that before.


19th April 2004 02:44 UTC

Read up on fourier transforms, frequency analysis, etc. This is too complicated to cover just in one forum post, so don't expect us to.

Google and Wikipedia are you friends.


19th April 2004 20:31 UTC

Wikipedia? I've neverer heared it before. I'll try it out.