I’ve made quite a bit of progress with my Java program that translates extended ChordPro songs into a Yamaha-compatible accompaniment MIDI file. This blog post describes the stuff inside the MIDI files produced by the program (cp2mid).
The MIDI file contains MIDI meta and SysEx (System Exclusive) messages which drive the Yamaha accompaniment engine. When the MIDI file is played back on a compatible Yamaha arranger keyboard (e.g., Genos), the keyboard generates an accompaniment as directed by the chord and section change messages in the MIDI file. It may sound odd to hear this, but the MIDI file doesn’t contain a single note ON or note OFF message! It’s all accomplished through control messages and the accompaniment is produced in real-time.
The MIDI file is a Type 0 Standard MIDI File. It starts with a bunch of set-up messages:
F0 05 7E 7F 09 01 F7 GM Reset
F0 08 43 10 4C 00 00 7E 00 F7 XG System ON
FF 58 04 04 02 18 08 Time signature
FF 59 02 02 00 Key signature
FF 51 03 07 EF eb Tempo
F0 0D 43 73 01 51 05 00 03 04 00 00 2C 05 F7 Style code
F0 04 43 60 7A F7 Accompaniment Start
All of these message types are defined in the Yamaha Genos™ Data List PDF document. The messages beginning with “F0” are System Exclusive (SysEx) messages. Messages starting with “FF” are MIDI SMF meta messages. All messages are Yamaha proprietary (code “43”). The trick, of course, is filling in the correct values for the tempo, key, etc.
GM Reset and XG System ON initialize the tone generator. Time signature, key signature and tempo are SMF meta messages which control and arranger’s sequencing engine. The Style Code message selects one of the many built-in accompaniment styles. The Accompaniment Start message tells the accompaniment engine to get busy.
Once set-up is complete, the rest of the MIDI file consists of Chord, Lyric and Section Control messages. Again, these messages are all defined in the Genos Data List PDF document.
Here is a typical chord message:
F0 08 43 7E 02 37 08 37 7F F7 Chord Bm/B
It tells the accompaniment engine to play a B minor chord (0x37 0x08) with a B bass note (0x37 0x7F). The neatest thing about the ChordPro conversion program? It makes it easy to play and hear difficult to finger chords like slash chords and unusual chord types like Cminmaj7-9.
Lyrics are inserted into the MIDI file using the SMF Lyric meta message:
FF 05 len [Data]
For example, this Lyric meta message:
FF 05 04 79 6F 75 20 0x79='y', 0x6F='o', 0x75='u', 0x20=' '
encodes the syllable text “you “.
No attempt is made to separate lyric text into syllables or to assign syllables to individual beats. When a lyric phrase is encountered in the ChordPro file, the phrase is inserted right after the preceding Chord message, i.e., it has the same MIDI timestamp as the preceding Chord message.
A Section Control message selects the current accompaniment section (pattern). The following message:
F0 06 43 7E 00 09 7F F7 Section Control Main B: ON
selects the “MAIN B” section (0x09 0x7F). Because playback is fully automated, section changes are precise.
The penultimate message stops accompaniment:
F0 04 43 60 7D F7 Accompaniment Stop
The final SMF meta message ends the SMF sequencer track:
FF 2F 00 End Of Track (mandatory)
Overall, that’s a lot of power with just a few message types! Most of the Java code involves scanning the ChordPro input, book- and time-keeping. Java has a good MIDI library which makes coding easier.
As to time-keeping, all MIDI events (messages) have a timestamp. Messages issued from set-up directives before start_accomp occur in the first song measure. The start_accomp directive advances the MIDI clock to the first beat of the second measure. Thus, the first chord and lyric (if any) occurs at the beginning of the second measure. Thereafter, MIDI time advances in accord with each chord beat count (default: a full measure as determined by the current time signature).
Look here for more information about ChordPro format.
Copyright © 2021 Paul J. Drongowski