↑↑ Home | ↑ Noise |
This page presents a small program that generates sheets of musical scales that everyone loves practicing so much. Unlike real pieces of music, they require no creativity and are therefore an easy task for something as dumb as a computer.
The program is written in the interpreted language Perl
and uses the abcm2ps
program to generate printed
music notation. The program itself only outputs the
ABC music notation
, and some
of its arguments also use that notation.
Before things get too theoretical or too complicated, let's have a simple example. The command
printscales.pl -r _B,-e\' G
The option -r gives the tonal range to include in the scale, usually the
range your instrument can play. The low and high end of the range are given in
ABC notation, separated by a hyphen. printscales.pl conforms to the
ABC pitch notation which
differs by two octaves from the traditional
Helmholtz notation
.
_B, is the B flat below the ledger lines, and e' is the E above them.
The backslash before the apostrophe only tells the command shell that it does
not delimit a quoted string.
Finally, the single G at the end of the command says to generate a G scale. The generated document contains only one line of music notation:
Printing ordinary scales is not all you can do, however. With the -s option, you can give a list of interval steps between successive notes. The thing to keep in mind is that printscales.pl counts steps as in a programming language, not as musical nomenclature, so a second is denoted by 1, a third by 2 and so on. Here is an example in A minor:
printscales.pl -r _B,-e\' -s 2,-1 Am
The scale always contains the full range given by -r, so A minor generates the same scale as C major would. More root notes can be added to print multiple scales in the same document. -s options may be interspersed between them to change the type of the following scales.
Remember that you need Perl
and abcm2ps
to run it. Depending on your
installation, you have to install it to a standard location, add its path to
the PATH environment variable, or call it as ./printscales.pl or perl
printscales.pl. If you give the -h option, it will print a description
of its command-line syntax. The PostScript files it generates can be viewed
with gv (Ghostview)
or converted to PDF
with ps2pdf, which comes with Ghostscript
.