control ramps using line

george.profenza's icon

Hello,

I am trying to use line to transition between two values (0 and 254) in 3 different ways:
1. ramp up (0-254)
2. ramp down(254-0)
3. ramp up then down (0-254-0)

My inputs are two ints: the first to tell the type of ramp (0 = up,1 = down,2 = up then down) and the time to for the transition.

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

I kind of got it working, but I'm still a n00b and this feels a bit hacky/not very elegant

What would be the elegant way of achieving this ?

Thanks,
George

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

Here's a way using the coll object.

george.profenza's icon

Woow, this is pretty neat, thank you!
Quite a few neat tricks to pick up, including the , in the coll.

Fora's icon

The comma in Coll is pretty handy to know but I've noticed a bug in Max 6 compared to Max 5 regarding ","
In Max 5, I can add , in Coll via the textedit window but in Max 6, I can't. Hmmm strange...

$Adam's icon

Hi,

another approach:

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

Cheers,
Ádám

george.profenza's icon

Interesting approach Ádám.

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

Guys, I've got another question related to this.
Is it possible to send multiple lists simultaneously and transition numbers in parallel ?
I've slightly modified Fora's inputs and now pressing each message at a time works as expected, but pressing all
means the messages override each other, and since Max evaluates right to left, the leftmost message is being remains updated:

If so, now can this be approached ?

Cheers,
George

Fora's icon

Hi George,

if you wanted to execute all three messages in a sequence then the patch I knocked up could be tweaked to do that. But banging all three messages at once will only confuse the patch as it requires a system to deal with the influx of messages.

One way around this is to create a simple sequencer using a counter object that's triggered via the right outlet of the line object (which outputs a bang when finished processing a message)

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

Here's an example using Ádám's patch..

george.profenza's icon

Thanks again Fora,

This might actually work if the interval isn't too large.

I was hoping to have an individual ramp for each pair of inputs,
running multiple ramps at the same time. I was looking through the documentation
and I'm thinking about encapsulating your solution and using JavaScript to create
multiple instances which can run in parallel, then remove them when complete .

Does this sound reasonable or is there a better way to handle this ?

Thanks,
George