User Guides v3.0

SysEx Macros

When entering MIDI SysEx data Cantabile supports the following macros.

Note: Unlike version 2, version 3 doesn't support custom user-defined macros. This may be supported in a future version. If this is something you require, please get in touch

hibyte(x)       - gives the high byte of a word eg: hibyte(0x1234) gives 0x12
lobyte(x)       - gives the low byte of a word eg: lobyte(0x1234) gives 0x34
ascii(x)        - generate ascii data for string x eg: ascii("apple") gives 0x61 0x70 0x70 0x6c 0x65
strlen(x)       - return the length of string x eg: strlen("apple") gives 5
strcat(x,y)     - join strings x and y
add(x,y)        - add x and y
sub(x,y)        - subtract x and y
mul(x,y)        - multiply x by y
div(x,y)        - divide x by y
mod(x,y)        - remainder of x divided by y
and(x,y)        - x and y (bitwise)
or(x,y)         - x or y (bitwise)
xor(x,y)        - x xor y (bitwise)
shl(x,y)        - shift x left by y bits
shr(x,y)        - shift x right by y bits
hex(x)          - convert number x to hex (and add 0x prefix)
dec(x)          - convert number x to decimal
bytelen(bytes)  - calculate the length of a byte stream
byteswap(bytes) - byte swap the byte stream
midivarlen(x)   - midi encode variable length number x
byte(x)         - Format x as a hex byte
word(x)         - Format x as a hex word
dword(x)        - Format x as a hex dword
qword(x)        - Format x as a hex qword
repeat(x,y,d)   - Repeat x, y times with optional delimiter d