Forums > MaxMSP

notein, bendin, ctlin – Dynamically change channel

February 28, 2007 | 3:26 am

Is there a way to change the channel assignment for notein, bending and ctlin dynamically, i.e., send a message to change the channel in real-time. Is this correct? Is the only solution to script to destruction/recreation of the objects?

Thanks.

Adam


February 28, 2007 | 3:46 am

Adam Kendall wrote on Wed, 28 February 2007 04:26
—————————————————-
> Is there a way to change the channel assignment for notein,
> bendin and ctlin dynamically, i.e., send a message to change the
> channel in real-time. Is this correct? Is the only solution to
> script to destruction/recreation of the objects?
—————————————————-

Hi Adam,

Scripting is one possibility.
Otherwise, just put 16 objects of each, one per MIDI channel and use [gate] or [route] to correctly distribute the incoming data to the appropriate objects.
I agree that a dynamical channel assignment for notein, bendin and ctlin would be a very useful feature!

Cheers ;-)
Philippe


February 28, 2007 | 3:50 am

Thanks. I already have scripting in place from a while ago. I’m revisiting the patch and wanted to make sure nothing’s changed. In retrospect, I think 16 objects with a gate would have been easier to maintain.

Adam


February 28, 2007 | 3:57 am

Quote: Adam Kendall wrote on Wed, 28 February 2007 04:50
—————————————————-
> I think 16 objects with a gate would have been easier to
> maintain.
—————————————————-

Much more easier as sub-patchers, embedded patchers or as bpatchers, indeed!
While waiting for this feature included in the midi objects… ?

Philippe


February 28, 2007 | 4:30 am

At 8:26 PM -0700 2/27/07, Adam Kendall wrote:
>Is there a way to change the channel assignment for notein, bending and ctlin dynamically, i.e., send a message to change the channel in real-time. Is this correct? Is the only solution to script to destruction/recreation of the objects?

An abstraction the encapsulates channelizing is pretty easy. Save this as something like notein_ch, and use it where you want to change channels. This is untested, but I imagine it will function, although it may take a little tweak:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 178 243 27 196617 + 1;
#P newex 178 224 30 196617 >= 1;
#P newex 161 196 62 196617 t i i;
#P newex 178 271 81 196617 switch 2;
#P newex 70 144 67 196617 prepend port;
#P comment 73 33 31 196617 Port;
#N comlet Port;
#P inlet 55 33 15 0;
#P newex 192 133 43 196617 route 0;
#P newex 70 118 43 196617 route 0;
#P message 192 96 21 196617 $2;
#P message 70 97 91 196617 $1;
#P newex 192 63 48 196617 loadbang;
#P newex 161 292 27 196617 ==;
#P newex 89 345 29 196617 gate;
#P newex 36 345 29 196617 gate;
#P outlet 89 417 15 0;
#N comlet Pitch;
#P outlet 36 417 15 0;
#N comlet Chan;
#P inlet 248 33 15 0;
#P number 36 373 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 55 176 117 196617 notein;
#B color 5;
#P comment 51 418 30 196617 Note;
#P comment 104 418 22 196617 Vel;
#P number 89 373 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 248 198 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 265 33 31 196617 Chan;
#P window linecount 2;
#P comment 74 63 100 196617 Arguments are the same as notein;
#P connect 14 0 15 0;
#P connect 14 0 16 0;
#P fasten 2 0 24 0 253 217 183 217;
#P lcolor 7;
#P connect 2 0 22 2;
#P fasten 13 0 11 0 166 327 41 327;
#P lcolor 7;
#P fasten 13 0 12 0 166 327 94 327;
#P lcolor 7;
#P connect 25 0 22 0;
#P connect 24 0 25 0;
#P connect 23 1 22 1;
#P connect 23 0 13 0;
#P connect 6 2 23 0;
#P connect 22 0 13 1;
#P connect 21 0 6 0;
#P connect 17 1 21 0;
#P connect 19 0 6 0;
#P connect 18 1 2 0;
#P connect 16 0 18 0;
#P connect 15 0 17 0;
#P connect 8 0 2 0;
#P connect 6 1 12 1;
#P connect 6 0 11 1;
#P connect 12 0 3 0;
#P connect 11 0 7 0;
#P connect 7 0 9 0;
#P connect 3 0 10 0;
#P window clipboard copycount 26;


Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." – Brian Eno


February 28, 2007 | 4:41 am

Quote: Chris Muir wrote on Wed, 28 February 2007 05:30
—————————————————-
> An abstraction the encapsulates channelizing is pretty easy.

And to use just one object, channelize [midiparse] outputs.

PG


February 28, 2007 | 3:08 pm

Adam Kendall wrote:
> Thanks. I already have scripting in place from a while ago. I’m
> revisiting the patch and wanted to make sure nothing’s changed. In
> retrospect, I think 16 objects with a gate would have been easier to
> maintain.

But one object with a gate should be enough, just an example for ctlin
with changeble args:

#P inlet 186 46 15 0;
#P inlet 148 46 15 0;
#P inlet 84 46 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 160 92 36 196617 == $2;
#P newex 122 92 36 196617 == $1;
#P outlet 40 162 15 0;
#P newex 40 141 32 196617 gate;
#P newex 62 120 32 196617 gate;
#P newex 84 68 86 196617 ctlin;
#P connect 2 0 3 0;
#P connect 0 0 1 1;
#P connect 0 2 5 0;
#P connect 8 0 5 1;
#P fasten 5 0 1 0 165 116 67 116;
#P connect 0 1 4 0;
#P connect 7 0 4 1;
#P fasten 4 0 2 0 127 112 45 112;
#P connect 6 0 0 0;
#P connect 1 0 2 1;
#P window clipboard copycount 9;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


February 28, 2007 | 3:49 pm

Chris Muir wrote:
> This is untested, but I imagine it will function, although
> it may take a little tweak:

Without testing I’d say it might struggle with argument 0 (to pass all
channels) and the first argument could be just the channel…

Here’s a tweak… (untested ;-)

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 151 82 46 196617 route i;
#P newex 151 59 32 196617 iter;
#P newex 151 36 63 196617 patcherargs;
#P number 186 176 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 161 199 23 196617 ==;
#P newex 186 199 23 196617 ==;
#P comment 73 33 31 196617 Port;
#N comlet Port;
#P inlet 55 33 15 0;
#P newex 161 221 35 196617 || 1;
#P newex 89 253 29 196617 gate;
#P newex 36 253 29 196617 gate;
#P outlet 89 304 15 0;
#N comlet Pitch;
#P outlet 36 304 15 0;
#N comlet Chan;
#P inlet 248 33 15 0;
#P number 36 281 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 55 176 117 196617 notein;
#B color 5;
#P comment 51 305 30 196617 Note;
#P comment 104 305 22 196617 Vel;
#P number 89 281 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 265 33 31 196617 Chan;
#P window linecount 2;
#P comment 249 80 167 196617 Arguments are the same as notein , but you
could switch them….;
#P fasten 12 0 10 0 166 245 41 245;
#P lcolor 7;
#P fasten 12 0 11 0 166 245 94 245;
#P lcolor 7;
#P connect 16 0 12 0;
#P connect 15 0 12 1;
#P fasten 20 1 5 0 192 161 60 161;
#P connect 20 0 17 0;
#P connect 7 0 17 0;
#P connect 17 0 16 1;
#P connect 17 0 15 0;
#P connect 5 2 16 0;
#P connect 19 0 20 0;
#P connect 18 0 19 0;
#P connect 2 0 9 0;
#P connect 6 0 8 0;
#P connect 10 0 6 0;
#P connect 11 0 2 0;
#P connect 5 0 10 1;
#P connect 5 1 11 1;
#P connect 13 0 5 0;
#P window clipboard copycount 21;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


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