Music Software Development

Roland SysEx checksum calculator

Roland instruments reject a System Exclusive “data set” message unless its last data byte is a correct checksum. Type the address and data bytes to get the checksum, build a complete message, or paste a message to see whether its checksum is right. Bytes are hexadecimal; spaces, commas and 0x prefixes are all accepted.

Calculator

Checksum of address + data

Checksum 3D.

Build a DT1 message

F0 41 10 42 12 40 00 7F 00 41 F7

Check a complete message

Checksum 41 is correct.

How the Roland checksum works

Add up the address bytes and the data bytes (not F0, the manufacturer, device, model or command bytes). Take the remainder when dividing by 128, and subtract it from 128. If the remainder is 0, the checksum is 0, not 128, because a data byte can only hold 0–127. In other words, the checksum is the value that makes address + data + checksum a multiple of 128.

Example: GS master volume 127 is address 40 00 04 and data 7F. In decimal, 64 + 0 + 4 + 127 = 195; 195 mod 128 = 67; 128 − 67 = 61, which is 3D. The full message is F0 41 10 42 12 40 00 04 7F 3D F7.

const rolandChecksum = (bytes) => (128 - (bytes.reduce((a, b) => a + b, 0) % 128)) % 128;

The parts of a Roland message

Every byte between F0 and F7 must be 7-bit (00–7F). A byte of 80 or above inside a SysEx message ends it early, and is the most common cause of “the synth ignores my message”.

Sending SysEx from a browser

Web MIDI only sends SysEx when the page asks for it with navigator.requestMIDIAccess({ sysex: true }) and the user agrees. The Web MIDI API tutorial shows the request and a live monitor that displays incoming SysEx. To read a captured dump byte by byte, paste it into the MIDI message decoder. Other makers use other schemes: Yamaha uses the same two’s-complement idea over its address and data, while Korg and many newer devices use no checksum at all.