MIDI Part 1

Interfacing with the world of music hardware

This lecture introduces the MIDI protocol for interfacing with other music hardware.

Table of contents

  1. What you’ll learn in this lecture
  2. What you’ll make in this lecture
  3. Code examples
  4. Recommended parts
  5. Further reading

Lecture 15: MIDI Part 1

What you’ll learn in this lecture

  • Introduction to the MIDI protocol
  • Handling Note On and Note Off messages
  • Keeping track of multiple notes

What you’ll make in this lecture

  • Monophonic MIDI synth with ADSR envelope

Code examples

Find the code examples here

midi-sinetone: Simple monophonic MIDI synth generating sine waves.

midi-multinote: Extends the midi-sinetone project to keep track of multiple keypresses, so that it always plays the most recently pressed key and handles key releases gracefully.

midi-adsr: Project using ADSR envelopes for amplitude and filter cutoff frequency, controlled by MIDI. See Lecture 14 for details on ADSR.

Running the examples in this course assumes that you have a Bela Starter Kit or Bela Mini Starter Kit.

This lecture requires a source of MIDI input, either a keyboard attached to the USB port of Bela or virtual keyboard software which can send MIDI messages to Bela from the host computer. The following software MIDI generators will work:

  • MidiKeys for MacOS X
  • vmpk, a cross-platform MIDI generator

Further reading