Getting Started with MIDI
This is a video on getting started with MIDI in Max. While working with MIDI in Max, one of the first objects that you might come across is the notein object. By default, the notein object will listen to the MIDI hardware devices connected to the host computer. It has three outlets that will output Pitch, Velocity, and MIDI Channel. If we lock the patch and double click the object, or Command double click (Ctrl double click on Windows), we will see the devices listed - in this case I see my audio interface, my MDP218 MIDI controller, and two virtual ports created by Max (check loopMIDI for virtual MIDI ports on Windows). If I start pushing buttons on my MIDI controller, you'll see values changing. Here, I'm holding MIDI note number 73, with velocity 72. And then, when it goes to zero, it means that I've released this key. Here I'm holding MIDI note number 69, with velocity 34. Besides seeing note numbers on message boxes, we can also visualize this information using a kslider. Let's set it to @mode 1, to see multiple notes at the same time (aka poly mode), and change the color of active keys (using @hkeycolor attribute) to blue ("0 0 1" here means 0 red, 0 green, and 1 blue). We connect the picth and velocity, and now we can visualize the incoming MIDI notes. There is also a noteout object, which in turn has three inlets, for Pitch, Velocity, and MIDI Channel. If we lock the patch and double click, we can see the list of possible outputs. By default, it will select the built-in MIDI Synthesizer - AU DLS, or Microsoft GS Wavetable synth. Let's take a listen. We can also change this instrument by using the pgmout object and sending it an integer. Say, we would like to listen to Tubular Bells... or to get back to the piano. We don't necessarily need a MIDI controller in order to play with MIDI in Max. We can also use the object makenote to create notes for us. The makenote object will output Pitch and Velocity, and will manage the Note On and Note Off events, just by receiving a MIDI note number message. Another important object is the midiin object. Unlike the notein object, midiin object only has one outlet, for Raw MIDI messages. In order to unpack these MIDI messages, we can use the midiparse object. If we lock the patch and double click the midiin object, we can see the list of possible devices. Let's select my MIDI controller. midiparse can output MIDI pitch and velocity pairs (a list), Poly Key Pressure, Control Change - as in the values from the knobs of my MIDI controller -, Program Change, Aftertouch - as in the information when I'm holding a key and changing the pressure with which I'm holding this key -, and many more. After we're done with changing these values, we can format these messages back into a MIDI message using the midiformat object. And finally, we can use this MIDI message to send it out using the midiout object.