• Make a sound: contrast with analysis, effects

  • Many popular approaches

    • Wavetables

    • Additive / Subtractive

    • Frequency Modulation

    • Some really fancy stuff

  • Today: MIDI (synth control) and Wavetables


  • A "note" is a sound with a fixed frequency

  • Briefly: Western music uses a "12-tone scale"

    • Remember that the ear hears frequency on log / exp scale

    • An "octave" is a frequency that is twice some other frequency

    • We divide an octave into 12 parts: with a base frequency f, we have

    $$ note_i(f) = f \cdot 2^{i/12} $$

  • For example:

    \begin{eqnarray*} note_0(f) &=& f \\ note_{12}(f) &=& 2f \\ note_{-24}(f) &=& \frac{f}{4} \end{eqnarray*}

  • There is a bunch of music theory here for future

Key Numbers, Note Names

  • For Western scales, the base frequency is 440Hz, because reasons

  • We can use a numbering based on piano keys as a standard: MIDI "key number"

  • In MIDI 440Hz A is key 69; we call this the A in "octave 4" or A4

  • We give the notes letter names with a possible "sharp" or "flat" modifier

      Key   Freq    Name    Octave
      69    440     A       4
      70    466.16  B♭/A♯
      71    493.88  B
      72    523.25  C
      73    554.37  D♭/C♯
      74    587.33  D
      75    622.25  E♭/D♯
      76    659.26  E
      77    698.46  F
      78    739.99  F♯/G♭
      79    783.99  G
      80    830.61  A♭/G♯
      81    880     A       5
  • The "why" of all this is a future lecture

Note Timing

  • Notes start at a particular time, have a particular duration (how long they continue to play)

  • For now, will think of this as an "on time" and "off time" for the note

  • There's a whole complicated theory here, but we don't need it yet

  • Typically start times are 4 to 30ms apart or thereabouts, durations are 4ms and up

  • Notes may overlap: "polyphony". Some instruments (including some synths) are monophonic: one note at a time, so start of next note is end of current


  • Musical Instrument Digital Interface (MIDI, requires free registration): ancient unidirectional standard for keyboard to synth communication (Prophet 600, 1982); replaced analog "control voltage" schemes

  • "Instrument" is a synth. "Controller" is a keyboard or something

  • Physical interface is…a thing. Two-wire interface on 5-pin DIN connector (also AT keyboard connector). 5ma current loop with optical isolation required. 31250 bps (halfway between 19200 and 38400, ugh) 8N1 (like modem baseband)

  • USB MIDI Device Class trades jitter and (maybe) latency for simplicity and throughput; MIDI←→USB interfaces are cheap

MIDI Protocol

  • 1-3 byte messages

    • 1st byte is "Status Byte" with high bit set,

    • Rest are data bytes

    • Special case: "System Exclusive" messages are arbitrary length, terminated by status message (usually EOX)

  • 16 "channels" used to address specific instruments: management can get fairly complicated. "Thru" in standard MIDI for chaining instruments; latency is a thing here

  • Key messages (pun intended): Note-On, Note-Off. These can have "velocity" of press and release encoded

  • Support for pitch bend, continuous controllers, pushbuttons. Volume, Balance, Pan, Expression etc are standardized

  • Bank / Program / Patch support for changing instrument sound

  • Much, much more: read the spec

MIDI Timing, Sequencing, "MIDI Files"

  • Keyboards are realtime, but MIDI can handle

    • Synchronizing messages to specific times

    • Driving a sequencer on-beat

    • Playing MIDI files: standard format for timed MIDI messages

Working With MIDI

  • Get a library. This stuff gets a bit complicated

  • For a controller: figure out what you want to be able to make an instrument do; figure out what minimum set of messages will make an instrument do that

  • For an instrument: figure out what you want the instrument be able to do; figure out what message you have to and are willing to respond to

  • Start bare-bones, add functionality incrementally

Last modified: Thursday, 2 May 2019, 4:22 PM