Music 250a -- Lecture 4

Microcontrollers, Communication Standards, MIDI, Basic Electronics, and Lab Kits

Romain Michon and Doga Cavdir (TA)


Teensy 3.2

  • Cotex-M4 (96MHz)
  • 256 kbytes of flash memory
  • 64 kbytes of RAM
  • 34 Digital I/O
  • 21 Analog inputs
  • 1 12 bits PWM DAC

Why do we use the Teensy in this class? What are the other options?

The Raspberry Pi and the Teensy work well together

Teensy audio adapters stacked together

The BELA: good solution for low latency audio

SHARC Audio Module (Analog Devices)

Stanford DSP Shield (Fixed Point :(( )

FPGA Boards (here Atlys Spartan-6)

Microcontrollers Communication Strategies


  • Most "standard" way to transmit data between DMIs
  • Old: 1983
  • 16 channels, 7 bits data, 31,250 bits/sec
  • Transmitted through dedicated MIDI connectors, USB or BlueTooth
  • Simple, portable, and sufficient for most applications
  • Some microcontrollers (i.e., the Teensy) provide built-in MIDI support


  • "MIDI Polyphonic Expression"
  • Based on MIDI
  • Facilitate the continuous control of the parameters of a specific note by associating it to a dedicated MIDI channel
  • Used by various modern MIDI interfaces (e.g., ROLI Seaboard, LinnStrument, Continuum, etc.)
  • A bit tough to implement because of a lack of standardization


  • Most microcontrollers provide serial communication support over USB
  • General standard: not specific to music
  • Bits are sent one by one: bit depth is flexible
  • When used over USB, faster than MIDI
  • Needs to be decoded on the receiver system: usually requires some extra work compared to MIDI


  • "User Datagram Protocol"
  • Data is sent as packets
  • Used in network communication (typically transmitted over Ethernet or Wifi)
  • When used with microcontrollers, requires a specific shield (sister board) for Ethernet or Wifi
  • Benefits from high speed network connection
  • Requires the receiver to implement a decoder for the packets


  • "Open Sound Control" (inventor: "our own" Matt Wright)
  • Based on UDP
  • Seen as a "modern" alternative to MIDI
  • Specifically designed for musical interfaces but used in other fields too
  • System of addresses (paths) and values: each parameter of a synthesizer has an address (string) associated to it
  • Values can be of different types and bundles can be sent too

Analog Audio Communication

  • Consists of sending sensor data through analog audio (i.e., audio jack, etc.)
  • Very universal: can be handy when working with smartphones
  • Various techniques can be used: Amplitude Modulation (AM), Modem, etc.
  • Some microcontrollers (i.e., Teensy) have a built-in DAC which can be used for this type of tasks


Most Common MIDI Message Types

usbMIDI.sendNoteOn(note, velocity, channel);
usbMIDI.sendNoteOff(note, velocity, channel);
usbMIDI.sendAfterTouchPoly(note, pressure, channel);
usbMIDI.sendControlChange(control, value, channel);
usbMIDI.sendProgramChange(program, channel);
usbMIDI.sendAfterTouch(pressure, channel);
usbMIDI.sendPitchBend(value, channel);

Here from the Teensy USB Library

Towards Lab 2