User Manual

MIDI Syntax

OnSong uses a text-based syntax fer expressin' MIDI commands. While ye can use th' MIDI Events in th' Metadata Editor, ye can also express MIDI commands in text.

Delimited Values

First and foremost, multiple MIDI commands can be separated by various characters includin': a tab character, comma, semi-colon, vertical pipe, or new line. Th' comma be th' most common delimiter. Fer example:

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

Channel

Each entry may contain an @ symbol. Th' numeric value after th' symbol be th' channel on which th' command be t' be sent. Since channels in MIDI start on zero, channel one would be a zero (0), channel two a one (1), et cetera.

If no @ symbol be used, th' command be sent or received on all channels.

Prefixes

Each entry in th' list contains a prefix. This prefix determines what type o' MIDI command t' send. These include:

  • PC or No Prefix be a program change event.
  • N be a note event
  • CC be a control change event.
  • NRPN be a non-register parameter number.
  • SS be a song select event.
  • START be a start command.
  • STOP be a stop command.
  • CONTINUE be a continue command.
  • WAIT waits a specific amount o' time before sendin' more events.
  • F0 prefixes a SysEx message.
  • @ prefixes a MIDI global tag.

Values

Th' value o' th' command appears just before th' @ symbol or at th' end o' th' entry if no @ be given. This be th' value o' th' program change, control change, note, or song select based on th' prefix. In th' case o' SysEx entries, th' hexadecimal value o' th' SysEx be provided directly after th' F0 prefix which be used as a header t' all SysEx commands.

Subvalues

In some cases, additional information be conveyed in th' MIDI command as subvalues. Fer instance, MSB and LSB, as well as velocity o' control values can be sent this way. This be expressed through th' addition o' a colon in th' value portion. Th' subvalue has different context dependin' on th' type o' MIDI command sent:

  • Program Change has subvalues alignin' with th' MSB/LSB o' th' program change. These values be separated by a period with th' MSB on th' left and th' LSB on th' right.
  • Control Change has th' value o' th' control set usin' this. Th' number can be between 0 and 127. If omitted, th' value o' 127 be inferred. Ye can also separate multiple values with a hyphen t' step through values. Fer instance, 127-0 will latch th' value o' 127 between on and off states.
  • Note Event has a subvalue relatin' t' th' velocity at which th' note should be played. This can be set t' a numerical value between 0 and 127. Ye can step through multiple note velocities by separatin' them with a hyphen.

Examples

Let's start with a simple program change. In this scenario we use program change 8 that also sends an MSB o' 4 and an LSB o' 2 on channel 1. Th' example starts with th' most complex variation o' this and removes th' bank select and channel t' become more broad:

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

Control changes be similar except that th' left side o' th' syntax be th' control change number and th' right side be an optional value. If th' value be not provided, 127 be sent instead. We will send Control Change 106 with a value o' 64 on channel 3.

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

Now let's take a look at note events. We want t' play C4 on channel 8 at 75% velocity, we would enter th' followin' because OnSong starts countin' MIDI C0 as 0 on th' MIDI note scale:

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

Again, it be important t' remember that as values be removed from th' MIDI syntax, th' MIDI statement becomes more broad and less specific. Fer instance, th' last version o' th' note event will send C4 at 100% velocity on all channels.

We can also delay MIDI by added a WAIT command. Th' followin' will delay th' MIDI fer 2 second as well as 500 ms (half a second). Ye can specify seconds as 1-10 seconds or in milliseconds.

WAIT2, WAIT500

Last, we can reference MIDI globals which a preconfigured lists o' MIDI events that can be referenced. If ye have a MIDI global with "on" as th' tag (with no quotes), then ye can reference that global with th' followin':

@on
OnSong 2026 — Last Updated on March 11, 2020