God Rest Ye, Merry Gentlemen (ChordPro)

“God Rest Ye, Merry Gentlemen” by Jon Batiste, Judith Hill, and Stay Human really grooves and I wanted to get in on the fun(k). So, I started with Yamaha Chord Tracker and worked out a similar chord progression.

Wanting to hear the progression and jam on it, I wrote the progression and lyrics in Extended ChordPro:

{title: God Rest Ye, Merry Gentlemen} 
{Artist: Jon Batiste}
{Key: Cm}
{Time: 4/4}
# Style: JazzGuitarClub
{stylecode: 3878}
{Tempo: 120}

{start_accomp}

# Intro [Cm][*IA]

# Verse 1
God [Cm:2][*MA] rest ye [Bb/D:2] merry, [Eb5:2] gentle [Fm:2] men,
Let [Gm:2] nothing [Ab:2] you dis- [Gm:2] may. [G7:2][*FA]
Re- [Cm:2][*MA] member, [Bb/D:2] Christ our [Eb5:2] Sa- [Fm:2] vior was
[Gm:2] Born on [Ab:2] Christmas [Gm:2][*FA] day. [C7:2]
To [Fm:2][*MA] save us [Bb:2] all from [Eb5:2] Satan's [AbMaj7:2] pow'r when

[Eb5:2] We were [Dm:2] gone a- [Bb/D:2] stray. [Bb:2]
O [Eb5:2] Ti- [Ab:2] dings of [Dm:2] com- [Gaug:2] fort and
[Cm:2] Joy, [Fm7:2] Comfort and [Bb7][*FA] joy.
O [Eb5:2][*MA] Ti- [Ab:2] dings of [Dm:2] com- [Gaug:2][*FA] fort and

# Funky interlude

[Cm7:2][*MB] joy. [F:2] ---- [Cm7:2] ---- [F:2] ----
[Cm7:2] ---- [F:2] ---- [Cm7:2] ---- [F:2][*FB] ----

# Ending
[Cm7-9][*EA] --------

Extended ChordPro adds auto-accompaniment features to the well-known and widely used ChordPro song format. I translated the ChordPro to a Yamaha-compatible auto-accompaniment file and played it on Genos™.

In “God Rest Ye,” you’ll notice the new extensions right away. There are a few more directives like: {stylecode: 3878} and {start_accomp}. Chord symbols are enhanced with a beat count, e.g., “[Cm:2]“, placing chord changes on beats within a measure. Annotations indicate auto-accompaniment section changes. For example, “[*MA]” and “[*FA]” mean “Main section A” and “Fill in A”, respectively.

Getting to hear the progression — not just play it by hand — was a huge help. I found a few places where a minor chord was required instead of a major. Play-back encouraged me to listen critically and to find a few hipper voicings.

If you would like a copy of the Java program (cp2mid) which translates Extended ChordPro to a Yamaha auto-accompaniment Standard MIDI File, here is a pointer to the ZIP file page. If you would like more information, please see the ChordPro auto-accompaniment example and demo and my article with ideas and uses for Extended ChordPro auto-accompaniment.

Copyright © 2022 Paul J. Drongowski

ChordPro auto-accompaniment

Before we close out the year, a Christmas gift!

Last January, I developed and wrote about “cp2mid“, a Java program to convert extended ChordPro files to a Yamaha accompaniment MIDI files. cp2mid lets someone compose in extended ChordPro format and play the composition on a Yamaha arranger in an auto-accompaniment style of your own choosing. If you don’t feel like composing, just grab one of the many ChordPro songs on the Web, clean it up, translate it, and play it.

You’ve probably seen ChordPro on the interwebs. It looks like:

# A simple ChordPro example 

{title: God Rest Ye, Merry Gentlemen}

God [Cm] rest ye merry, [Cm] gentlemen,
Let [Ab] nothing you dis[G7]may.
Re [Cm] member, Christ our [Cm] Savior
Was [Ab] born on Christmas [G7] day.

Extended ChordPro adds a few new directives (the things between curly braces) and tightens up the notion of musical time in order to mark measures and place chord changes within measures.

cp2mid translates the chords and lyrics into a Standard MIDI File (SMF). The SMF contains all the magic needed to play an auto-accompaniment on a supporting Yamaha arranger keyboard. (PSR E series, unfortunately, is out of luck.)

If you would like more information, here are some links to dive into:

The first three posts are essential reading for cp2mid users. The last two posts are intended for coders and other technically inclined folks.

Oh, yeah, you’ll need the ZIP file with example songs and cp2mid Java code.

Copyright © 2022 Paul J. Drongowski

ChordPro auto-accompaniment: Uses

The ChordPro to Yamaha auto-accompaniment program, cp2mid, translates an extended ChordPro song file to a MIDI file containing Yamaha-compatible auto-accompaniment messages. The MIDI file is compatible with recent mid- and high-end Yamaha arranger workstations like Yamaha Genos™. Once you transfer the MIDI file to the arranger, it plays like any other Standard MIDI File (SMF). Instead of directly playing notes, however, it tells the arranger’s auto-accompaniment engine what to play: the style, the tempo, the chords and the section (intro, main, fill in, or ending). The arranger displays chords and lyrics in sync with play-back.

What can you do with ChordPro auto-accompaniment? Here’s a few ideas.

Play along with a song from the Web

ChordPro is one of the most widely used song formats on the Web. Pros and punters alike use ChordPro as shorthand lead sheets. You’ve probably seen formatted ChordPro songs like:

 G      G7          C         G 
Amazing Grace! (how sweet the sound)
D
That saved a wretch like me!
G G7 C G
I once was lost, but now am found,
Em D G
Was blind, but now I see.

Presumably, a musician is already familiar with the song’s tempo and melody, needing only to follow and change chords in time.

In extended ChordPro, the chords are embedded within the lyric text:

[G]Amazing [G7] Grace! (how [C] sweet the [G] sound) 
That [G] saved a [G]wretch like [D] me! [D]
I [G] once was [G7] lost, but [C] now am [G] found,
Was [Em] blind, but [D] now I [G] see. [G]

Chords are surrounded by square brackets. Here, we assume each chord is held for a single measure. Songs on the Web are very loose (flexible!) about time. Auto-accompaniment, however, is precise. You will probably need to tighten up timing when using a song file from the Web.

You’ll also see ChordPro directives in song files:

{title: Amazing Grace }   
{key: D}
{artist: Munsoncovers}

Directives express song meta-data and control formatting. Extended ChordPro adds a few new directives for auto-accompaniment:

{title: Amazing Grace }   
{key: D}
{artist: Munsoncovers}
{time: 3/4}
{comment: SouthernGospel is stylecode 7812 3/4}
{stylecode: 7812}
{tempo: 90}
{start_accomp}

You’ll want to add the time signature, tempo, stylecode, and start_accomp directives to the song. The stylecode directive selects one of the hundreds of built-in arranger styles. (A convenient list of codes is included in the distribution.)

You can always leave out the stylecode and select the accompaniment style on the arranger keyboard itself. You can choose one of the preset styles or user styles. Thus, you can try out different arrangements or use a style of your own design.

Finally, extended ChordPro allows annotations which select an accompaniment section like an intro, main, fill-in or ending. Here is “Amazing Grace” ready to go:

{title: Amazing Grace }  
{key: D}
{artist: Munsoncovers}
{time: 3/4}
{comment: SouthernGospel is stylecode 7812 3/4}
{stylecode: 7812}
{tempo: 90}
{start_accomp}

# Introduction
[G][*IA]

# Verse
[G][*MA] Amazing [G7] Grace! (how [C] sweet the [G] sound)
That [G] saved a [G]wretch like [D] me! [D][*FA]
I [G][*MA] once was [G7] lost, but [C] now am [G] found,
Was [Em] blind, but [D] now I [G] see. [G][*FA]

# Ending
[G][*EA]

Don’t forget to turn on the Lyric or Score display. Song chords and lyrics are displayed during play-back.

Jam

Auto-accompaniment is a tireless band! Plug in some chords and play along.

Here is a fast blues shuffle. Copy and paste the 12-bar sections as many times as you like. Change the accompaniment sections to build up energy as the tune progresses.

{title: Shuffle Blues}   
{key: C}
{time: 4/4}
# Style: BluesShuffle (3685)
{stylecode: 3685}
{tempo: 120}

{start_accomp}
[C][*IA]

{start_of_instrumental}
[C][*MA] [C] [C] [C7][*FA]
[F][*MA] [F7] [C] [C7][*FA]
[G7][*MA] [F] [C] [G7][*FC]
{end_of_instrumental}

{start_of_instrumental}
[C][*MB] [C] [C] [C7][*FB]
[F][*MB] [F7] [C] [C7][*FB]
[G7][*MB] [F] [C] [G7][*FC]
{end_of_instrumental}

[C7][*EA]

Experiment with different intros: [*IA], [*IB] or [*IC]. Try different endings: [*EA], [*EB] or [*EC]. An intro or ending will follow the preceding chord as if you played it on the keyboard itself. Generally, the A variations are one measure long. Length of the B and C variations depend on the chosen style. You will need to specify the root chord for each measure in order to keep play-back in sync.

Write a song of your own

Why not write a song of your own? Yamaha’s built-in Chord Step Edit is too detailed and clunky for songwriting. Use cp2mid instead.

{title: Minor Blues}   
{key: Cm}
{time: 4/4}
# Style: SlowBlues (7810)
{stylecode: 7810}
{tempo: 90}

{start_accomp}
[Cm7][*IA]

[Cm7][*MA] My baby left me. [Cm7] [Cm7] Now I'm all alone. [Cm7][*FA]
[Fm7][*MA] My baby left me. [Fm7] [Cm7] And I'm all alone. [Cm7][*FA]
[Ab7][*MA] I still love her, [G7] [Cm7] Won't answer the phone. [Cm7][*FC]

[Cm7][*MB] It's about money, [Cm7] [Cm7] I know it's true. [Cm7][*FB]
[Fm7][*MB] It's about money, [Fm7] [Cm7] I know it's true. [Cm7][*FB]
[Ab7b5][*MB] Can't keep a job, [G7] [Cm7] I am so blue. [Cm7][*FC]

[Cm7][*EA]

It’s easy to change the chord progressions and song structure. Plus, the lyrics are all in front of you. Once the song is loaded, you have the freedom to change the tempo and style on the keyboard. Unlike Chord Step Edit, you can manually choose a user style; you aren’t limited to the preset styles.

Turn on Lyric or Score display. You’ll be able to sing and play along with your new song!

Copyright © 2022 Paul J. Drongowski

ChordPro auto-accompaniment: Implementation notes

I’m prep’ing my ChordPro to Yamaha accompaniment program (cp2mid) for distribution. Please check out the demo. In the meantime, here are a few comments about the implementation.

Command line interface

cp2mid doesn’t have a fancy graphical user interface (GUI). A GUI is too much for a simple tool that translates an extended ChordPro file into a Standard MIDI File (Type 0).

I’m distributing both Java source code and a JAR file. The JAR file contains the compiled Java — the Java executable, if you will. “JAR” is an acronym for “Java Archive” and is produced by the Java archive program (jar), which is part of the Java development environment (JDK). JAR is a way to package up a compiled Java program, hiding all of the interior classes, etc. An end user doesn’t really need to know about JAR.

Given the JAR file, enter the following command line to run cp2mid:

    java -jar cp2mid.jar AFile.cho

“AFile.cho” is the name of an extended ChordPro file to be translated. You can hide the cp2mid.jar file within a Windows BAT file or shell file. Here is cp2mid.bat:

    java -jar cp2mid.jar %1

Nothing complicated, here.

cp2mid recognizes the “.cho” file name extension. It does not recognize any other extensions. If you snag a ChordPro file from the Web, you may need to change its extension to “.cho”. cp2mid replaces “.cho” with “.mid” in order to make the MIDI file name. Thus, “AFile.cho” is translated to “AFile.mid”.

During development and testing, you can run cp2mid starting with the compiled classes, e.g., cp2mid.class. Enter the command line:

    java cp2mid AFile.cho

to run cp2mid. The Java interpreter will look for “cp2mid.class” and the rest of the compiled classes needed by cp2mid. These compiled classes must be available in the same directory as cp2mid.class. “cp2mid”, by the way, is the main class in the application. You’ll need to specify the main class when creating a JAR file. Again, these steps are relevant only to developers.

Java classes

cp2mid has five Java classes:

  • cp2mid (cp2mid.java) Main class and driver
  • SongElement (SongElement.java) Basic element (parts) of a Song
  • Song (Song.java) Represents a ChordPro song in terms of SongElements
  • Song2mid (Song2mid.java) Translates the internal song representation to MIDI
  • MidiFile (MidiFile.java) Represents and manipulates a standard MIDI File (SMF)

The MidiFile class was used in an earlier prototype and still contains a bit of unused legacy code. This may change in future versions. The MidiFile class exploits the standard Java MIDI packages and classes. It creates a MIDI file and inserts MIDI messages (meta, SysEx and otherwise) into a MIDI file.

cp2mid is the boss. It calls on the other classes to do their jobs. Processing is broken into five phases:

  1. Check and manipulate file names.
  2. Read the ChordPro file into a String array, one line per array element.
  3. Translate each line into one or more SongElements.
  4. Translate the SongElements into MIDI.
  5. Write the internal MIDI representation to a Type 0 SMF.

The translation phases do the heavy lifting.

Song and song elements

A Song is a list of SongElements. A SongElement represents one of several ChordPro song constituents:

  • Directive
  • Chord
  • Lyric
  • Line
  • Annotation
  • Comment
  • Tab

All SongElements have the same data members. Each SongElement has a tag which identifies its type. The type determines the validity and interpretation of the other data members.

The Song class translates extended ChordPro to a list of SongElements. This is, effectively, the intermediate, internal representation of a ChordPro song.

ChordPro directives begin with ‘{‘ and end with ‘}’. Usually ChordPro directives control song formating. Extended ChordPro uses key, tempo, time signature, style code, start accompaniment and stop accompaniment directives to issue MIDI messages that will control the accompaniment engine when the MIDI file is played back.

ChordPro chords and lyrics are what it’s all about. Chords begin with ‘[‘ and end with ‘]’. Chords are extended by an optional beat count which specifies how long the chord is held. A lyric is text and may be multiple syllables long (i.e., anything up to the next chord, annotation, or end of line.)

A line element is a marker for important end-of-lines. Line elements affect lyric formating.

Normally, a ChordPro annotation is text added to a song when it is displayed. Annotations begin with ‘*[‘ and end with ‘]’. Certain predefined annotations, e.g., [*MA], [*FA], etc. change the accompaniment section during play-back.

Comments are just that. cp2mid saves the text, but doesn’t do anything with it.

A ChordPro song may contain guitar tablature (tab). Right now, cp2mid ignores tablature. This has not been tested. I’m not sure how to handle or translate tablature as yet.

Song to MIDI

The Song2mid class translates the internal intermediate song representation to MIDI messages and adds the MIDI messages to a MIDI sequence. The MidiFile class helper functions create specific types of messages. Base MIDI message and sequence classes belong to the standard Java MIDI package.

The Song2mid class walks the SongElement list from front to back. Based on element type, it dispatches to an element type-specific handler. The handler adds one or more MIDI messages to the sequence.

A separate blog post describes the MIDI messages.

I tried to encapsulate most of the “Yamaha-ness” in the Song2mid and MidiFile classes. ChordPro is very loose and forgiving when it comes to chord syntax. Song2mid recognizes only the 33 or so Yamaha chord types as defined in the Genos Data List PDF. If Song2mid doesn’t recognize a chord, it issues either a major or minor triad.

Example songs

I will distribute 15 example songs in extended ChordPro and MIDI format. Even if you don’t run cp2mid (or look at its implementation), please take a look at the extended ChordPro songs and try the MIDI files on your arranger. All sorts of fun and crazy things happen in real music (key changes, time signature changes, anticipation) and the examples demonstrate how to handle many exceptional situations. I chose certain songs as examples for testing because they are weird. 🙂

I tested the MIDI files on Genos and I’m curious about their behavior on other arranger keyboards. The MIDI files are similar to those generated by Yamaha ChordTracker. If your arranger plays ChordTracker MIDI files, it should play cp2mid MIDI files.

I don’t want to lead you on — it takes a fair bit of effort to take an Internet ChordPro file and whip it into shape. ChordPro as a formating tool is very lenient and forgiving. Accompaniment requires tighter semantics and precision like most “executable” computer stuff. It’s fun to whip a song into shape, but it requires work.

Copyright © 2022 Paul J. Drongowski