In this assignment, we are going to build a simple MIDI keyboard in Max using the computer keyboard as inputs. You will be using the key and keyup objects to detect the computer keyboard inputs. You should use the key object to detect whether a key is pressed and send a MIDI note-on event. Similarly, you should use the keyup object to detect if a key is released and send a MIDI note-off event. Your MIDI keyboard should support the keys “asdfghjk” as middle C to high C, and the keys “wetyu” as C#, D#, F#, G#, and A#. Also, it should support playing multiple pitches at the same time, i.e., polyphony.
Next, please include a umenu object that allows the users to select the instrument from a drop-down menu. The patch should support piano (program 1), guitar (program 25), bass (program 33), strings (program 49), drums (channel 10) and optionally other instruments you like. Note that when the user selects the drums, the MIDI pitch should start from 35 rather than 60 so that we get an acoustic bass drum sound when pressing the key “a”, a snare drum sound for the key “e”, and a closed hi-hat sound for the key “g”. Moreover, make sure that your Max patch works when switching to the drums and back to another instrument, i.e., you need to reset the MIDI channel.
send and receive objects useful to avoid long cords.== object useful for value comparison.switch, gate, and select objects useful for conditionals.