Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

ABC notation/Basics

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

This chapter is aimed at getting familiar with ABC notation. The first example 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 "sample01's out put PDF". thumb|alt=eine kleine Nachtmusic|sample01's out put PDF Simple explanation 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 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 Comments and line breaks We can use percent '%' to make a comment line. Percent mark means that the rest of the line is ignored. When we want to write one line for ABC notation interpretation but want to break for readability, put a back slash '\' before the break. X:1 T:eine kleine Nachtmusik C:W. A. Mozart K:G M:C L:1/4 Q:Allegro % lines below are interpreted as one line 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|