Forums > MaxMSP

slide object question …


Per
December 5, 2011 | 9:49 pm

Can someone please help me to understand the smoothing process of the slide object.

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??


December 6, 2011 | 12:54 am

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



Per
December 7, 2011 | 3:23 pm

Sorry but i didnt understand what you mean …



Per
January 8, 2012 | 1:23 pm

anyone who can help me explaining this?


January 9, 2012 | 9:34 am

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


January 9, 2012 | 3:06 pm

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


Viewing 6 posts - 1 through 6 (of 6 total)