ABC notation/Basics

This chapter is aimed at getting familiar with ABC notation.

The first example

edit

You can write the first source code as below with '.abc' extantion on any text editor.

X:1
T:eine kleine Nachtmusik
C:W. A. Mozart
K:G
M:C
L:1/4
Q:Allegro
gz1/2d1/2gz1/2d1/2|g1/2d1/2g1/2d'1/2d'z|c'z1/2a1/2c'z1/2a1/2|c'1/2a1/2f1/2a1/2dz|

In this case, we suppose the file name as 'sample01.abc'. We convert this code to a PDF file.

% abcm2ps sample01.abc
% ps2pdf Out.ps

The generated file 'Out.pdf' is below.

 
sample01's out put PDF

Simple explanation

edit

The first command abcm2ps generates PS file from abc file. The second command ps2pdf generates PDF file from PS file.

The abc file comprises headers and tunes. A header begins with a letter followed by a column and information. 'K:' denotes the key signature. Here 'K:G' means G dur.

The line begins with gz describes the melody of this sheet music. 'z' means rest. '|' denotes bar line.

We explain headers and other notation in detail in other chapters.

Some improvements

edit

We can easily adjust output file name.

% abcm2ps -O sample01.ps sample01.abc
% ps2pdf sample01.ps

The generated file is 'sample01.pdf'.

We can generate an output PDF file with one command 'make' if we create 'Makefile' file.

% cat Makefile
#definitions
ABC=abcm2ps
ABCOPTIONS= -O =
GS=ps2pdf
TITLE=sample01
.SUFFIXES: .abc .ps .pdf

#rules
all: $(TITLE).pdf
.abc.ps:
	$(ABC) $(ABCOPTIONS) $<
.ps.pdf:
	$(GS) $<
clean:
	rm -f *.ps