Play along with ChordPro

A Troubadour's Life

Article from Issue 236/2020

If you play a stringed instrument and want to record lyrics and chord changes, ChordPro gives you an elegant and convenient approach to getting it all on paper.

The prejudice that guitarists can't read music is as persistent as the assumption that bassists don't have a girlfriend. And there is some evidence to support the former – at least when you think about campfire songsters and shopping mall bards. But even these string instrumentalists can't manage without at least some notation and music theory. They add standardized chord names to their lyrics and can then read and accompany known songs without any problems. To do this, you simply enter the chord abbreviations in every second line above the word where the fingering changes (Listing 1).

Listing 1

Chord Abbreviations

 Am     C
Alas my love,
    G     Em
you do me wrong,
   Am              E
to cast me off discourteously,
    Am     C     G      Em
for I have loved you so long,
  Am           E7       Am
delighting in your company.

Now imagine that you're making the move from handwritten notation to a word processor. This can work quite well as long as you use a monospace font. The problem is that with proportional fonts, chords might be offset when the font parameters are changed and this would cause havoc with the rhythm and harmonies of the song. Also, aligning superimposed characters at different positions within a line is often a difficult and time-consuming task in a word processor.

This is one reason you may want to turn to a specialized program such as ChordPro [1], which can take much of the load off the musician's shoulders by simplifying the correct placement of lyrics and chords. Also consider what happens if the chords in your song don't happen to match your vocal range. In order to accommodate different vocal ranges and basic tunings of instruments, whole pieces of music can be shifted in terms of pitch – or transposed, to quote the technical term. To do this, all notes are shifted up or down by the same interval. While not even the best-equipped word processor in the world will offer a macro for that, a specialized program like ChordPro can greatly simplify this process.

The ChordPro application is based on the markup format [2] of the same name, which you could just as easily type in your preferred text editor. It's a lean program focused on basic functions, without the need for the steep learning curve of other options such as MuseScore [3] or LilyPond [4].

In the GUI

For details on how to install the software, see the box "Installing ChordPro."

Installing ChordPro

Currently ChordPro is not available in the package inventories of most popular distributions. To install the command-line version, you need a whole bunch of Perl modules, namely String::Interpolate:: Named, Font::TTF, Image::Info, IO::String, JSON::PP, PDF::API2, App::Packager, and File::LoadLines. You will find the modules with these names in the CPAN Perl software pool. The names of the corresponding distribution packages usually consist of the module names preceded by perl- and minus signs instead of the double colons.

Once you have resolved all the dependencies, you can install ChordPro in just three steps: perl Makefile.PL, make, and make install (working as root for the latter as usual). To use the graphical interface, you also need the Perl bindings for wxWidgets, which you can find on Debian-based distributions under the name libwx-perl. On RPM systems like openSuse, Fedora, or Mageia the package is called perl-Wx.

After the install, no matter whether you do this manually or use a package (Arch Linux), you will not find a menu entry to start ChordPro. The command for the quick start window or terminal is wxchordpro. It is more convenient to use a file like the one shown in Listing 2, which you need to save as ~/.local/share/applications/chordpro.desktop. It will display ChordPro below Multimedia in the Start menu.

Arch Linux is the only distribution that makes this procedure easier for you with a package named chordpro-git in the Arch User Repository. It is based on the latest snapshot of GitHub, not the latest release. However, take care to install the perl-wx package, too, as it does not appear in the ChordPro dependency list. This report is based on the version I used for this article – so it's conceivable that you will find some changes compared to the description here.

Listing 2

Display ChordPro

[Desktop Entry]
Comment=Lyrics and chords formatting program

When you first start the application, a file selection dialog opens to let you select an existing ChordPro file. To start a new file instead, you can simply cancel the dialog. This opens the main window with an empty worksheet. Now replace the New Song placeholder with the title of the desired song, for example, the text from Listing 1 (Figure 1).

Figure 1: The ChordPro text editor with song lyrics and chords.

Now don't put the chords between the lines, as you would in plain text, but place them in square brackets in front of the word or syllable where the fingering change takes place. In addition, you can use tags like {title: song name} and {subtitle: More info} to store song details in the song text header. Instead of using a generic subtitle, you can add additional information such as the composer, lyricist, artist, year of release of the album, and far more.

Optionally, there is the possibility to color-highlight the chords. To do this, add the {chordcolour: <Color>} directive; this accepts both identifiers like red, green, or blue, as names, but also hexadecimal specifications such as #4491ff. ChordPro also supports color changes within the lyrics. To do so, simply set a chordcolour statement with a new or empty color specification. The file format specification is available from the ChordPro wiki [2].

You can also use the program to open an existing file. Theoretically, when you first open the program, the software will load any text file if you select All Files instead of ChordPro files. However, the file selector does not seem to correctly identify plain text files. It is easy to trick the program, though. Just append one of the accepted extensions to the desired text file, for example *.cho, and ChordPro will open it without any problems.

When saving, make sure you add one of the accepted extensions to the file name, because the program will not automatically append it and will not find the saved file later.

Preferences Dialog

Although ChordPro comes with a usable basic configuration, you may still want to adjust the settings. You will need to in order to create a PDF file from the program. You can open the Preferences dialog (Figure 2) by selecting Edit | Settings.

Figure 2: The Preferences dialog is the key element in the ChordPro GUI.

In the list at the top you can adjust the instrument if necessary. If you are playing a guitar with standard tuning, you don't have to change anything here; otherwise you can use other guitar tunings or choose a different string instrument, like a mandolin or ukulele. This choice affects what the fingering patterns below the lyrics look like.

You should leave the editor font as a monospace variant and only change the font size if desired. The notation is important: While Italians, for example, still write in the relative form Do-Re-Mi-Fa, the English-speaking world uses the scale C-D-E-F-G-A-Bb-B-C. In the Transcode to field, you can also elegantly migrate the notation of a file from one variant to another.

One very practical function is the ability to transpose, as mentioned above. If the chords don't match your vocal range at all, simply move them up or down using Transpose. The configuration in Figure 2 causes a transposition from C to C# (i.e., one semitone upwards).

In the end, the PDF previewer is most important, because ChordPro always has to use an external preview program due to the lack of built-in functionality. Don't forget to add a %f as a placeholder for the temporary file to the call command, so that ChordPro really hands it over.

Once you have finished the text, output it as a PDF. Since the program does not provide a menu item for printing, open via File | Print Preview the PDF previewer set in the configuration. The Okular document viewer displays an attractively formatted text with neatly placed chord labels and grip images at the bottom of the page (Figure 3). From the preview viewer, you can print the lyrics directly or save the page as a PDF.

Figure 3: The lyrics and chords to "Greensleeves," displayed in the Okular document viewer.

In the Terminal

The GUI is quite convenient to work with, but it lacks many features that only work in the command-line version. You can select your own configuration file in the configuration settings below Custom config, but since the configuration file is external anyway, you can also feed it to the chordpro command (Figure 4). It can do everything that the GUI does without this file just by using command-line parameters – and even more.

Figure 4: The parameter selection in ChordPro is extensive. Everything else can be set up with a configuration file.

In addition to its own arguments, ChordPro can handle many of the commands from the closely related Chordii [5] program, a kind of predecessor to ChordPro. However, it can only work with version 4 of the ChordPro format, while ChordPro itself supports version 5; on top of that ChordPro has a GUI, which Chordii does not have.

The command from Listing 3 lets you change the size of the fingering images, for example. ChordPro will automatically create a PDF file in A4 portrait format, which fits about four chord images on a page. If the A4 format is too big, simply specify a more convenient page size with the --page-size=a5 option.

Listing 3

Change Fingering Image Size


Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Introduction

    This month in Linux Voice.

  • Solfege

    Solfege helps you advance your musical knowledge and lets you practice identifying intervals, scales, and chords.

  • Free Software Projects

    Linux is a wonderful and underrated audio production platform, with great applications for every audio task. MuseScore and LilyPond bring elegance and sophistication to score writing, and Chordii is a wonderfully simple guitar sheet-music maker.

  • LMMS

    Linux has truly started to compete with Windows and MacOS as a platform for professional sound applications. Linux Multimedia Studio (LMMS) is a Linux sound tool that packs a variety of impressive features into a neat bundle.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More