Header3
PageHeader
Body
Body Large (20/130%/14)
Body Large (20/130%/14) #2

Using abc Notation for Writing Out Fiddle Tunes

About abc Notation IV ~ Fine Control of Formatting and Display of Music

We looked at the tune body and the tune header earlier. In this section we are looking at how to change the appearance of the output from an abc app: usually a PDF document. These changes are made through formatting commands in the file headers.

This is a somewhat more advanced tutorial, and assumes that you've had at least some experience with abc notation and are looking for ways to improve the appearance of your tunes on screen and/or in print, or perhaps that you are looking to gain more control over what prints and what doesn't print.

Important Note: The abc code and notation examples below works best on a screen at least 768 pixels wide. You should hold an iPhone or any other small screen in landscape orientation for best results.

 

Links to Related Pages

 

 

Formatting and Display of Tunes

I used to think that abc notation was fairly limited in its output and that it wasn't possible to change fonts or formatting or what aspect of the music is displayed. I knew it was possible to use Postscript commands to make those sorts of changes, but I thought Postscript was for programmers, and largely ignored the documentation of postscript commands for abc.

In preparing this web site I figured out that every one of those assumptions was wrong, and that it's not that hard to make some of the changes I wanted to make. Sure, advanced usage of Postscript is still beyond me, but I've gradually figured out how to get my output to look more and more as I liked it to look.

Let's look at the A part of Smash the Windows. Here's the abc code. There isn't any real formatting present here. I added in a two-line note using the N: field.

 

X:1

T:Smash The Windows   % title

T:Roaring Jelly       % another title

M:6/8                 % meter

L:1/8                 % default note length

R:Jig                 % rhythm

K:D                   % key

N:This is a jig that's often played for New

N:England contradances.

  A |\

"D" DED F2A | "D" d2f "A" ecA  | "G" G2B "D/F#"  F2A | "Em" E2F  "A7" GFE |

"D" DED F2A | "D" d2f "D7" ecA | "G" gfe "A7" cAc    | "D"  d3 - d2 :|

 

Here's what it looks like.

Notes don't print normally. Suppose we wanted it to print. Or suppose we want to change the size of the tune, or perhaps the size of the chord letters, or of the noteheads. Or suppose we want to change the typeface of the chords or the title.

All that is pretty easy to do by adding in some Postscript code. Some of it can be found in the abc Standard. But some of it is best found in the Parameters page for abcm2ps and abc2svg.

These Postscript commands can go at the top of an abc document, in a separate format file, or in the body of the tune. If it goes in the body of the tune it affects that one tune. If it goes before the X: line or in a separate format file, it affects all other tunes in the same abc document.

Let's add in some formatting. We'll format the title in Palatino Bold, the second title in Palatino Italic, and make the chords Palatino Bold as well. Here's how it looks:

 

%%font          Palatino-Bold         % defines the fonts

%%font          Palatino-Italic

%%titlefont     Palatino-Bold 20      % Font of title

%%subtitlefont  Palatino-Italic 16    % Font of second title

%%gchordfont    Palatino-Bold 14      % Chord font

 

X:4

% A part with formatting for chords, tune titles

T:Smash The Windows   % title

T:Roaring Jelly       % another title

M:6/8                 % meter

L:1/8                 % default note length

R:Jig                 % rhythm

K:D                   % key

N:This is a jig that's often played for New

N:England contradances.

A |\

"D" DED F2A | "D" d2f "A" ecA  | "G" G2B "D/F#"  F2A | "Em" E2F  "A7" GFE |

"D" DED F2A | "D" d2f "D7" ecA | "G" gfe "A7" cAc    | "D"  d3 - d2 :|

 

Here's what it looks like:

Now let's suppose that after the %%gchordfont line we put the following:

 

%%writefields N          % notes (N:) are printed

 

The tune would now look like this:

From my experience as someone with no expertise in Postscript, it's not too hard to figure out how to customize the output. It takes a bit of searching through the abcm2ps documentation and sometimes the abc Standard documentation, but once you get used to it things become easier to find.

Although not as complete, I'd suggest going to the Headers Page if you want to learn more.

  • It's pretty well documented, and should serve as a set of formatting parameters that you can figure out to use.
  • It starts with a discussion of how an abc file is structured. If you keep going, you'll get to the File Header section. That's the file header that should be at the beginning of each abc document on this web site.
  •  It's pretty well documented, so you should be able to figure out a lot about using many of the formatting commands.

That's the end of this section on the workings of abc notation. To learn more I'd suggest going to the links page and looking for informational web sites on the topic of interest. To start the links section, click on the Next Page button.

 

 

Header2TopLine
abc Codexx
Tune Links (16, indented)