## slide object question …

Dec 5, 2011 at 9:49pm

# slide object question …

As in the Max Data Tutorial 2: Data Scaling it gives the example:
For example, when you first start the patch, the â€ślastâ€ť value is 0.0. If you make an immediate transition to 0.5 (which you can do by entering a value into the number box connected to the slide objects), you will see that the first slider moves to 0.01.

the difference between the initial value of 0.00 and 0.50 is 0.50; this difference is divided by the factor (in this case 50.) to yield 0.01.

that would cause the calculation:
0.0 to 0.5 are equal to 0.5 in difference
divided by factor 50 (0.5/50) with the result 0.01

so far so good.

but say the next incoming value would be 1.0
that would then be:
the difference between the value of 0.01 and 1.00 is 0.99
and then divide it by 50 would cause 0.99/50=0.0198

but the result if Im using this example in Max Data Tutorial 2: Data Scaling patch is: 0.030

why??

#60477
Dec 6, 2011 at 12:54am

because the averging isnt restarted when you change the argument while it runs? :)

#217674
Dec 7, 2011 at 3:23pm

Sorry but i didnt understand what you mean …

#217675
Jan 8, 2012 at 1:23pm

anyone who can help me explaining this?

#217676
Jan 9, 2012 at 9:34am

I hope you didn’t spend one month on this!

You can find slide‘s formula in the reference:

y (n) = y (n-1) + ((x (n) – y (n-1))/slide)

So, if you use your example, y(2) = 0.01 + (1 – 0.01) / 50 = 0.01 + 0.0198 = 0.0298

You forgot to add the previous value (y(n-1)) to your result (in this type of filter, a value always depends on the previous one).

Now, you may think that 0.03 is not 0. 0298, but if you make the float box bigger, you’ll discover that Max in fact also computes a 0.0298

HTH,

p

#217677
Jan 9, 2012 at 3:06pm

otherwise, put it on a katapult and …. wooosh.

#217678

You must be logged in to reply to this topic.