Read The Bleepin’ Manual

MIDI Syntax: Robot Grammar 101

OnSong speaks fluent MIDI-nerd, & it does it with TEXT. ZOMG, words! While you can click around in the MIDI Events in the Metadata Editor like a normal human, you can also just type your MIDI commands out like the keyboard wizard you secretly are.

Stuff That Gets Separated

First & foremost, you can cram multiple MIDI commands together as long as you separate them with something: a tab, comma, semi-colon, vertical pipe, or a new line. Commas are the popular kid here. Srsly, just use commas. Example:

1.2:0@0, PC1.2:3@0, N67@1, START, SS8

Channel

Every entry can have an @ symbol. The number after it is the channel the command gets sent on. Since MIDI counts from zero (because of course it does), channel one is a zero (0), channel two is a one (1), etc. Math is hard. Blame MIDI.

Skip the @ symbol & the command goes out (or comes in) on ALL channels. Total chaos. Amirite?

Fancy Prefixes

Every entry in the list gets a prefix. This tells OnSong what kind of MIDI command you're blasting out. The lineup:

  • PC or No Prefix is a program change event. (Yup, lazy mode is built in.)
  • N is a note event. You know, the actual music part.
  • CC is a control change event.
  • NRPN is a non-register parameter number. Yeah, we don't know either. It's real tho.
  • SS is a song select event.
  • START is a start command. Wow, so deep.
  • STOP is a stop command. Even deeper.
  • CONTINUE is a continue command. Plot twist!
  • WAIT waits a specific amount of time before sending more events. Patience, young padawan.
  • F0 prefixes a SysEx message. Hex-y stuff ahead.
  • @ prefixes a MIDI global tag. We'll get to that. Hold your horses.

The Values (Dun Dun DUN)

The value of the command sits just before the @ symbol, or at the end of the entry if you didn't bother with an @. This is the number for the program change, control change, note, or song select, depending on the prefix. For SysEx entries, the hexadecimal value of the SysEx comes right after the F0 prefix, which is the header for ALL SysEx commands. Hex? Hexcellent.

Subvalues (Because One Number Wasn't Enough)

Sometimes a MIDI command needs to carry extra info as subvalues. MSB & LSB, plus the velocity of control values, all travel this way. You do it by adding a colon in the value part. The subvalue means different things depending on the command:

  • Program Change subvalues line up with the MSB/LSB of the program change. Separate them with a period, MSB on the left & LSB on the right. Don't mix them up. We'll know.
  • Control Change uses the subvalue as the value of the control. Pick a number between 0 and 127. Skip it & we'll assume 127, because we're dramatic like that. You can also string multiple values together with a hyphen to step through them. For instance, 127-0 latches the value between 127 & 0, on & off, like a light switch for nerds.
  • Note Event subvalues are about the velocity, aka how hard you smash that note. Pick any number between 0 and 127. Step through multiple velocities by separating them with a hyphen. Fancy.

Examples (Finally, Some Pictures. Kinda.)

Let's start easy with a program change. Here we use program change 8, which also sends an MSB of 4 & an LSB of 2 on channel 1. The example starts with the MOST complicated version & strips away the bank select & channel until it gets vague & broad, just like your weekend plans:

PC3.1:7@0, 3.1:7@0, 3:7@0, 3:7, 7@0, 7

Control changes are similar, except the left side of the syntax is the control change number & the right side is an optional value. No value? We send 127 anyway. You're welcome. Here we send Control Change 106 with a value of 64 on channel 3:

CC105:63@2, CC105:63. CC105@2, CC105

Now for note events. Want to play C4 on channel 8 at 75% velocity? Then type the following, because OnSong counts MIDI C0 as 0 on the MIDI note scale (don't ask us, we just work here):

N60:95@7, N60@7, N60:95, N60

Again, remember: every value you delete makes the MIDI statement broader & less specific. Case in point, that last note event blasts C4 at 100% velocity on ALL channels. Hope your neighbors like music!

You can also make MIDI chill out with a WAIT command. The following delays the MIDI for 2 seconds as well as 500 ms (half a second). Pick 1-10 seconds or go full milliseconds if you're feeling precise:

WAIT2, WAIT500

Last but not least, MIDI globals! These are preconfigured lists of MIDI events you can call up by name, like a pizza order but nerdier. If you have a MIDI global with "on" as the tag (no quotes, srsly), you can call it up like so:

@on
2026.3 — Last Refreshed March 11, 2020