Today’s blog post is for MIDI nerds although other folks might want a peek at the tech behind Smart Pianist (SP) and CSP series digital pianos.
MIDI doesn’t get too much attention anymore, however, MIDI is a key player (pun intended) in SP/CSP. Smart Pianist communicates with a CSP piano over four different kinds of electronic link:
- USB cable
- Wi-fi wireless
- Bluetooth wireless
- 5-pin MIDI cables
Yamaha could have crafted a unique protocal for each type of link, incurring a lot of duplicate effort. Instead, Yamaha sends MIDI messages over all four kinds of electronic link, making extensive use of proprietary System Exclusive (SysEx) messages. This is intelligent software engineering — one protocol to rule them all. Operation is seamless and transparent no matter how a user chooses to connect.
We’ve seen undocumented (hidden) SysEx messages before. Yamaha Chord Tracker and Musicsoft Downloader transfer MIDI files and other types of files to and from Yamaha arranger workstations using MIDI SysEx. Yamaha’s proprietary SysEx messages send file system commands like change directory, list directory, and copy file.
Today’s scenario
When a user selects a song, Smart Pianist does its best to display a score and synchronize song playback with the score. SP supports three kinds of songs: audio songs from your music library, MIDI songs, and PDF song scores. During playback, SP highlights the current position in the song score display so you can play along on the keyboard. If your keyboard is a CSP series digital piano, the CSP animates the Stream Lights, guiding your fingers. [You can turn off the Stream Lights or simply ignore them. Whatever.]
I went with the most frequently demonstrated use case: selecting and playing an audio (MP3) song from my music library. To keep everything small and fast, I prepared a short 6-bar version of the garage band classic “Louie, Louie”. I called the song “Shorty, Shorty”. 🙂
Since “Shorty, Shorty” is an audio song, Smart Pianist analyzes the audio and discovers:
- The tempo,
- The time signature,
- The key signature, and
- Song sections (like verse and chorus).
SP, like Chord Tracker, identifies chords and creates a chord chart. [Shown above, click image to enlarge.]
Ah, there’s the old, familiar I-IV-v progression (A-D-Em-D). So far, we’ve seen Chord Tracker do this sort of thing, too.
Smart Pianist generates the score display using the extracted chord progression. It applies a score template to the chord chart and displays a play-along score.
In this case, the score template is a basic one using block chords as shown in the screenshot above. If you don’t like block chords, you can dip into the Score Settings menu and choose a different template like arpeggios (i.e., broken chords).
When you tap the Play button, Smart Pianist plays the audio and sends MIDI messages to the CSP digital piano, e.g.,
F0 43 73 01 52 25 26 00 00 05 02 00 01 45 01 03 00 01 01 F7 F0 43 73 01 52 25 26 00 00 05 02 00 01 40 01 03 00 01 01 F7 F0 43 73 01 52 25 26 00 00 05 02 00 01 3D 01 03 00 01 01 F7 F0 43 73 01 52 25 26 00 00 05 02 00 01 2D 01 03 00 01 01 F7 ^^ MIDI note number
These MIDI messages control the Stream Lights. HEX 45, 40, 3D and 2D are MIDI notes A3, E3, C#3, and A1, respsectively. They are the notes of the first chord in “Shorty, Shorty”.
Arrange mode
Smart Pianist has a cool mode called “Arrange Mode”. Arrange Mode turns off audio playback and enables CSP auto-accompaniment. When you switch to Arrange Mode, Smart Pianist generates a MIDI file containing all of the chord and score information. SP sends the data to the CSP in a MIDI file, named “AppSong.mid”. You don’t see any of this; it’s transparent.
When SP goes into Arrange Mode, it sends a proprietary SysEx message telling the CSP to receive a Standard MIDI File (SMF):
F0 43 73 01 52 25 26 10 00 01 00 00 1A 00 45 58 54 45 52 4E 41 00 4C 3A 2F 41 70 70 53 00 6F 6E 67 2E 6D 69 64 00 00 00 00 00 04 3A F7
The HEX values in the second line are the song name:
EXTERNAL:/AppSong.mid
The SMF itself is encoded into MIDI messages that I call “packets”. Smart Pianist sends the SMF in one or more packets (i.e., one long SysEx message per packet).
Really nerdy stuff: Each packet is (at most) 586 bytes in length, except the final packet, which may be shorter. A full packet contains 572 data bytes which encode a portion of the SMF. SMF bytes are divided into runs of eight bytes. Bytes within a SysEx message must be 127 (0x3F) or less. The first byte in a run indicates the highest order bits (positionally) for the next seven bytes in the run.
Yes, this was a pain in the neck to decode by hand. 🙁
I won’t reproduce Shorty, Shorty’s raw packets (SysEx messages) as the packets are rather long.
Ready Player One
When you tap the on-screen play button, SP tells the CSP to play the MIDI file. Smart Pianist sends the following SysEx message:
F0 43 73 01 52 25 26 01 01 04 00 05 01 00 01 00 00 01 01 F7
Playback is synchronized. The CSP piano is the timing master in Arrange Mode and SP tracks playback in the score (or chord chart). Smart Pianist highlights the current song position in the score/chord display.
Standard MIDI File: AppSong.mid
So, what’s inside the generated MIDI song file? I managed to intercept the generated Standard MIDI File (SMF), “AppSong.mid” and manually decoded the packets.
The SMF starts with standard MIDI headers:
00 4D 54 68 64 ^ M T h d 00 00 00 01 06 00 00 00 ^ 01 01 60 00 4D 54 72 6B ^ M T r k 00 00 02 10 24 00 ^
Values marked by a caret “^” are the special bytes which appear at the beginning of eight byte runs. It was a pain to identify and apply these special bytes. The SysEx messages in the rest of the article are cleaned up and simplified.
Without surprise, the first MIDI messages are GM Reset and XG System On:
F0 7E 7F 09 01 77 GM Reset F0 43 10 4C 00 00 7E 00 F7 XG System On
Next are song set-up directives (MIDI meta-events):
FF 58 04 04 02 18 08 Beat (Song Meta) FF 59 02 03 00 00 Key signature (Song Meta) FF 51 03 07 50 3A Tempo (Song Meta) FF 7F 06 43 73 0A 00 04 01 Score ?? (Yamaha Meta) FF 7F 05 43 7B 0C 01 02 0F Guide Track Flag (Yamaha XF Meta) FF 58 04 04 02 18 08 Beat (Song Meta)
After set-up, the MIDI file starts playback:
F0 43 60 7A F7 Rhythm Start (Yamaha) FF 58 04 04 02 18 08 Beat (Song Meta) Note ON A1 velocity=1, channel=2 Note ON C#3 velocity=1, channel=1 Note ON E3 velocity=1, channel=1 Note ON A3 velocity=1, channel=1
The rhythm start command starts the CSP auto-accompaniment engine. The Note ON messages turn on the Stream Lights for the first chord. Channel 2 is the left-hand part and channel 1 is the right-hand part.
According to the definition of the MIDI Key LED Mode SysEx message, the note velocity determines the behavior of the Stream Light LEDs:
- Velocity = 0: LED off
- Velocity = 1: LED flash
- Velocity = 2: LED on
Up to two channels (e.g., left and right part) can be specified and controlled.
Next, the MIDI file contains a Section Control SysEx message:
F0 06 43 7E 00 08 7F F7 Section Contol (MAIN A, ON)
This message tells the auto-accompaniment engine to use the MAIN A section of the currently selected style. [Oh, yeah, you get to choose the style on Smart Pianist’s Style page.]
Then, we hit the first Chord Control SysEx message:
F0 43 7E 02 36 00 7F 7F F7 Chord Control (A Maj, no root)
Check the CSP-170 Data List PDF for all MIDI event definitions including how chords are encoded in Chord Control messages.
Thereafter, it’s Note ON messages to change the Stream Lights and Chord Control messages to change chords. Finally, at the end of the score, it’s time to stop:
70 43 60 7D 77 Rhythm Stop FF 2F 00 End Of Track
That’s it! End Of Track is an SMF meta-event that marks the end of the MIDI data in the SMF.
I hope our MIDI file tour inspires your own investigations — maybe crafting a custom Standard MIDI File of your own. Get those lights flashing!
Copyright © 2025 Paul J. Drongowski