> For the complete documentation index, see [llms.txt](https://benjohansen.gitbook.io/musictech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://benjohansen.gitbook.io/musictech/old-1/midi-exercise.md).

# MIDI Exercise

{% hint style="success" %}
**Objective: discover how MIDI works**
{% endhint %}

1. make sure your MIDI keyboard is plugged in and on
   * Note: nothing in this exercise makes sound
2. open Pd.app (search for it in spotlight or in the applications folder)
   * click the "Yes" button when asked "Do you want Pd to create a documents directory ..."
3. from the "Media" menu at the top of the screen, choose "MIDI Settings..."
   * choose the MIDI keyboard hooked to your computer under "Input Devices"
   * you may have to click on "none" for the keyboard to be revealed
   * click the "Save All Settings" button
   * click the "OK" button
4. use the keyboard shortcut \[command+N] to start a new patch
5. recreate the patch below

   * use \[command+1] to add a new "Object"
     * type the object name
     * then click the mouse anywhere in the new patch except on the new "Object" in order to finalize the object creation
   * use \[command+3] to add a number object
   * hover over outlet of an object, click and drag to draw patch cable to input of another object

   When you are done with creating the patch, discover all you can about MIDI protocol:

   * monitor the values displayed as you experiment with all parts of the MIDI keyboard controller (keys, notebend, faders, knobs, etc.)
   * be ready to discuss what you discovered

![](http://benjohansen.com/images/pd_midi-input_2x.png?crc=507509451)

## wait to have a class discussion before moving on

## message format

![note on](https://2250194572-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LroRRcyiuzPub4SVHLq%2F-M-Lb4H5A0KTeAElOqTe%2F-M-Lcy_88katYM9f9CDF%2Fmidi-note-on.png?alt=media\&token=c4946904-884a-4ad9-a4fa-09a242628a90)

![pitch bend](https://2250194572-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LroRRcyiuzPub4SVHLq%2F-M-Lb4H5A0KTeAElOqTe%2F-M-Ld2LGs6SR9_eDeIWm%2Fmidi-pitch-ben.png?alt=media\&token=897f35db-1621-4498-903d-7ebec88a75bc)

## AM Synth (Amplitude Modulation Synthesizer)

recreate the patch below (turn on digital signal processing (DSP) and play the MIDI keyboard / turn knobs):

![](https://2250194572-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LroRRcyiuzPub4SVHLq%2F-LzrfdjPg_knai9_oibi%2F-LzrfnlOstMVZOqGgoqw%2Fpd_am-monophonic.png?alt=media\&token=d942484b-7368-404e-9353-f590e8837691)

{% file src="/files/-M-LaaL4mcTeMR6vUQKL" %}
AM Synth Pure Data patch (no MIDI control like the above)
{% endfile %}

## FM (Frequency Modulation)

{% hint style="warning" %}
How can you control the FM patch below with MIDI?
{% endhint %}

![](https://2250194572-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LroRRcyiuzPub4SVHLq%2F-LzrfdjPg_knai9_oibi%2F-LzrgYGCrkNdAkPYKSUY%2FScreen%20Shot%202020-01-30%20at%2012.23.34%20PM.png?alt=media\&token=c7efeb4b-a3a7-4273-a9ef-e4368c391157)

{% file src="/files/-M-LamYoE7iH7WpaznCb" %}
FM Synth Pure Data patch
{% endfile %}
