Forums > MaxMSP

[line] and [line~] question

September 21, 2012 | 9:26 pm

First of all I’m not even sure if [line/~] is the best object for what I’m trying to do.

Here is an analogy of what I would like to do: You have a balloon and you can fill it up with air at a constant rate. Press a button to fill it up to it’s capacity without popping it. Release the button to deflate the balloon at the same constant rate. And you have the ability to press the button on or off midway through filling up the balloon to try and keep it within a range manually.

I have messed around with [line] and [counter] but not able to come up with anything that works or is practical. Any thoughts?

Thanks in advanced.


September 21, 2012 | 9:39 pm

You probably want line, and likely the float version so [line 0.]. Both line~ and line start where they left off. Here’s a simple example that can get you going.

– Pasted Max Patch, click to expand. –

September 21, 2012 | 10:04 pm

Hey Rodrigo,
Thanks for the reply. I just figured it out and was going to post my findings.

The only problem with the patch as you posted doesn’t have the "constant rate" im looking for. It will always take one second to go from any value. If I hold the button for .25 seconds and release it, it will take the current value of the slider 1 full second to get back to zero instead of only .25 seconds.

Here is what I got and it seems to work pretty well:

– Pasted Max Patch, click to expand. –

September 21, 2012 | 10:18 pm

Right. I skimmed that part I guess. Seems like you got a good/workable solution.


September 22, 2012 | 1:24 am

i would still do it with [line] and not with a counter.

you simply have to calculate the duration yourself in order to get a constant velocity.

-110


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