Switching Between Two Line Object Values Continuously

Maksym Prykhodko's icon

Hi everyone,

I can't seem to wrap my head around this. Here's what I'm trying to do.

There are two states:
1. neutral state – a line loop from 10 to -10
2: active state - line to 1 over 4 seconds, then held for 2 seconds

This logic is meant to control video playback. The video is looping (via neutral state) by default and forever, back and forth, back and forth. When participant movement is detected, it sends a bang to the active state, which then changes the rate of the video to go up to 1, hold for 2 seconds, then immediately revert back to the neutral state.

I have the "switch" object set up, with all my gates, and a "onebang" up at the top. The problem here is that I want to store the CURRENT rate value right before activation, and use the active state line object to ramp from that value to 1. In theory the message for that line object should be something like: "$f1, 1. 4000 1. 2000"

The problem is, I don't know how to store a float in a message object. I've read over the pack object, and I've tried multiple variations on prepending the message. I just can't figure it out. Help would be tremendously appreciated. Thank you!!

06_fixing-logic.maxpat
Max Patch


Source Audio's icon

you can use pause and resume messages to line.

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

Maksym Prykhodko's icon

Thank you SO much! This is exactly what I wanted to do! I went ahead and duplicated the "$1 \. 1/ 400 1. 2000" message so that I had two of them. This allowed me to consistently keep track of one number between two ramps. Thank you so much for your help!!