#N canvas 217 33 1071 723 12;
#X obj 685 317 pgmout;
#X obj 570 317 bendout;
#X floatatom 26 423 5 0 0 0 - - - 0;
#X text 31 355 pitch bend, f 5;
#X obj 690 250 ctlout;
#X obj 789 317 touchout;
#X obj 905 317 polytouchout;
#X obj 69 523 midiin;
#X obj 411 521 sysexin;
#X obj 792 641 midiout;
#X obj 241 531 midirealtimein;
#X obj 241 395 touchin;
#X obj 350 375 polytouchin;
#X obj 26 167 notein;
#X text 79 219 velocity;
#X text 90 193 channel;
#X obj 273 159 ctlin;
#X text 304 247 value;
#X text 450 403 channel;
#X text 235 355 channel aftertouch, f 10;
#X text 351 334 polyphonic aftertouch, f 10;
#X text 382 449 aftertouch value;
#X floatatom 251 317 0 0 0 0 - - - 0;
#X text 279 318 value;
#X text 22 147 (omni);
#X obj 162 192 notein 1;
#X text 153 157 (channel 1);
#X text 317 158 (all controllers \, omni);
#X floatatom 55 311 0 0 0 0 - - - 0;
#X text 12 312 value;
#X obj 55 285 ctlin 4;
#X floatatom 101 311 0 0 0 0 - - - 0;
#X text 896 251 touch;
#X text 941 260 note;
#X text 111 284 (controller 4);
#X text 722 191 value;
#X text 772 252 channel;
#X obj 848 223 ctlout 7;
#X text 236 585 real-time messages;
#X text 32 480 These three below are always omni \, don't take arguments and output the port number on the right outlet:;
#X text 740 218 controller #;
#X text 320 217 controller #;
#X text 61 241 note;
#X text 155 243 note;
#X text 196 243 velocity;
#X text 419 426 note;
#X obj 26 395 bendin, f 7;
#X text 393 577 system exclusive messages only \, byte by byte, f 16;
#X text 896 267 value;
#X text 332 185 channel/port;
#X text 161 171 (port 1);
#X text 129 313 channel/port;
#X obj 251 287 ctlin 7 17;
#X text 329 281 (controller 7 \, channel 1/port 2), f 17;
#X text 15 8 MIDI INPUTS: Inputs are omni by default \, an optional argument sets the channel/port and removes the rightmost outlet (which outputs this information). For [ctlin] \, a first optional argument sets controller number and suppresses its corresponding outlet \, and a second argument sets the channel and also suppresses its corresponding outlet., f 70;
#X text 808 156 (controller 7 \, channel/port 1), f 15;
#X obj 956 223 ctlout 3 38;
#X text 15 89 Port number is encoded as the channel number. Channels 1 to 16 are for port 1 \, channels 17 to 32 is the same as channels 1 to 16 for port 2 \, channels 33 to 48 represents channels 1 to 16 in port 3 \, and so on..., f 70;
#X text 839 682 updated for Pd version 0.48-2;
#X text 935 156 (controller 3 \, channel 6/port 3), f 17;
#X floatatom 26 241 4 0 127 0 - - - 0;
#X floatatom 627 201 0 1 64 0 - - - 0;
#X floatatom 570 291 5 0 0 0 - - - 0;
#X floatatom 45 218 4 0 127 0 - - - 0;
#X floatatom 162 221 4 0 127 0 - - - 0;
#X floatatom 273 246 4 0 127 0 - - - 0;
#X floatatom 289 217 4 0 127 0 - - - 0;
#X floatatom 387 425 4 0 127 0 - - - 0;
#X floatatom 350 447 4 0 127 0 - - - 0;
#X floatatom 127 423 4 0 127 0 - - - 0;
#X floatatom 241 423 4 0 127 0 - - - 0;
#X floatatom 69 552 4 0 127 0 - - - 0;
#X floatatom 241 560 4 0 127 0 - - - 0;
#X floatatom 108 552 4 0 127 0 - - - 0;
#X floatatom 411 550 4 0 127 0 - - - 0;
#X floatatom 457 556 4 0 127 0 - - - 0;
#X floatatom 336 560 4 0 127 0 - - - 0;
#X floatatom 956 196 4 0 127 0 - - - 0;
#X floatatom 848 196 4 0 127 0 - - - 0;
#X floatatom 709 217 4 0 127 0 - - - 0;
#X floatatom 690 191 4 0 127 0 - - - 0;
#X floatatom 591 201 4 0 127 0 - - - 0;
#X floatatom 553 201 4 0 127 0 - - - 0;
#X floatatom 685 291 4 0 127 0 - - - 0;
#X floatatom 789 291 4 0 127 0 - - - 0;
#X floatatom 905 291 4 0 127 0 - - - 0;
#X floatatom 945 291 4 0 127 0 - - - 0;
#X floatatom 746 251 0 1 64 0 - - - 0;
#X floatatom 305 184 0 1 64 0 - - - 0;
#X floatatom 215 220 0 1 64 0 - - - 0;
#X floatatom 65 193 0 1 64 0 - - - 0;
#X floatatom 72 423 0 1 64 0 - - - 0;
#X floatatom 287 423 0 1 64 0 - - - 0;
#X floatatom 424 403 0 1 64 0 - - - 0;
#X text 558 12 MIDI Input/Output objects;
#X obj 127 395 pgmin 2;
#X text 110 353 program change (channel 2), f 14;
#X text 73 444 ch;
#X text 289 443 ch;
#X text 20 444 value;
#X text 159 424 value;
#X text 233 443 value;
#X obj 526 40 cnv 1 540 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 7 671 cnv 1 1055 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#N canvas 502 23 566 293 reference 0;
#N canvas 686 71 588 563 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 199 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 253 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 39 16 notein;
#X text 135 58 NONE;
#X text 93 15 - MIDI note input;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 112 float - MIDI note pitch., f 27;
#X text 146 140 float - MIDI note velocity.;
#X obj 18 161 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 166 float - MIDI channel (if no argument is given).;
#X obj 18 336 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 453 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 489 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 525 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 154 462 NONE;
#X obj 18 395 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 367 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 372 float - MIDI note pitch., f 27;
#X text 146 400 float - MIDI note velocity.;
#X obj 18 421 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 29 306 noteout;
#X text 93 305 - MIDI note output;
#X text 146 426 float - MIDI channel.;
#X text 55 224 1) float - sets MIDI channel and suppresses 3rd outlet (default OMNI)., f 70;
#X text 141 498 1) float - sets MIDI channel/port (default 1).;
#X restore 383 19 pd reference;
#X obj 230 19 notein;
#X text 350 20 ==>;
#X obj 286 19 noteout;
#N canvas 692 23 584 587 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 196 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 270 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 161 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 168 float - MIDI channel (if no argument is given).;
#X obj 18 356 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 473 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 509 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 567 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 174 482 NONE;
#X obj 39 16 ctlin;
#X text 89 15 - MIDI control input;
#X text 146 112 float - control value., f 27;
#X obj 29 326 ctlout;
#X text 83 325 - MIDI control output;
#X text 146 140 float - MIDI control number (if no argument is given).;
#X obj 17 415 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 387 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 441 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X text 165 392 float - control value., f 27;
#X text 165 420 float - MIDI control number.;
#X text 139 519 1) float - sets control number (default 0)., f 46;
#X text 55 221 1) float - sets control number and suppresses 2nd outlet (default ALL)., f 71;
#X text 55 241 2) float - sets MIDI channel and suppresses 3rd outlet (default OMNI)., f 70;
#X text 165 448 float - MIDI channel.;
#X text 140 539 2) float - sets MIDI channel/port (default 1).;
#X restore 383 59 pd reference;
#X text 350 60 ==>;
#X obj 242 59 ctlin;
#X obj 292 59 ctlout;
#N canvas 706 82 584 551 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 172 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 226 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 144 float - MIDI channel (if no argument is given).;
#X obj 18 356 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 450 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 486 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 527 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 174 459 NONE;
#X obj 17 415 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 387 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 155 392 float - control value., f 27;
#X obj 39 16 bendin;
#X text 92 15 - MIDI pitch bend input.;
#X text 55 197 1) float - sets MIDI channel and suppresses 2nd outlet (default OMNI)., f 70;
#X text 146 112 float - pitch bend value., f 27;
#X obj 29 326 bendout;
#X text 155 420 float - MIDI channel number.;
#X text 93 325 - MIDI pitch bend output;
#X text 130 497 1) float - sets MIDI channel/port (default 1).;
#X restore 383 95 pd reference;
#X text 350 96 ==>;
#X obj 228 95 bendin;
#X obj 284 95 bendout;
#N canvas 706 82 584 554 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 172 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 226 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 144 float - MIDI channel (if no argument is given).;
#X obj 18 356 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 450 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 486 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 527 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 174 459 NONE;
#X obj 17 415 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 387 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 55 197 1) float - sets MIDI channel and suppresses 2nd outlet (default OMNI)., f 71;
#X text 155 420 float - MIDI channel number.;
#X obj 39 16 pgmin;
#X obj 29 326 pgmout;
#X text 93 325 - MIDI program output;
#X text 92 15 - MIDI program input.;
#X text 130 497 1) float - sets MIDI channel/port (default 1).;
#X text 146 112 float - program value (from 1 to 128).;
#X text 155 392 float - program value (from 1 to 128).;
#X restore 383 131 pd reference;
#X text 350 132 ==>;
#X obj 242 131 pgmin;
#X obj 291 131 pgmout;
#N canvas 706 82 584 561 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 172 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 226 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 144 float - MIDI channel (if no argument is given).;
#X obj 18 356 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 450 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 486 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 527 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 174 459 NONE;
#X obj 17 415 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 387 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 55 197 1) float - sets MIDI channel and suppresses 2nd outlet (default OMNI)., f 70;
#X text 155 420 float - MIDI channel number.;
#X obj 39 16 touchin;
#X text 104 16 - MIDI channel aftertouch input.;
#X text 146 112 float - channel aftertouch value.;
#X obj 29 326 touchout;
#X text 93 325 - MIDI channel aftertouch output.;
#X text 155 392 float - channel aftertouch value.;
#X text 130 497 1) float - sets MIDI channel/port (default 1).;
#X restore 383 168 pd reference;
#X text 350 169 ==>;
#X obj 217 168 touchin;
#X obj 277 168 touchout;
#N canvas 666 100 588 554 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 196 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 250 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 135 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 161 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 166 float - MIDI channel (if no argument is given).;
#X obj 18 336 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 453 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 489 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 525 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 154 462 NONE;
#X obj 18 395 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 367 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 421 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #7c7c7c #000000 0;
#X text 146 426 float - MIDI channel.;
#X text 55 221 1) float - sets MIDI channel and suppresses 3rd outlet (default OMNI)., f 70;
#X obj 39 16 polytouchin;
#X text 133 16 - MIDI polyphonic aftertouch input.;
#X obj 29 306 polytouchout;
#X text 131 305 - MIDI polyphonic aftertouch output.;
#X text 146 112 float - aftertouch value., f 27;
#X text 146 140 float - MIDI note pitch.;
#X text 146 372 float - aftertouch value., f 27;
#X text 146 400 float - MIDI note pitch.;
#X text 141 498 1) float - sets MIDI channel/port (default 1).;
#X restore 383 209 pd reference;
#X text 350 210 ==>;
#X obj 160 209 polytouchin;
#X obj 250 209 polytouchout;
#X obj 64 247 midiin;
#X obj 226 247 sysexin;
#X obj 118 247 midirealtimein;
#X obj 284 247 midiout;
#N canvas 658 145 583 559 reference 0;
#X obj 18 46 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 83 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 199 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 17 233 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 135 58 NONE;
#X obj 18 162 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 107 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 336 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 450 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 486 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 523 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 174 459 NONE;
#X obj 17 415 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 367 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 33 12 midiin;
#X obj 195 12 sysexin;
#X obj 87 12 midirealtimein;
#X text 156 208 none;
#X text 146 171 float - port number.;
#X text 70 116 float -;
#X obj 29 306 midiout;
#X text 259 13 - raw \, realtime and sysex input.;
#X text 155 420 float - port number.;
#X text 174 494 NONE;
#X text 155 372 float - raw MIDI stream.;
#X text 162 392 list - MIDI packets.;
#X text 87 305 - raw MIDI output (including real time and sysex).;
#X text 128 117 midiin: raw MIDI (except real-time messages) \, midirealtimein: real-time messages \, sysexin: system exclusive messages., f 61;
#X restore 383 246 pd reference;
#X text 350 247 ==>;
#X restore 856 9 pd reference;
#X text 954 10 <= click;
#X obj 526 4 cnv 1 1 35 empty empty empty 8 12 0 13 #000000 #000000 0;
#X floatatom 792 594 4 0 0 0 - - - 0;
#X text 566 573 In order to use MIDI Input or output objects \, be sure to set MIDI devices in:, f 26;
#X text 607 621 Preferences --> MIDI;
#X msg 792 565 144 \, 68 \, 120;
#X text 889 559 note on as a stream of raw MIDI., f 19;
#X text 917 595 note off as a MIDI packet list, f 18;
#X text 546 498 Raw MIDI output is provided by [midiout]. It deals with a stream of floats or MIDI packet lists. It doesn't take arguments and the 2nd inlet sets port number. You can use [midiout] to send raw real-time and sysex messages as well., f 70;
#X text 75 166 *;
#X text 81 394 **;
#X text 184 394 ***;
#X text 599 241 *;
#X text 625 316 **;
#X text 734 316 ***;
#X text 546 418 ** Known bug: [bendin] and [bendout] are inconsistent ([bendin] outputs values from 0 to 16383 and [bendout] takes values from -8192 to 8191) - this won't change., f 70;
#X text 546 465 *** Program change values in [pgmin] and [pgmout] are indexed from 1 \, which means that the possible values are from 1 to 128 (not 0 to 127)!, f 70;
#X text 546 357 * Release velocity is not supported \, [noteout] only sends Note On velocities and for [notein] a release velocity becomes 0 (commonly interpreted as a "note off"). Tru "note off" messages are still supported via [midiin] and [midiout]., f 70;
#X msg 836 602 128 68 100;
#X text 16 578 raw MIDI byte by byte except real-time messages (sysex supported), f 28;
#X text 357 637 <-- Open for MPE support;
#N canvas 283 38 1024 708 MPE_(MIDI-POLYPHONIC-EXPRESSION) 0;
#X obj 247 207 ctlin;
#X obj 238 285 list prepend;
#X obj 327 558 bendin;
#X listbox 238 311 12 0 0 0 - - - 0;
#X obj 238 420 route 74;
#X obj 238 237 swap;
#X text 331 312 channel \, controller # \, value;
#X floatatom 238 451 5 0 0 0 - - - 0;
#X obj 115 587 swap;
#X listbox 115 641 11 0 0 0 - - - 0;
#X obj 111 555 touchin;
#X obj 52 236 notein;
#X obj 46 303 list prepend;
#X obj 46 273 pack;
#X listbox 69 415 9 0 0 0 - - - 0;
#X listbox 93 392 9 0 0 0 - - - 0;
#X listbox 117 369 9 0 0 0 - - - 0;
#X listbox 46 438 9 0 0 0 - - - 0;
#X obj 813 55 poly;
#X obj 637 579 route note cc touch bend;
#X listbox 637 679 11 0 0 0 - - - 0;
#X listbox 678 655 11 0 0 0 - - - 0;
#X listbox 719 631 11 0 0 0 - - - 0;
#X listbox 760 608 11 0 0 0 - - - 0;
#X text 558 19 When dealing with polyphonic synths in Pure Data \, you'll probably use [clone]. An example for that is given in the help file of [poly]. Check it out., f 61;
#X text 874 208 see also:;
#X obj 890 232 clone;
#X listbox 637 514 14 0 0 0 - - - 0;
#X obj 643 216 notein;
#X obj 637 282 list prepend;
#X obj 637 253 pack;
#X obj 718 247 list append note;
#X obj 752 277 ctlin;
#X obj 743 350 list prepend;
#X obj 743 303 swap;
#X obj 824 312 list append cc;
#X obj 767 383 touchin;
#X obj 767 408 list prepend;
#X obj 848 376 list append touch;
#X obj 791 477 list prepend;
#X obj 791 442 bendin;
#X obj 872 445 list append bend;
#X text 701 546 messages for "voice 1";
#X obj 115 614 pack;
#X obj 327 587 swap;
#X listbox 327 641 11 0 0 0 - - - 0;
#X obj 327 614 pack;
#X text 21 18 MIDI Polyphonic Expression (MPE) enables MIDI messages for independent voices and uses MIDI channel to distinguish them. Usually Channel 1 is used for global messages for all voices and the remaining channels (usually Channels 2–16) are used to transmit notes and expressive data., f 71;
#X obj 46 342 route 2 3 4 5, f 14;
#X obj 238 347 route 2 3 4 5, f 30;
#X obj 115 666 route 2 3 4 5;
#X obj 327 669 route 2 3 4 5;
#X text 21 89 Pure Data does not have any special object to deal with MPE \, but this subpatch shows a simple strategy to deal with it using regular MIDI objects. Below to the left we prepend the channel number to route Note On messages. We them route by MIDI channel (which corresponds to the voice number). Below to the left we route midi notes and to the right we make a list that starts with the MIDI channel \, then controller number and value. You can furtherly route by controller number and 74 is commonly used in MPE., f 71;
#X text 337 420 Note that if you have a controller in Port 2 \, you should route from channel "18" instead \, or from "34" if Port 3 \, and so on..., f 35;
#X text 73 495 Aftertouch and pitch bend are also common messages used in MPE. You can have up to 15 voices/channels in MPE \, but in these examples we're only considering 4 channels/voices.;
#X obj 637 545 route 2;
#X text 558 82 So instead of using [route] to access independent data for each voice \, you can just send the list directly into [clone] \, which routes the message to different cloned copies of an abstraction (use the flag "-s 2" to route from channel 2). You should then tag each MIDI message so they can be routed and managed inside the abstraction. The example below shows a template for that. The [route 1] object gets messages for "voice 1" and its output relates to the inlet of a [clone] object., f 61;
#X obj 238 261 pack;
#X listbox 289 385 6 0 0 0 - - - 0;
#X listbox 341 385 6 0 0 0 - - - 0;
#X listbox 393 385 6 0 0 0 - - - 0;
#X obj 743 326 pack;
#X connect 0 0 5 0;
#X connect 0 1 5 1;
#X connect 0 2 1 1;
#X connect 1 0 3 0;
#X connect 2 0 44 0;
#X connect 2 1 44 1;
#X connect 3 0 49 0;
#X connect 4 0 7 0;
#X connect 5 0 57 0;
#X connect 5 1 57 1;
#X connect 8 0 43 0;
#X connect 8 1 43 1;
#X connect 9 0 50 0;
#X connect 10 0 8 0;
#X connect 10 1 8 1;
#X connect 11 0 13 0;
#X connect 11 1 13 1;
#X connect 11 2 12 1;
#X connect 12 0 48 0;
#X connect 13 0 12 0;
#X connect 19 0 20 0;
#X connect 19 1 21 0;
#X connect 19 2 22 0;
#X connect 19 3 23 0;
#X connect 27 0 55 0;
#X connect 28 0 30 0;
#X connect 28 1 30 1;
#X connect 28 2 31 0;
#X connect 29 0 27 0;
#X connect 30 0 29 0;
#X connect 31 0 29 1;
#X connect 32 0 34 0;
#X connect 32 1 34 1;
#X connect 32 2 35 0;
#X connect 33 0 27 0;
#X connect 34 0 61 0;
#X connect 34 1 61 1;
#X connect 35 0 33 1;
#X connect 36 0 37 0;
#X connect 36 1 38 0;
#X connect 37 0 27 0;
#X connect 38 0 37 1;
#X connect 39 0 27 0;
#X connect 40 0 39 0;
#X connect 40 1 41 0;
#X connect 41 0 39 1;
#X connect 43 0 9 0;
#X connect 44 0 46 0;
#X connect 44 1 46 1;
#X connect 45 0 51 0;
#X connect 46 0 45 0;
#X connect 48 0 17 0;
#X connect 48 1 14 0;
#X connect 48 2 15 0;
#X connect 48 3 16 0;
#X connect 49 0 4 0;
#X connect 49 1 58 0;
#X connect 49 2 59 0;
#X connect 49 3 60 0;
#X connect 55 0 19 0;
#X connect 57 0 1 0;
#X connect 61 0 33 0;
#X restore 100 637 pd MPE_(MIDI-POLYPHONIC-EXPRESSION);
#X text 20 685 see also:;
#X obj 97 686 poly;
#X obj 138 686 clone;
#X obj 188 686 makenote;
#X msg 542 158 60 127 5;
#X text 608 157 note \, velocity \, channel;
#X text 551 182 note;
#X text 591 182 vel;
#X text 627 181 ch;
#X obj 542 240 noteout;
#X text 537 51 MIDI OUTPUTS: Port number is encoded as the channel number in the same way as the input objcets. By default you have channel 1 and you can also change it with arguments or the rightmost inlet. The [ctlout] object also takes a controller number argument/inlet. Inlets are not suppressed by arguments and change the parameters. A list input spreads values into the inlets as usual in Pd., f 73;
#X connect 7 0 71 0;
#X connect 7 1 73 0;
#X connect 8 0 74 0;
#X connect 8 1 75 0;
#X connect 10 0 72 0;
#X connect 10 1 76 0;
#X connect 11 0 70 0;
#X connect 11 1 92 0;
#X connect 12 0 68 0;
#X connect 12 1 67 0;
#X connect 12 2 93 0;
#X connect 13 0 60 0;
#X connect 13 1 63 0;
#X connect 13 2 90 0;
#X connect 16 0 65 0;
#X connect 16 1 66 0;
#X connect 16 2 88 0;
#X connect 25 0 64 0;
#X connect 25 1 89 0;
#X connect 30 0 28 0;
#X connect 30 1 31 0;
#X connect 46 0 2 0;
#X connect 46 1 91 0;
#X connect 52 0 22 0;
#X connect 61 0 136 2;
#X connect 62 0 1 0;
#X connect 77 0 56 0;
#X connect 78 0 37 0;
#X connect 79 0 4 1;
#X connect 80 0 4 0;
#X connect 81 0 136 1;
#X connect 82 0 136 0;
#X connect 83 0 0 0;
#X connect 84 0 5 0;
#X connect 85 0 6 0;
#X connect 86 0 6 1;
#X connect 87 0 4 2;
#X connect 95 0 69 0;
#X connect 107 0 9 0;
#X connect 110 0 107 0;
#X connect 123 0 9 0;
#X connect 131 0 136 0;
