"ramp" slider values?

sleeplesswaves's icon

Hi all,

Max Patch
Copy patch and select New From Clipboard in Max.

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

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

Jason Charney's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Something like this?

sleeplesswaves's icon

@Jason

Awesome! Thanks a ton...

Max Patch
Copy patch and select New From Clipboard in Max.

Ended up modifying to this:

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.

metamax's icon

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].

sleeplesswaves's icon

@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.