soft pickup with two MIDI knobs

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

Hi, what I'm trying to do is control a single number box in Max with two physical MIDI knobs. I need it to have a 'soft pickup' where each knob will engage and effect the output only if the value is close to the value that is already there. Right now I have the range set to =/-5 but I'd like it less to avoid stepping. What I have posted here kind of works, but 1) there must be a more elegant way of doing it, and 2) it doesn't work if the knobs are turned too fast, because such a wide gap in numbers won't trigger the soft pickup. The knob doesn't output a smooth contiguous range. I'm trying to avoid externals here...
Any ideas?

Holland Hopson's icon

Your approach looks like what I've done in similar situations, so +1 for elegance. I don't have an easy answer to your question #2.

One idea might be to keep track of whether the new value begins above or below the reference value. Then, if it crosses the threshold below or above without landing in the +/- 5 window you could assume that the reference value has been met and switch to the new input. I recall trying something like this in the past and not being happy with the resulting discontinuities.

Another idea is to use your values to drive a ramp using line~ or similar. Making the comparison in signal-land would be more accurate.

Len Richardson's icon

maybe that could be a solution - i only added a little dirty sub patcher to the right knob so you can compare... it also solves your soft pickup regardless how big the gap between two values might be.
hope that can help.

kind regards

twoKnobsEdit.maxpat
Max Patch
dhjdhjdhj's icon

Didn't look at your patcher but after trying to this myself a few years ago I ended up building a simple external that might do what you need. It detects which way a physical control is being turned and mirrors that control once it crosses over some defined position (normally set by another dial or updated from a persistent dictionary setting).

Attached is a compressed file with the compiled external for OS X (and the source if anyone wants to put it on Windows) and an example that demonstrates it.

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

Normally, the way I use it, I have two dials overlayed, with the smaller one having a transparent background and showing the position of the physical control. The outer one only moves once a crossover event has occurred.

dhj.CrossOver.zip
zip
Jeremy's icon

Thanks very much for the replies, gentlemen. I had initially settled on a patch that solves the most important practical problem of keeping the value between two knobs smooth (simply using line), but it didn't do the soft pickup like I wanted.

Mirsch, thanks, that did it. Using bline to interpolate values does the trick to insure that max notices the crossover. And using split is a great way to eliminate the clunky +/-5 logic.
I had to switch the inputs on your gswitch, and now it works great. Thanks again.

DJH, I think your solution would work too, thank you. Was hoping to avoid externals.

dhjdhjdhj's icon

The advantage of an external in this case is that it's going to be less intrusive (because most of the work is being done in C) and quicker to load than an abstraction with lots of Max objects, particularly if you have lots of physical knobs.