Forums > MaxMSP

rslider math

December 16, 2010 | 1:59 pm

Hi
I’m using [rslider] to set some pitch ranges, and I assumed that simply subtracting the slider’s min from the max would give me the range value. Not so; it seems that scrolling the slider, and discrete clicking produce different behaviours: the patch below explains:

– Pasted Max Patch, click to expand. –

Could someone tweak this, so that the number box updates the range/difference whether [rslider] is clicked or scrolled?

Brendan



pid
December 16, 2010 | 2:17 pm
– Pasted Max Patch, click to expand. –

December 16, 2010 | 2:49 pm

are you wanting mid of slider to be correct pitch. if so i just made one using a select object box. the object box should read select 0 1 2 3 4 (and so on till you get to) 157, then on the 58 out put a message box with a 1 in it then on 59 place a box with 1.01 and so on then link all these to the sfplay~ speed int. theirs probably a quicker way to do it but it works.


December 16, 2010 | 2:50 pm

78 not 58 sorry
oh and 79 not 59


December 16, 2010 | 3:01 pm

Thanks everyone

@pid
strange that [!-] works, and [-] doesn’t..although, i reversed the inputs to [pak] and changed [!-] to [-], and it appears ok; the math object prefers the two element list apparently.
nice one

Brendan


December 16, 2010 | 10:12 pm

n00b_meister, I think maybe you’re overlooking that the max value comes out of rslider before the min value (because it’s farther to the right). So, in your initial example, you’re always triggering the calculation with the max value, but using the min value from the previous time. The patch posted by pid sorta fixes that, because pak will be triggered by both the max value and the min value, but that causes it to put out one wrong answer followed by one right answer, so it’s not a clean solution. I think swap is probably the most suitable object for your purposes:

– Pasted Max Patch, click to expand. –

December 16, 2010 | 10:23 pm

Hi Christopher
schoolboy error on my part (hangs head in shame)!!

While I was more-or-less considering the R-L ordering, I thought it would be ‘fixed’ (compensated?) by the hot/cold inlets of the [-] object.

Anyhoo, your solution is, as ever, perfect.
Thanks
Brendan


December 16, 2010 | 11:53 pm

There’s an attribute that makes rslider output a list, that makes it even easier.
_
johan

– Pasted Max Patch, click to expand. –

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