View Full Version : Help me......please
Rovastar
11th November 2001, 22:16
Please help me writing a new and rather complex preset and I have this problem.
To get the dynamic number range 0..1..0..1 etc
I use sin(time)/2 + 0.5
dead easy
but I have a variable that I want to add into this I need the series var..1-var..var..1-var ,etc
eg if var is 0.1 I need 0.1 to 0.9.
It sounds really easy but I am having problems.
Could someone please show me the equation for this?
Thanking you good people in advance
Rovastar
Krash
12th November 2001, 00:37
sin(time)/2 + 0.5 - sin(time)*var
- Krash
Rovastar
12th November 2001, 00:58
Thank you Krash that looks great.
unchained
12th November 2001, 04:24
Ok, my turn to ask..
would 1-var*cos(time); yield the same value, or do I completely misunderstand what cos does?
unchained
12th November 2001, 04:26
oh, also
1 - abs(sin(time/2)*var);
maybe?
Krash
12th November 2001, 06:49
cos is exactly the same as sin, except it's out of phase. When sin is 0, cos is either 1 or minus 1, and vice versa.
so 1-var*cos(time) is exactly the same as using sin.
1 - abs(sin(time/2)*var):
First of all, the /2 is outside the parentheses. So it should be:
1 - abs(sin(time)/2*var);
The best way to do something like this is just pick some values. In this case, values for sin(time).
sin(time) = 0, the equation equals 1.
sin(time) = 1, the equation equals 1 - 0.5*var
sin(time) = -1, the equation equals 1 - 0.5*var
so at a glance, this equation appears to work, sort of. if you put in a value of var that was twice what you wanted, it would work.
The difference is that because you're using an absolute value, that the value will "jump" when it gets to 1, and start going back the other way. Because the value of sin(time) is not slowing down as it approaches 0, so you don't get a smooth change in the final value.
I hope that makes sense. It's alot easier to communicate with diagrams.
Hell, just plug it into MD as a wave_x function, and you'll see.
- Krash
unchained
12th November 2001, 08:32
I think I gotcha. Somehow, even though I knew that the cosin was the "opposite" of the sin, I got it into my head that cos(x) would only return positive values. What you're saying is that if I did say
wave_x=.5+.5*sin(time);
is equivalent to
wave_x=.5-.5*cos(time);
correct?
Rovastar
12th November 2001, 11:25
Note to self: Read the previous post next time you reply
Edited post
The equations is not exactly the same but produce the same range of results.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.