Forums > MaxMSP

Not allowing Counter to reset on Max/Min

March 28, 2008 | 6:30 pm

What I’m trying to accomplish:
I’m trying to bring in the position of the knob on my MotorMix but it
only sends a direction (see my solution).

My Solution (not completely working):
Using counter, every time a 1/0 (knob direction) comes in through
MIDI, it triggers a bang which is counted. When the maximum count is
reached (knob max.), counter sends out a bang which closes the gate.
This works but when the knob reaches the minimum count, it resets to
the max value. I can send a patch to demonstrate this solution later
as I’m not at my Max/MSP computer.

Seems like it would be a simple solution, but is there a way to create
a minimum and maximum for counter that does not reset? I can use a
gate but then I need to be able to re-open the gate when the opposite
knob direction comes back in via MIDI.

Another thing is my solution does not account for accelerated knob
twisting to speed up the values inc/decrementing. I could be doing
this all wrong, so I would love to hear of a better solution
all-together.

Thanks


March 28, 2008 | 7:26 pm

On Mar 28, 2008, at 11:30 AM, Wade wrote:
> Seems like it would be a simple solution, but is there a way to create
> a minimum and maximum for counter that does not reset? I can use a
> gate but then I need to be able to re-open the gate when the opposite
> knob direction comes back in via MIDI.
>
> Another thing is my solution does not account for accelerated knob
> twisting to speed up the values inc/decrementing. I could be doing
> this all wrong, so I would love to hear of a better solution
> all-together.

I used accum to accomplish this in my MaxieControl package. Here’s the
vpot patch from there (none too well commented, I’m afraid.) It does
accomplish what you’re interested in, I think; clips at the extremes,
and allows for knob deltas > 1.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 285 184 79 196617 r MC.Board.Init;
#N comlet Set VPot value;
#P inlet 47 43 15 0;
#P newex 50 155 62 196617 prepend set;
#P newex 50 127 66 196617 prepend size;
#P newex 50 105 27 196617 + 1;
#P user dial 1 22 40 40 500 1 0 0 159 270 1 1. 170 170 170 221 221 221
120 120 120 225 225 225 0 0 0 0 0 0;
#P newex 380 452 87 196617 s MC.CC.Out.Num;
#P newex 264 451 82 196617 s MC.CC.Out.Val;
#P newex 236 113 80 196617 r MC.CC.In.Num;
#P newex 96 74 75 196617 r MC.CC.In.Val;
#P window linecount 4;
#P comment 422 258 76 196617 Someday I’ll add support for the other
VPot display modes;
#P window linecount 1;
#P comment 264 473 83 196617 Controller Value;
#N comlet Controller Number;
#P outlet 348 473 15 0;
#P comment 383 473 100 196617 Controller Number;
#N comlet Controller Number;
#P outlet 367 473 15 0;
#P newex 348 380 29 196617 t i b;
#P newex 216 80 31 196617 + 15;
#P message 216 62 21 196617 $1;
#P window linecount 2;
#P comment 117 46 52 196617 Controller Value;
#N comlet Controller Number;
#P inlet 189 46 15 0;
#P window linecount 1;
#P newex 151 126 29 196617 gate;
#P newex 189 100 37 196617 == 60;
#N comlet Controller Value;
#P inlet 170 46 15 0;
#P comment 205 46 100 196617 Controller Number;
#P newex 348 315 27 196617 + 1;
#P newex 348 288 27 196617 /;
#P newex 348 354 54 196617 +;
#P message 392 299 14 196617 2;
#P number 392 316 35 9 0 3 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 392 333 29 196617 < < 4;
#P message 202 235 14 196617 0;
#P newex 365 264 31 196617 / 10;
#P message 365 245 32 196617 $2;
#P message 367 409 21 196617 $1;
#P hidden newex 391 63 48 196617 loadbang;
#P newex 367 430 31 196617 + 47;
#N comlet VPot Value Out;
#P outlet 151 473 15 0;
#P newex 207 323 32 196617 sel 1;
#P message 244 345 47 196617 $2;
#P newex 207 303 30 196617 < = 0;
#P newex 244 304 48 196617 >= $2;
#P newex 244 324 32 196617 sel 1;
#P newex 151 259 66 196617 split 0 $2;
#P newex 151 150 27 196617 t b i;
#P newex 203 192 33 196617 !- 64;
#P newex 168 171 45 196617 split 64;
#P message 207 345 14 196617 0;
#P newex 151 234 45 196617 accum;
#P comment 208 25 286 196617 Arguments: 1. VPot number $1 , 2. upper
limit $2;
#P window setfont "Sans Serif" 14.;
#P comment 164 23 43 196622 VPot;
#P window setfont "Sans Serif" 9.;
#P hidden comment 114 482 41 196617 bottom;
#P comment 430 316 69 196617 Display mode;
#P comment 166 473 76 196617 VPot Value Out;
#P window linecount 3;
#P comment 62 43 31 196617 Set VPot value;
#P connect 24 0 27 1;
#P connect 25 0 24 0;
#P connect 26 0 25 0;
#P hidden connect 19 0 23 0;
#P lcolor 5;
#P hidden connect 19 0 36 0;
#P lcolor 5;
#P hidden connect 19 0 21 0;
#P lcolor 5;
#P hidden connect 19 0 20 0;
#P lcolor 5;
#P hidden connect 19 0 26 0;
#P lcolor 5;
#P connect 18 0 47 0;
#P connect 18 0 39 0;
#P connect 20 0 18 0;
#P connect 38 1 20 0;
#P connect 22 0 28 1;
#P connect 21 0 49 0;
#P connect 21 0 22 0;
#P connect 38 0 46 0;
#P connect 38 0 41 0;
#P connect 27 0 38 0;
#P connect 29 0 27 0;
#P connect 28 0 29 0;
#P connect 11 0 17 0;
#P fasten 11 0 28 0 156 282 353 282;
#P connect 12 0 15 0;
#P connect 13 0 12 0;
#P connect 11 1 14 0;
#P connect 11 1 13 0;
#P connect 37 0 32 1;
#P connect 36 0 37 0;
#P connect 16 0 7 0;
#P connect 14 0 16 0;
#P connect 8 1 9 0;
#P connect 53 0 23 0;
#P connect 45 0 32 0;
#P connect 34 0 32 0;
#P connect 44 0 33 1;
#P connect 31 0 33 1;
#P connect 9 0 6 1;
#P connect 8 0 6 1;
#P connect 10 1 8 0;
#P connect 6 0 51 0;
#P connect 6 0 11 0;
#P connect 52 0 6 0;
#P fasten 15 0 6 0 224 384 131 384 131 212 156 212;
#P fasten 7 0 6 0 197 375 140 375 140 221 156 221;
#P connect 23 0 6 0;
#P connect 10 0 6 0;
#P hidden connect 48 0 6 0;
#P connect 33 0 10 0;
#P fasten 32 0 33 0 194 121 156 121;
#P connect 49 0 50 0;
#P hidden connect 50 0 48 0;
#P hidden connect 51 0 48 0;
#P window clipboard copycount 54;

Chris Muir
cbm@well.com

http://www.xfade.com


March 28, 2008 | 7:44 pm

Wicked, thanks Chris for sending that! I’ll take a look at it when I get home.

By ‘knob deltas > 1′ are you referring to knob acelleration based on
speed of knob rotation or are you referring to allowing the knob
max/min to be re-mapped to different values?

On Fri, Mar 28, 2008 at 3:26 PM, Chris Muir wrote:
>
> I used accum to accomplish this in my MaxieControl package. Here’s the
> vpot patch from there (none too well commented, I’m afraid.) It does
> accomplish what you’re interested in, I think; clips at the extremes,
> and allows for knob deltas > 1.


March 28, 2008 | 8:22 pm

On Mar 28, 2008, at 12:44 PM, Wade wrote:
> Wicked, thanks Chris for sending that! I’ll take a look at it when I
> get home.
>
> By ‘knob deltas > 1′ are you referring to knob acelleration based on
> speed of knob rotation or are you referring to allowing the knob
> max/min to be re-mapped to different values?

While I do allow the max value to be remapped in this patch, what I
was referring to was acceleration. What the Mackie Control sends for
its VPots, is a controller value. The controller is to be interpreted
as bipolar, centered on 64: < =64 is negative, >64 is positive. The
distance away from the midpoint is how many ticks to move. If you get
a CC message of 65, you would move one tick higher, if you get a
message of 66, two ticks, etc.

Chris Muir
cbm@well.com

http://www.xfade.com


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