Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSP protocol #4

Closed
hugbug opened this issue Mar 2, 2018 · 1 comment
Closed

CSP protocol #4

hugbug opened this issue Mar 2, 2018 · 1 comment

Comments

@hugbug
Copy link
Owner

hugbug commented Mar 2, 2018

Our app must emulate Smart Pianist app.

We have investigated how Smart Pianist communicates with digital piano and this issue documents the protocol.

Yamaha CSP protocol

Smart Pianist sends commands to CSP via MIDI-port. MIDI-messages of type System Exclusive is used for that purpose. Messages of this kind allow hardware manufacturers to implement custom commands not described in official MIDI documentation.

CSP responds also with MIDI-messages, which Smart Pianist analyses to keep track of CSP current state.

Lines starting with <- represent response messages sent by piano to app.

Playback Control

Play  : f0 43 73 01 52 25 26 01 01 04 00 05 01 00 01 00 00 01 01 f7
        f0 43 73 01 52 25 26 01 00 08 00 00 01 01 01 00 f7
     <- f0 43 73 01 52 25 26 00 00 08 00 00 01 01 01 00 00 02 00 69 f7

Pause : f0 43 73 01 52 25 26 01 01 04 00 05 01 00 01 00 00 01 02 f7
     <- f0 43 73 01 52 25 26 00 00 08 00 00 01 01 01 00 00 02 00 69 f7
     -> f0 43 73 01 52 25 26 01 00 08 00 00 01 01 01 00 f7
     <- f0 43 73 01 52 25 26 00 00 08 00 00 01 01 01 00 00 02 00 69 f7

Guide

Off : f0 43 73 01 52 25 26 01 01 04 03 00 01 00 01 00 00 01 00 f7
   <- f0 43 73 01 52 25 26 00 01 04 03 00 01 00 01 00 00 00 00 01 00 f7
      f0 43 73 01 52 25 26 00 00 04 03 00 01 00 01 00 00 01 00 f7
On  : f0 43 73 01 52 25 26 01 01 04 03 00 01 00 01 00 00 01 01 f7
   <- f0 43 73 01 52 25 26 00 01 04 03 00 01 00 01 00 00 00 00 01 01 f7
      f0 43 73 01 52 25 26 00 00 04 03 00 01 00 01 00 00 01 01 f7

Position

Measure 1   : f0 43 73 01 52 25 26 01 01 04 00 0a 01 00 01 00 00 04 00 01 00 01 f7
Measure 9   : f0 43 73 01 52 25 26 01 01 04 00 0a 01 00 01 00 00 04 00 09 00 01 f7
Measure 129 : f0 43 73 01 52 25 26 01 01 04 00 0a 01 00 01 00 00 04 01 01 00 01 f7
Measure 11  : f0 43 73 01 52 25 26 01 01 04 00 0a 01 00 01 00 00 04 00 0b 00 01 f7
           <- f0 43 73 01 52 25 26 00 00 04 00 0a 01 00 01 00 00 04 00 0b 00 01 f7
              f0 43 73 01 52 25 26 00 01 04 00 0a 01 00 01 00 00 00 00 04 00 0b 00 01 f7
              f0 43 73 01 52 25 26 00 00 08 00 00 01 01 01 00 00 02 00 69 f7
              f0 43 73 01 52 25 26 00 00 08 00 03 01 01 01 00 00 05 00 00 04 00 00 f7

Volume

Min      : f0 43 73 01 52 25 26 01 01 0c 00 00 01 50 01 00 00 01 00 f7
Middle   : f0 43 73 01 52 25 26 01 01 0c 00 00 01 50 01 00 00 01 3f f7
Max      : f0 43 73 01 52 25 26 01 01 0c 00 00 01 50 01 00 00 01 7f f7
Default  : f0 43 73 01 52 25 26 01 01 0c 00 00 01 50 01 00 00 01 64 f7
Vol 0x2e : f0 43 73 01 52 25 26 01 01 0c 00 00 01 50 01 00 00 01 2e f7
        <- f0 43 73 01 52 25 26 00 01 0c 00 00 01 50 01 00 00 00 00 01 2e f7
           f0 43 73 01 52 25 26 00 00 0c 00 00 01 50 01 00 00 01 2e f7

Tempo

5 (min)   : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 00 05 f7
127 (x7f) : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 00 7f f7
129       : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 01 01 f7
253       : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 01 7d f7
256       : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 02 00 f7
280 (max) : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 02 18 f7
default   : f0 43 73 01 52 25 26 04 01 08 00 00 01 00 01 00 f7
104       : f0 43 73 01 52 25 26 01 01 08 00 00 01 00 01 00 00 02 00 68 f7
         <- f0 43 73 01 52 25 26 00 01 08 00 00 01 00 01 00 00 00 00 02 00 68 f7
            f0 43 73 01 52 25 26 00 00 08 00 00 01 00 01 00 00 02 00 68 f7
            f0 43 73 01 52 25 26 00 00 08 00 00 01 01 01 00 00 02 00 68 f7
            f0 43 73 01 52 25 26 00 00 08 00 00 01 02 01 00 00 02 00 68 f7
            f0 43 73 01 52 25 26 00 00 08 00 03 01 01 01 00 00 05 00 00 04 04 76 f7
            f0 43 73 01 52 25 26 00 00 08 00 03 01 02 01 00 00 05 00 00 03 6c 27 f7

Transpose

-12 (min) : f0 43 73 01 52 25 26 01 01 0a 00 00 01 02 01 00 00 01 34 f7
 -1       : f0 43 73 01 52 25 26 01 01 0a 00 00 01 02 01 00 00 01 3f f7
  0       : f0 43 73 01 52 25 26 01 01 0a 00 00 01 02 01 00 00 01 40 f7
 +1       : f0 43 73 01 52 25 26 01 01 0a 00 00 01 02 01 00 00 01 41 f7
+12 (max) : f0 43 73 01 52 25 26 01 01 0a 00 00 01 02 01 00 00 01 4c f7

Parts

Right Off   : f0 43 73 01 52 25 26 01 01 04 00 0e 01 00 01 00 00 01 00 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 00 01 00 00 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 00 01 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 10 01 00 00 01 00 f7
Right On    : f0 43 73 01 52 25 26 01 01 04 00 0e 01 00 01 00 00 01 01 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 00 01 00 00 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 00 01 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 10 01 00 00 01 01 f7
Left Off    : f0 43 73 01 52 25 26 01 01 04 00 0e 01 01 01 00 00 01 00 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 01 01 00 00 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 01 01 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 11 01 00 00 01 00 f7
Left On     : f0 43 73 01 52 25 26 01 01 04 00 0e 01 01 01 00 00 01 01 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 01 01 00 00 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 01 01 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 11 01 00 00 01 01 f7
Backing Off : f0 43 73 01 52 25 26 01 01 04 00 0e 01 02 01 00 00 01 00 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 02 01 00 00 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 02 01 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 12 01 00 00 01 00 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 13 01 00 00 01 00 f7
              ...
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 1f 01 00 00 01 00 f7
Backing On  : f0 43 73 01 52 25 26 01 01 04 00 0e 01 02 01 00 00 01 01 f7
           <- f0 43 73 01 52 25 26 00 01 04 00 0e 01 02 01 00 00 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 04 00 0e 01 02 01 00 00 01 01 f7
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 10 01 00 00 01 01 f7
              ...
              f0 43 73 01 52 25 26 00 00 0c 00 01 01 1f 01 00 00 01 01 f7

Response contains info about switched on/off channels (a message for each channel):

    f0 43 73 01 52 25 26 00 00 0c 00 01 01 1N 01 00 00 01 0M f7
  • N - channel
  • M - 0-off, 1-on

Stream lights

Off  : f0 43 73 01 52 25 26 01 01 04 02 00 01 00 01 00 00 01 00 f7
    <- f0 43 73 01 52 25 26 00 01 04 02 00 01 00 01 00 00 00 00 01 00 f7
       f0 43 73 01 52 25 26 00 00 04 02 00 01 00 01 00 00 01 00 f7
On   : f0 43 73 01 52 25 26 01 01 04 02 00 01 00 01 00 00 01 01 f7
Slow : f0 43 73 01 52 25 26 01 01 04 02 02 01 00 01 00 00 01 00 f7
    <- f0 43 73 01 52 25 26 00 01 04 02 02 01 00 01 00 00 00 00 01 00 f7
       f0 43 73 01 52 25 26 00 00 04 02 02 01 00 01 00 00 01 00 f7
Fast : f0 43 73 01 52 25 26 01 01 04 02 02 01 00 01 00 00 01 01 f7

Guide Type

Correct Key : f0 43 73 01 52 25 26 01 01 04 03 01 01 00 01 00 00 01 00 f7
Any Key     : f0 43 73 01 52 25 26 01 01 04 03 01 01 00 01 00 00 01 01 f7
Your Tempo  : f0 43 73 01 52 25 26 01 01 04 03 01 01 00 01 00 00 01 05 f7

Quick Start

Off : f0 43 73 01 52 25 26 01 01 04 00 13 01 00 01 00 00 01 00 f7
On  : f0 43 73 01 52 25 26 01 01 04 00 13 01 00 01 00 00 01 01 f7

MIDI Part Channel

Auto On  : f0 43 73 01 52 25 26 01 01 04 00 10 01 00 01 00 00 01 01 f7
Auto Off : f0 43 73 01 52 25 26 01 01 04 00 10 01 00 01 00 00 01 00 f7
R=0      : f0 43 73 01 52 25 26 01 01 04 00 0f 01 00 01 00 00 01 00 f7
R=5      : f0 43 73 01 52 25 26 01 01 04 00 0f 01 00 01 00 00 01 05 f7
R=16     : f0 43 73 01 52 25 26 01 01 04 00 0f 01 00 01 00 00 01 10 f7
L=0      : f0 43 73 01 52 25 26 01 01 04 00 0f 01 01 01 00 00 01 00 f7
L=4      : f0 43 73 01 52 25 26 01 01 04 00 0f 01 01 01 00 00 01 04 f7

Balance:

Main (min)     : f0 43 73 01 52 25 26 01 01 0c 00 00 01 00 01 00 00 01 00 f7
Main (val x)   : f0 43 73 01 52 25 26 01 01 0c 00 00 01 00 01 00 00 01 20 f7
Main (max)     : f0 43 73 01 52 25 26 01 01 0c 00 00 01 00 01 00 00 01 7f f7
Main (default) : f0 43 73 01 52 25 26 01 01 0c 00 00 01 00 01 00 00 01 64 f7

Position Info During Playback

   <- f0 43 73 01 52 25 26 00 00 07 00 01 01 00 01 00 00 02 00 NN f7
      f0 43 73 01 52 25 26 00 00 04 00 0a 01 00 01 00 00 04 MM MM KK KK f7
  • NN - ??? sequential: 1,2,3,4
  • MM MM - measure
  • KK KK - beat within takt (1,2,3...)
@hugbug
Copy link
Owner Author

hugbug commented Mar 2, 2018

Upload song via WiFi

When app is connected to piano via WiFi the song is uploaded to piano not via MIDI-messages. Instead the song content is sent via TCP to a separate port (port number 10504).

Example song 1

       0000   01 00 00 06 00 00 00 01 00 00 01 bc 00 00 00 01  ................
       0010   00 00 00 00 00 00 00 16 45 58 54 45 52 4e 41 4c  ........EXTERNAL
       0020   3a 2f 41 70 70 53 6f 6e 67 2e 6d 69 64 00 00 00  :/AppSong.mid...
       0030   01 96 4d 54 68 64 00 00 00 06 00 01 00 04 01 e0  ..MThd..........
             <MIDI-FILE CONTENT CONTINUES>

Example song 2

       0000   01 00 00 06 00 00 00 01 00 00 04 80 00 00 00 01  ................
       0010   00 00 00 00 00 00 00 16 45 58 54 45 52 4e 41 4c  ........EXTERNAL
       0020   3a 2f 41 70 70 53 6f 6e 67 2e 6d 69 64 00 00 00  :/AppSong.mid...
       0030   04 5a 4d 54 68 64 00 00 00 06 00 00 00 01 07 80  .ZMThd..........
              <MIDI-FILE CONTENT CONTINUES>

TCP data format for song upload

       0000   01 00 00 06 00 00 00 01 MM MM MM MM 00 00 00 01  ................
       0010   00 00 00 00 00 00 00 16 45 58 54 45 52 4e 41 4c  ........EXTERNAL
       0020   3a 2f 41 70 70 53 6f 6e 67 2e 6d 69 64 00 NN NN  :/AppSong.mid...
       0030   NN NN                                            ..
             <MIDI-FILE CONTENT>
  • NN NN NN NN - midi-file size, little endian
  • MM MM MM MM - payload size (midi-file size + 38), little endian

Upload song via USB

Currently we don't know how the song is uploaded when an iOS device is connected via lightning cable. It's also not clear if the similar possibility can be used when a PC is connected to USB-to-host port of the piano.

Any info on this matter is much appreciated.

Anyway our app can upload songs via WiFi even if MIDI-ports are connected via USB cable. That may be a little inconvenient but not a deal breaker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant