You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CSP protocol is seemingly designed specifically for Smart Pianist app.
From the app point of view the piano is as a set of properties. Most properties are arrays. The properties can be of two types: integer or string. The app can change the properties or read their values.
For example there is a property for current playback position of the MIDI-song. The app can change it by sending SET-message for POSITION-property to the piano. This property is also automatically changed by piano during playback. The app can activate events for this property; then the piano will send messages to the app every time the playback position is changed.
Message types (actions)
The app can send to piano messages of the following types:
SET - set property;
GET - get property;
RESET - reset property to default value;
EVENTS - enable events for property changes.
The piano can send to app messages of the following types:
INFO - response to GET message or when a property is changed and events are enabled for that property;
SET-RESULT - response to SET message; the message contains result code (error code) and new property value;
EVENTS-ON - response to EVENTS message, confirming activation of events for property.
All messages of one type have the same format, which is independent of the property.
Embedding CSP Message into MIDI message
CSP messages are sent within MIDI SysEx messages:
f0 43 73 01 52 25 26 <CSP-Message> f7
Here:
Leading f0 and trailing f7 are enclosing bytes for all SysEx messages;
43 is the manufacturer code of Yamaha;
73 01 52 25 26 is a prefix for all CSP-messages;
CSP-Message is explained below.
Format for CSP-messages
All messages start with two bytes of message type signature, followed by four bytes of property id signature:
Type-Id (2 Bytes)
Property-Id (4 Bytes)
Depending on message type an additional data is followed.
SET
01 01
Property-Id (4 Bytes)
Index (1 Byte)
01 00
Value length (2 bytes)
Value (variable length)
GET
01 00
Property-Id (4 Bytes)
Index (1 Byte)
01 00
INFO
00 00
Property-Id (4 Bytes)
Index (1 Byte)
01 00
Value length (2 bytes)
Value (variable length)
SET-RESULT
00 01
Property-Id (4 Bytes)
Index (1 Byte)
01 00
Error code (2 bytes)
Value length (2 bytes)
Value (variable length)
RESET
04 01
Property-Id (4 Bytes)
Index (1 Byte)
01 00
EVENTS
02 00
Property-Id (4 Bytes)
EVENTS-ON
02 01
Property-Id (4 Bytes)
Property-Ids
Piano-Model: 0f 01 18 01
Firmware-Version: 0f 01 0b 01
Playback-Position: 04 00 0a 01
Stream-Lights (on/off): 04 02 00 01
Stream-Lights-Speed (slow/fast): 04 02 02 01
and so on. I'm not listing all properties here. For a more complete list please see the source code unit PianoMessage.cpp.
Index
Index is the third part for all messages except of EVENTS. What it means depend on property. For example for property Volume the index refers to channel. For property Part index identifies right hand, left hand or backing. Please refer to the source code unit PianoMessage.cpp for details for each property.
Error Code
This field is present only in message-type SET-RESULT which is sent by piano as a response to SET-message. The error code indicates if the operation succeeded.
00 00 - property value changed successfully (or it was already set to this value);
02 02 - index out of range;
02 04 - value out of range;
02 05 - read-only property;
02 07 - value cannot be used in this context;
other codes are possible.
Value Length
Value length specifies how many bytes are occupied by the field value. Value length takes two bytes. These are typical 7-bit MIDI-bytes (not normal 8-bit bytes).
Value
Integer - for integer properties it can be 1 to 4 bytes long. These are typical 7-bit MIDI-bytes (not normal 8-bit bytes).
Struct/record - some properties contains more bytes, they can be interpreted as structs (records). For example property Loop consists of 9 bytes. First byte identifies if the Repeat-Loop is active. Then four bytes for the start of the fragment and another four bytes for the end of it.
String - string data is encoded for 7-bit MIDI-bytes compatibility. Every 7 characters of the string is preceded by one byte, where each bit contains the highest bit of the character. See encoding and decoding routines.
This is a follow-up to #4.
CSP protocol is seemingly designed specifically for Smart Pianist app.
From the app point of view the piano is as a set of properties. Most properties are arrays. The properties can be of two types: integer or string. The app can change the properties or read their values.
For example there is a property for current playback position of the MIDI-song. The app can change it by sending SET-message for POSITION-property to the piano. This property is also automatically changed by piano during playback. The app can activate events for this property; then the piano will send messages to the app every time the playback position is changed.
Message types (actions)
The app can send to piano messages of the following types:
The piano can send to app messages of the following types:
All messages of one type have the same format, which is independent of the property.
Embedding CSP Message into MIDI message
CSP messages are sent within MIDI SysEx messages:
Here:
f0
and trailingf7
are enclosing bytes for all SysEx messages;43
is the manufacturer code of Yamaha;73 01 52 25 26
is a prefix for all CSP-messages;CSP-Message
is explained below.Format for CSP-messages
All messages start with two bytes of message type signature, followed by four bytes of property id signature:
Depending on message type an additional data is followed.
SET
GET
INFO
SET-RESULT
RESET
EVENTS
EVENTS-ON
Property-Ids
and so on. I'm not listing all properties here. For a more complete list please see the source code unit PianoMessage.cpp.
Index
Index is the third part for all messages except of EVENTS. What it means depend on property. For example for property Volume the index refers to channel. For property Part index identifies right hand, left hand or backing. Please refer to the source code unit PianoMessage.cpp for details for each property.
Error Code
This field is present only in message-type SET-RESULT which is sent by piano as a response to SET-message. The error code indicates if the operation succeeded.
Value Length
Value length specifies how many bytes are occupied by the field value. Value length takes two bytes. These are typical 7-bit MIDI-bytes (not normal 8-bit bytes).
Value
Examples
Send message to switch guide mode on
What we have here:
f0
- SysEx-prefix;43 73 01 52 25 26
- CSP-prefix;f7
- SysEx suffixThe remaining CSP-message:
Here:
01 01
- id of SET-message type;04 03 00 01
- id of the Guide-property;00
- index is 0 for this simple property;01 00
- constant (is always there);00 01
- length of the followed value. For this property it's one byte;01
- value the property should be set to. For the guide property value01
means On and value00
means Off.Send message asking if guide mode is on or off
If we want to determine wether the guide mode is on or off we can send the message of GET-type
The actual CSP-message here is:
01 00
- id of GET-message type;04 03 00 01
- id of the Guide-property;00
- index is 0 for this simple property;01 00
- constant (is always there).When the piano receives this message it sends another message back to us. That other message contains the info about current value of guide property:
Info about guide mode
This message is very similar to our SET-message except that the message-type is
00 00
. All other fields are the same.CSP-message:
Here:
00 00
- id of INFO-message type;04 03 00 01
- id of the Guide-property;00
- index is 0 for this simple property;01 00
- constant (is always there);00 01
- length of the followed value. For this property it's one byte;01
- value the property.01
means guide mode is currently On.The text was updated successfully, but these errors were encountered: