Music Software Development

MIDI tutorial for programmers

Start with one event. Pressing middle C can send note number 60, channel 1 and velocity 100. An instrument decides what sound to make. Releasing that key should send an event for the same channel and pitch.

Try it in three steps

  1. Open the note calculator and compare 60 with 72. Both are C, and the second is one octave higher.
  2. Read the three message bytes and identify which number changes when you move to another MIDI channel.
  3. Make a pattern in the step sequencer, download the MIDI, and import it into a DAW track with an instrument assigned.

Live messages and files

Live receivers act when messages arrive or at their supplied timestamp. A Standard MIDI File adds delta times and other track data so a player can reconstruct the order and rhythm. Read the file-format walkthrough to see exactly where the timing goes.

When you get silence

Check the receiving instrument, routing and channel. If the file imports but playback is silent, assign an instrument. If releases disappear, log channel and note number together to find the mismatch.