## Simpler way re: pitch/octave dividing?

Dec 10, 2009 at 8:33am

# Simpler way re: pitch/octave dividing?

Just solving an issue I had but wanted to make sure there isn’t an easier way to go about this. The patch in question takes MIDI note numbers then reduces then down to a single octave. 24 becomes 0, 49 becomes 1, 14 becomes 2, and so on. Lots of “if/then” going on here. Lately I’ve been trying to make all my patches have as few objects as possible. Here’s the patch as I’ve figured it:

#P user kslider 20 135 54 0 0 12 31 12 0 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 435 109 1082 831;
#P origin 0 13;
#N comlet Midi Pitch Out (0-11);
#P outlet 474 459 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 249 352 30 196617 – 12;
#P newex 249 318 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 249 284 30 196617 – 12;
#P newex 249 250 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 249 216 30 196617 – 12;
#P newex 249 182 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 249 148 30 196617 – 12;
#P newex 249 114 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 249 80 30 196617 – 12;
#P newex 249 46 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 13 350 30 196617 – 12;
#P newex 13 316 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 13 282 30 196617 – 12;
#P newex 13 248 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 13 214 30 196617 – 12;
#P newex 13 180 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 13 146 30 196617 – 12;
#P newex 13 112 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#P newex 13 78 30 196617 – 12;
#P newex 13 44 166 196617 if \$i1 < = 11 then out2 \$i1 else \$i1;
#N comlet Midi Pitch In (0-127);
#P inlet 13 12 15 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 21 0;
#P connect 19 1 21 0;
#P connect 17 1 21 0;
#P connect 15 1 21 0;
#P connect 13 1 21 0;
#P connect 11 1 21 0;
#P connect 9 1 21 0;
#P connect 7 1 21 0;
#P connect 5 1 21 0;
#P connect 3 1 21 0;
#P connect 1 1 21 0;
#P pop;
#P newobj 20 101 77 196617 p pitch-divider;
#P user kslider 20 30 54 0 0 48 31 12 0 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P connect 1 0 2 0;
#P connect 0 0 1 0;
#P window clipboard copycount 3;

#47134
Dec 10, 2009 at 8:41am

You’re essentially just converting from pitch to pitch-class, yes? There’s a much simpler way – use [% 12].

best,
Zachary

– Pasted Max Patch, click to expand. –
#169456
Dec 10, 2009 at 8:49am

Just as Zachary said, mod is your friend in this case. Since you seem to be running Max 4 I converted the Max 5 patch for ya as well…

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 29 131 34 196617 % 12;
#P user kslider 29 198 54 0 0 12 31 12 0 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P user kslider 29 52 54 0 36 48 31 12 0 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P connect 2 0 1 0;
#P connect 0 0 2 0;
#P window clipboard copycount 3;

#169457
Dec 10, 2009 at 1:25pm

Thanks to both of you! Seems I need to read through the documentation again. That’s another object that as slipped through my knowledge.

#169458
Dec 11, 2009 at 8:56am

…and when you get to making scales, look into matrixctrl with a preset, zl rot to transpose, zl mth to test whether the pitch is in the scale or not…it’s never-ending!

#169459

You must be logged in to reply to this topic.