#N canvas 354 23 567 647 10;
#X obj 4 348 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 4 412 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 4 555 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 80 533 cnv 17 3 17 empty empty 6 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 357 cnv 17 3 50 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 437 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 456 cnv 17 3 17 empty empty 2 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 475 cnv 17 3 17 empty empty 3 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 494 cnv 17 3 17 empty empty 4 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 513 cnv 17 3 17 empty empty 5 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 80 418 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 63 135 midiin;
#X text 131 562 (none);
#X obj 4 636 cnv 1 550 1 empty empty empty 0 0 0 4 #fcfcfc #fcfcfc 0;
#X obj 4 615 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X text 160 475 -;
#X text 120 475 float;
#X text 160 495 -;
#X text 120 495 float;
#X text 160 514 -;
#X text 120 514 float;
#X text 160 533 -;
#X text 120 533 float;
#X text 160 418 -;
#X text 127 418 list;
#X text 160 437 -;
#X text 127 437 list;
#X text 160 456 -;
#X text 127 456 list;
#X text 160 356 -;
#X text 121 356 float;
#X text 160 374 -;
#X text 127 374 bang;
#X obj 63 187 unpack;
#X text 175 356 raw MIDI data stream;
#X text 175 456 <value/controller number> pairs from control messages, f 60;
#X text 175 437 <aftertouch/pitch> pairs from polyphonic aftertouch messages;
#X text 175 418 <pitch/velocity> pairs from note messages, f 60;
#X text 175 475 value from program change messages, f 60;
#X text 175 495 value from channel aftertouch messages, f 60;
#X text 175 514 value from pitch bend messages, f 60;
#X text 175 533 the MIDI channel number from raw MIDI message, f 60;
#X text 123 90 [midiparse] receives raw MIDI data and retrieves different MIDI messages from it.;
#X text 109 134 <= MIDI from a controller;
#X obj 402 216 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 345 216 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 289 216 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 232 217 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 63 227 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 73 208 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 119 187 unpack;
#X obj 119 227 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 129 208 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 176 187 unpack;
#X obj 176 227 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 186 208 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#N canvas 696 108 498 480 examples 0;
#X obj 200 308 cyclone/midiformat;
#X obj 200 348 cyclone/midiparse;
#X text 67 163 [midiparse] is the counterpart of the [midiformat] object.;
#X obj 189 103 cyclone/midiparse, f 19;
#X obj 189 68 cyclone/seq;
#X text 53 22 [midiparse] is very useful to retrieve MIDI data from the [seq] object.;
#X obj 200 242 makenote 127 500;
#X obj 200 216 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 200 389 unpack float float;
#X obj 200 418 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 305 418 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 200 269 pack float float;
#X connect 0 0 1 0;
#X connect 1 0 8 0;
#X connect 4 0 3 0;
#X connect 6 0 11 0;
#X connect 6 1 11 1;
#X connect 7 0 6 0;
#X connect 8 0 9 0;
#X connect 8 1 10 0;
#X connect 11 0 0 0;
#X restore 476 170 pd examples;
#X obj 63 163 cyclone/midiparse @hires 2, f 57;
#N canvas 492 270 795 404 hires 0;
#X text 420 12 The Pitch Bend message is composed of 3 numbers.;
#X text 420 34 The first one determines it's a Pitch Bend message and it is 224 for channel 1 (225 for channel 2 \, and so on up to 239 for channel 16).;
#X text 420 80 Then we have the two subsequent numbers that decode the Pitch Bend Value. First there's the Least Significant Byte and then the Most Significant Byte.;
#X text 420 127 The 7 bit messages set only the Most Significant Byte.;
#X text 85 155 Check the formatted Pitch Bend messages below:;
#X text 18 12 By default \, [midiparse] retrieves a low resolution 7 bit (values from 0 to 127) for Pitch Bend messages \, but the 'hires' message or attribute sets to a high resolution of 14 bits \, which has been the usual resolution for Pitch Bend messages for a long time.;
#X text 18 90 The possible values are 0 (default \, 7 bits) \, 1 (14 bit as float values from -1 to 1) and 2 (14 bits as integer values from -8192 to 8191). The [midiformat] object \, which is the counterpart \, also has the same parameters.;
#X msg 361 270 hires \$1;
#X obj 361 197 vradio 15 1 0 3 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0;
#X floatatom 361 247 5 0 0 0 - - - 0;
#X obj 496 215 hsl 128 15 -1 1 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 493 240 nbx 8 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 424 187 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 421 213 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 588 240 hsl 128 15 -8192 8191 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 585 264 nbx 6 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 361 301 cyclone/midiformat @hires 2;
#X text 87 197 0) 7 bit (integers from 0 to 127 \, default) =>;
#X text 87 212 1) 14 bit (floats from -1 to 1) ============>;
#X text 87 227 2) 14 bit (integers from -8192 to 8191) ====>;
#X obj 468 361 nbx 8 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 341 333 cyclone/midiparse @hires 2;
#X text 376 360 Pitch Bend ==>;
#X text 591 240 14 bit -8192 to 8191;
#X text 445 187 7 bit 0 to 127;
#X text 512 215 14 bit -1 to 1;
#X connect 7 0 16 0;
#X connect 7 0 21 0;
#X connect 8 0 9 0;
#X connect 9 0 7 0;
#X connect 10 0 11 0;
#X connect 11 0 16 5;
#X connect 12 0 13 0;
#X connect 13 0 16 5;
#X connect 14 0 15 0;
#X connect 15 0 16 5;
#X connect 16 0 21 0;
#X connect 21 5 20 0;
#X restore 494 193 pd hires;
#X obj 4 585 cnv 3 550 3 empty empty attribute 8 12 0 13 #dcdcdc #000000 0;
#X text 124 592 @hires <0 \, 1 \, 2> - pitch bend precision (see example above);
#X text 175 374 clears object's memory of received MIDI data;
#X text 162 391 -;
#X text 97 391 hires <f>;
#X text 177 391 sets 14-bit pitch bend input precision (see example above);
#X obj 2 2 ./header midiparse;
#X text 12 54 Retrieve MIDI messages;
#X text 58 247 Note in;
#X text 108 247 Poly touch;
#X text 178 246 Control;
#X text 228 234 Program;
#X text 280 234 Aftertouch;
#X text 352 233 Pitch Bend, f 5;
#X text 404 238 Channel;
#X text 28 298 see also:;
#N canvas 787 189 244 299 else 0;
#X obj 58 233 open-else;
#X text 60 18 click:;
#X msg 59 48 note.in;
#X msg 73 77 ctl.in;
#X msg 84 104 pgm.in;
#X msg 93 131 touch.in;
#X msg 106 155 ptouch.in;
#X msg 112 182 bend.in;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X connect 7 0 0 0;
#X restore 444 297 pd else alternatives;
#X f 12;
#X text 453 277 click:;
#X text 221 285 Plugdata users or those with ELSE can use dedicated objects like [else/note.in] as alternatives, f 33;
#X obj 91 299 cyclone/midiformat;
#X connect 11 0 57 0;
#X connect 33 0 48 0;
#X connect 33 1 49 0;
#X connect 50 0 51 0;
#X connect 50 1 52 0;
#X connect 53 0 54 0;
#X connect 53 1 55 0;
#X connect 57 0 33 0;
#X connect 57 1 50 0;
#X connect 57 2 53 0;
#X connect 57 3 47 0;
#X connect 57 4 46 0;
#X connect 57 5 45 0;
#X connect 57 6 44 0;
