30 SysEx
30 SysEx
30 SysEx
Chapter 30
System Exclusive Protocol
K2vx System Exclusive Implementation
The MIDI System Exclusive capabilities of the K2vx allow you to manipulate objects in the
K2vxÕs memory from a computer system, another K2vx, or a MIDI data recorder. The following
is a reference to the SysEx protocol used by the K2vx. This information can be used to build a
simple object librarian software program. A word of adviceÑbefore you begin experimenting
with SysEx, make sure you have saved anything of value in RAM to disk.
NOTE: To support new features and changes in the K2vx line of products, the internal program
structure has been changed from that of the K2vx. Due to these changes, you cannot transfer a K2vx
program to a K2vx, or a K2vx program to a K2vx via MIDI system exclusive. The K2vx software will
continue to be enhanced, and in the future the K2vx will be capable of accepting K2vx programs over
MIDI. As a result of this, computer based K2vx editor/librarians will not currently work with the K2vx,
unless they have been revised to accommodate the changes.
Common Format
In the following discussion, the Þelds of the K2vx System Exclusive Protocol messages are
notated asÉ
field(length)
Éwhere ÔÞeldÕ is the name of the particular information Þeld in the message, and ÔlengthÕ is
either 1, 2, 3, or n, representing the number of sequential MIDI bytes that make up the Þeld. A
length of ÔnÕ means that the Þeld is of a variable length that is determined by its contents or sub-
Þelds.
Ôdev-idÕ is Device ID. The K2vx will recognize a SysEx message if the Ôdev-idÕ is the same is the
SysX ID parameter from the MIDI Receive page (from the top level, press the MIDI mode
button and the RECV soft button.) If the K2vxÕs SysX ID parameter is set to 127, it will
recognize SysEx messages no matter what the Ôdev-idÕ is.
ÔpidÕ is the Product IdentiÞer, and must be 78h (120 decimal), indicating the SysEx message is
for the K2vx.
Ômsg-typeÕ is the identiÞer of one of the K2vx SysEx messages deÞned below, and ÔmessageÕ is
the variable-length message contents.
Data Formats
K2vx SysEx messages are subdivided into Þelds that contain data in different formats. The
various Þelds are shown in the Messages section below. Within a message, any Þelds for values
that can be bigger than 7 bits are broken into 7 bit chunks. Thus two MIDI bytes gives 14 bits,
three bytes gives 21 bits. The signiÞcant bits are right justiÞed in the Þeld. All bytes in a Þeld
must be present no matter what the value is. For example, an object type of 132 would be split
into two MIDI bytes in a ÔtypeÕ Þeld as 01 04:
30-1
System Exclusive Protocol
K2vx System Exclusive Implementation
decimal: 132
binary: 10000100
Object name Þelds are sent as a string of ASCII values in a ÔnameÕ Þeld, with one MIDI byte of
zero as a string terminator. For example, the name ÒGlass KazooÓ would be sent as letters:
G l a s s _ K a z o o <null>
Data sizes and offsets are sent in the ÔsizeÕ and ÔoffsÕ Þelds.These values refer to quantities of 8-
bit bytes in the K2vxÕs memory, which is packed in the ÔdataÕ Þeld.
Binary data in the ÔdataÕ Þeld is sent by in one of two formats, according to the value of the
ÔformÕ Þeld. If the ÔformÕ Þeld equals zero, the data is transmitted as 4 bits or one ÒnibbleÓ in
every MIDI byte. If the ÔformÕ Þeld equals one, then the data is sent as a compressed bit-stream,
with 7 bits per midi byte. The bit-stream format is more efÞcient for data-transmission, while
the nibble format is easier to read (and write software for).
hex: 4F D8 01 29
decimal: 79 216 1 41
binary: 01001111 11011000 00000001 00101001
hex: 04 0F 0D 08 00 01 02 09
decimal: 4 15 13 8 0 1 2 9
binary: 0000100 0001111 0001101 0001000 0000000 0000001 0000010 0001001
hex: 27 76 0 12 48
decimal: 39 118 0 18 72
binary: 0100111 1110110 0000000 0010010 1001000
The bit-stream format can be thought of as taking the binary bits of the K2vx data and, starting
from the left, slicing off groups of 7 bits. Note that the trailing bits are set to zero.
After the ÔdataÕ Þeld, there is another Þeld, ÔxsumÕ. This is a checksum Þeld which is calculated
as the least signiÞcant 7-bits of the sum of all of the MIDI bytes that make up the ÔdataÕ Þeld.
Messages
This section deÞnes the K2vx System Exclusive message formats. Each message has a message
type (that goes in the Ômsg-typeÕ Þeld; see Common Format, above), followed by the Þeld
deÞnitions of the message.
30-2
System Exclusive Protocol
K2vx System Exclusive Implementation
Éwhich writes data into the speciÞed object, which must exist. Both load and dump operate on
the object data only. The response to a load message will be
code meaning
30-3
System Exclusive Protocol
K2vx System Exclusive Implementation
Échanges the name and/or ID number of an existing object. If ÔnewidÕ is zero or ÔnewidÕ equals
ÔidnoÕ, the ID number is not changed. If ÔnewidÕ is a legal object id number for the objectÕs type
, then the existing object will be relocated in the database at the new ID number. This will cause
the deletion of any object which was previously assigned to the ÔnewidÕ. If the ÔnameÕ Þeld is
null, the name will not change. Otherwise, the name is changed to the (null-terminated) string
in the ÔnameÕ Þeld.
WRITE = 09h type(2) idno(2) size(3) mode(1) name(n) form(1) data(n) xsum(1)
Éwrites an entire objectÕs data directly into the database. It functions like the message
sequence DEL followed by NEW followed by a LOAD of one complete object data structure. It
Þrst deletes any object already existing at the same type/ID. If no RAM object currently exists
there, a new one will be allocated and the data will be written into it. The object name will be
set if the ÔnameÕ string is non-null. The response to this message will either be a DACK or a
DNAK, as with the load message. The ÔoffsÕ Þeld of the response will be zero. The K2vx will
send a WRITE message whenever an object is dumped from the front-panel (using a ÒDumpÓ
soft-button), or in response to a READ message.
The ÔmodeÕ Þeld is used to determine how the ÔidnoÕ Þeld is interpreted.
If ÔmodeÕ = 0:
The ÔidnoÕ speciÞes the absolute ID number to write to, which must exist.(must be valid)
If ÔmodeÕ = 1
The object is written at the Þrst available ID number after what is speciÞed by ÔidnoÕ.
It doesnÕt matter if ÔidnoÕ is a legal ID number. Remember that for certain object types, the 100s
through 900s banks allow fewer than 100 objects to be stored (for example, the 100s bank will
store preset effects at IDs 100Ñ109 only). In this mode, if ÔidnoÕ was 313, the object would be
written to ID 400 if available.
ÔtypeÕ and ÔbankÕ specify the group of objects to be returned in WRITE messages. The ÔtypeÕ
Þeld speciÞes a single object type, unless it is zero, in which case objects of all user types will be
returned (see object type table below). The ÔbankÕ Þeld speciÞes a single bank, 0-9, unless it is
set to 127, in which case objects from all banks will be returned.
ÔformÕ requests the format of the binary data in the WRITE messages. If ÔramonlyÕ is one, only
objects in RAM will be returned. If ÔramonlyÕ is zero, both RAM and ROM objects are returned.
30-4
System Exclusive Protocol
K2vx System Exclusive Implementation
The responses, a stream of complete WRITE messages, will come out in order of object type,
while objects of a given type are in order by ID number, from lowest to highest. If no objects are
found that match the speciÞcations, no WRITE messages will be returned. After the last WRITE
message, an ENDOFBANK message (deÞned below) is sent to indicate the completion of the
bank dump.
The K2vx will insert a small delay (50ms) between WRITE messages that it issues in response to
a READBANK message.
A bank dump can be sent in its entirety to another K2vx, which will add all of the objects
contained in the dump to its own object database. IMPORTANT: If the K2vx receives a large
bank dump for a bank or banks that already contain objects, errors may result unless the sender
waits for the DACK message before sending the next objectÕs WRITE message. One way to
avoid transmission errors such as this is to make sure that the bank being dumped is clear in
the K2vx before sending the dump, so that the K2vx will not miss parts of the dump while its
CPU is busy deleting already existing objects. This can be done using the DELBANK message
(deÞned below). If the destination bank in the K2vx is pre-cleared, it is not necessary to wait for
the DACK before sending. Even if the sender chooses not to wait for the DACK before sending
the next message, it may be necessary to preserve the 50ms delay between the WRITE
messages.
Due to the large amount of incoming data during a bank dump containing many objects, the
receiving K2vx may have a more sluggish response to front-panel use and keyboard playing
during the data transfer. This is normal behavior and the machine will become fully responsive
as soon as the dump is Þnished.
30-5
System Exclusive Protocol
K2vx System Exclusive Implementation
equal to the new bank number. If the operation canÕt be completed because of a bad type or
bank number, the ENDOFBANK message will specify the old bank number.
08h Button up
Byte 3 Repeat count (number of clicks) for Alpha Wheel; the count is the delta (difference)
from 64—that is, the value of the byte minus 64 equals the number of clicks. A Byte
3 value of 46h (70 dec) equates to 6 clicks to the right. A Byte 3 value of 3Ah (58
dec) equates to six clicks to the left. For example, the equivalent of 6 clicks to the
right would be the following message:
For efÞciency, multiple button presses should be handled by sending multiple Button down
bytes followed by a single Button up byte (for incrementing with the Ô+Õ button, for instance. )
Object Types
These are the object types and the values that represent them in ÔtypeÕ Þelds:
30-6
System Exclusive Protocol
K2vx System Exclusive Implementation
Master Parameters
The Master parameters can be accessed as type 100 (00h 64h), ID number 16. Master parameters
cannot be accessed with any of the Bank messages.
zero 00 A ‘(leftmost) 22
one 01 B 23
two 02 C 24
three 03 D 25
four 04 E 26
five 05 F (rightmost) 27
six 06 AB 28
seven 07 CD (two center) 29
eight 08 EF 2A
nine 09 YES 26
+/- 0A NO 27
CANCEL 0B EDIT 20
CLEAR 0C EXIT 21
ENTER 0D
30-7
System Exclusive Protocol
K2vx System Exclusive Implementation
The next four commands allow you to read the screen display, both text and graphics layers.
ALLTEXT = 15h
Érequests all text in the K2vxÕs display.
PARAMVALUE = 16h
Érequests the current parameter value.
PARAMNAME = 17h
Érequests the current parameter name.
GETGRAPHICS = 18h
Érequests the current graphics layer.
SCREENREPLY = 19h
This is the reply to ALLTEXT, PARAMVAL, PARAMNAME, GETGRAPHICS, or
SCREENREPLY.
The reply to ALLTEXT will be 320 bytes of ASCII text (the display has 8 rows of 40 characters
each). If you receive less than that, then the screen was in the middle of redrawing and you
should request the display again.
The reply to PARAMVALUE will be a variable length ASCII text string. Some values (like
keymaps, programs, samples, etc.) include their ID number in the text string (e.g., "983 OB
Wave 1"). Some messages are also padded with extra spaces.
The reply to PARAMNAME will be a variable length ASCII text string. In cases where there is
no parameter name (like on the program page) there will just be the single 00 null terminator.
The reply to GETGRAPHICS will be 2560 bytes of information. The 6 least signiÞcant bits of
each byte indicate whether a pixel is on or off. If pixels are on over characters, the text becomes
inverted. Characters on the K2vx display are a monospaced font with a height of 8 pixels and a
width of 6 pixels.
30-8