Chordlab: chopro to pdf
Posted 2008-02-12 00:15. Last updated 2010-10-20 05:55. Tagged music, python, project, pdf, reportlab.
Chordlab is a command line program I wrote to create pdf songbooks from chopro source.
Normal usage is to give chordlab a list of chopro files (each containing one or more songs). Chordlab then produces a pdf of one page for each song. Long songs can span several pages, as needed. Since the lines of a song text is often short, chordlab supports pages with multiple columns.
Update 2010-10-20: To make chordlab more truly open, and since I sucked at hosting a publicly accessible monotone repository, I have now moved chordlab to github, where it is availiable as kaj/chordlab.
First, here’s a sample output and the chopro source to generate it.
Seems cool? Try it! Here’s the source and revision history. To use it, you will need Python and the reportlab python package. Chordlab is free software.
The chopro format
The chopro
format is a pseudo-standard format for song lyrics with
chords.
The basic format is simply plain text with chords in brackets.
Some extra markup is added in braces, in the form {keyword:
value}
, where the : value
part is only relevant for some
keywords.
A common example may look like this:
{title: Yesterday}
{subtitle: Beatles}
{define: C/G base-fret 0 frets 3 3 2 0 1 0}
[G]Yesterday[F#m], all my [B7]troubles seemed so [Em]far away
[C]Now it [D]looks as though there [C]here to [G]stay
...
Why chordlab?
Once upon a time there was a program named chord
.
It did approximately what this page describes.
It wasn’t perfect or bug-free, but it existed and kind of worked.
Now I tried to install chord
on my new Ubuntu laptop.
There was no “chord” in the package system.
So I googled.
As far as I can tell, the program doesn’t exist outside of the FreeBSD
port/package collection, which has kept an old snapshot.
Since I had other reasons to learn python (mainly to be able to help
Katy, who takes a course in it), I saw this as a convenient example
and dug in.
After very few hours I had a working program. I think that gives good credit both to the python programming language and to the reportlab package.
I don’t claim chordlab to be perfect or bug-free either, but it exists. Now I can continue making it better until it is perfect.
Comments
This post is 14 years old, comments are disabled.