HW 5: MIDI Keyboard

PAT 204/504: Creative Coding (Fall 2025)

Due at 11:59pm ET on October 29


Instructions


Q1: MIDI Keyboard (5pt)

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.

In addition, you Max patch should 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.

There are always many different ways to implement the same idea in Max, but some are cleaner than the other. Please try your best to make you code easy to follow.

Please submit both your Max patch and the video recording. You will receive zero credit if the code is missing. Zoom can be a good option for recording.


Hints


Hosted on GitHub Pages. Powered by Jekyll. Theme adapted from minimal by orderedlist.