Forums > MaxMSP

"ramp" slider values?

February 6, 2014 | 3:21 am

Hi all,

I’m using a slider with a range of -1 to 1 to control a phase speed value. See the attached patch:

<code>

– Pasted Max Patch, click to expand. –

</code>

My goal is to setup something that will randomly generate values between -1 & 1 every 10-30 seconds or so then "ramp" that slider to the new value over 5-10 seconds. This would give a nice slow transition to the new phase value.

The random -1 to 1 is easy and so is the 10-30 s interval, but I can’t seem to find an easy way to ramp the slider to the new value over 5-10 seconds. Super easy with gain… But not sure how to set a -1 to 1 limit on range. I’m sure there is a simple solution to this, but I’ve been googling for a while and coming up with not much. Throw a nugget of Max goodness my way please!

Cheers


February 6, 2014 | 5:31 am

Something like this?
<code>

– Pasted Max Patch, click to expand. –

</code>


February 7, 2014 | 1:08 am

@Jason

Awesome! Thanks a ton…

Ended up modifying to this:

<code>

– Pasted Max Patch, click to expand. –

</code>

The randdist is a CNMAT object for random number generation.

Also had to change up a bit of logic due to the range being 2 on the slider. The whole -1 to 0 to 1 messed me up at first. The patch you posted just produced numbers 0 to -1 I think.

Anyway, thanks a bunch for your efforts!

Cheers.


February 7, 2014 | 1:39 am

Hey, I didn’t look too closely at your patch but the onebang object will never bang… You might want to set up a loadbang to the right inlet so it’s primed for use. Also, did you mean to send a bang to [set $1]? It will always pass [set 0].


February 9, 2014 | 12:02 am

@metamax

Yes, you’re right! I should have clarified… I just copy and pasted a section from a much larger patch. The larger patch uses both.


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