2003-07-20 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * VERSION: release 1.7.27
+
+ * buildscripts/new-chords.py (help): add help text
+
+ * Documentation/user/introduction.itely (Typography and program
+ architecture): fixes.
+
* Documentation/user/GNUmakefile (DVIPS_PAPERSIZE): set A4 paper
for texinfo and dvips. This fixes problems with PDF output of the
wrong size.
OMF_FILES += $(outdir)/lilypond-internals.html.omf
-TEXINFO_PAPERSIZE = @afourpaper
-DVIPS_PAPERSIZE = a4
-
LOCALSTEPMAKE_TEMPLATES=lilypond ly
LILYPOND_BOOK_FLAGS=--extra-options '-e "(ly:set-option (quote internal-type-checking) \#t)"'
@menu
* Music notation and engraving::
-* Computerized typography::
+* Notation and engraving in LilyPond::
+* Typography and program architecture::
* Music representation::
* Example applications::
* About this manual::
@cindex typography
Making sheet music may seem trivial, ``you print 5 lines, and then put
-in the notes at different heights'', but as one learns more of it, the
-opposite turns out to be true. There are two problems when making
-sheet music. First, one has to master music notation: the science of
-knowing which symbols to use when what. Second, one has to master
-music engraving: the art of placing symbols such that they look
-elegant.
-
-Common music notation has its roots in the medieval centuries. In this
+in the notes at different heights'', but as you learn more of it, the
+opposite turns out to be true. One has to master two difficult
+tasks. First, one has to master music notation: the science of knowing
+which symbols to use when what. Second, one has to master music
+engraving: the art of placing symbols such that the result looks
+pleasing.
+
+Common music notation has its roots in the medieval time. In this
time, monks started to write down hints that indicated how their
sacred music was sung. These hints, neumes, gradually became simpler,
and at some point became the note heads. Lines were added to the
notation is still under development; the innovations of contemporary
music require still newer and more complex notations.
-In summary, common music notation encompasses such a wide scope of
-music inherently is complex: there are many rules, and for every rule
-there are exceptional situations where they do not apply. The result
-is that LilyPond cannot support each and every form of notation in
-existence. Rather, we focus on a specific style and idiom: we take
-inspiration from late-romantic music printed at the beginning of the
-20th century. Most of the contemporary music after that, and most of
-the music going back to 17th century can be written in this
-idiom. That is not a fundamental limit, though. There is support for
-some modern notation like clusters, and older notation, such as white
-mensural and gregorian notation, is being worked on.
-
-The term music engraving derives from the traditional process of
-music printing. Only a few decades ago, sheet music was made by
-cutting and stamping the music into zinc or pewter plates,
-mirrored. The plate would be inked, and the depressions caused by the
-cutting and stamping would hold ink. An image was formed by pressing
-paper to the plate. The stamping and cutting was completely done by
-hand. Making corrections was cumbersome, so engraving had to be done
-correctly in one go. As you can imagine this was a highly specialized
-skill, much more so than the traditional process of printing books.
+The term music engraving derives from the traditional process of music
+printing. Only a few decades ago, sheet music was made by cutting and
+stamping the music into zinc or pewter plates, mirrored. The plate
+would be inked, and the depressions caused by the cutting and stamping
+would hold ink. An image was formed by pressing paper to the
+plate. The stamping and cutting was completely done by hand. Making
+corrections was cumbersome, so engraving had to be done correctly in
+one go. Of course, this was a highly specialized skill, much more so
+than the traditional process of printing books.
@cindex craftsmanship
@cindex master
-In the traditional German craftsmanship six years of full-time
+In the traditional German system of craftsmanship six years of full-time
training, more than any other craft, were required before a student
could call himself a master of the art. After that many more years of
practical experience were needed to become an established music
advanced software, music requires lots of manual fine tuning before it
is acceptable for publication.
-Sheet music is performance material, hence everything is done to aid
-the musician in letting him perform better. Music often is far away
-from its reader---it might be on a music stand. To make it clearly
+Sheet music is performance material: everything is done to aid the
+musician in letting him perform better. Music often is far away from
+its reader---it might be on a music stand. To make it clearly
readable, traditionally printed sheet music always uses bold symbols,
on heavy staff lines, and is printed on large sheets of paper. This
``strong'' look is also present in the horizontal spacing. To
minimize the number of page breaks, (hand-engraved) sheet music is
spaced very tightly. Yet, by a careful distribution of white space,
-the feeling of balance is retained, and clutters of black are avoided.
+the feeling of balance is retained, and a clutter of symbols is
+avoided.
+
+
+@node Notation and engraving in LilyPond
+@section Notation and engraving in LilyPond
+
+Common music notation encompasses such a wide scope of music, and
+therefore inherently is complex: there are many rules, and for every
+rule there are exceptional situations where they do not apply. The
+result is that LilyPond cannot support each and every form of notation
+in existence. Rather, we focus on a specific style and idiom: we take
+inspiration from late-romantic music printed at the beginning of the
+20th century. Most of the contemporary music after that, and most of
+the music going back to 17th century can be written in this
+idiom. That is not a fundamental limit, though. There is support for
+some modern notation like clusters, and older notation, such as white
+mensural and gregorian notation, is being worked on.
We have used these observations in designing LilyPond. The images
below shows the flat symbol. On the left, a scan from a Henle edition,
which was made by a computer, and in the center is the flat from a
-B@"{a}renreiter edition of the same music. The symbols have noticeable
-differences: the left image is much lighter, the staff lines are
-thinner, and the glyph has a straight layout with sharp corners. By
-contrast, the B@"{a}renreiter has a bold and almost voluptuous rounded
-look. Our flat symbol is designed after, among others, this one. It
-is tuned it to harmonize with the thickness of our staff lines, which
-are also much thicker than Henle's lines.
+B@"{a}renreiter edition of the same music. The left scan illustrates
+typical flaws of computer print: the symbol is much lighter, the staff
+lines are thinner, and the glyph has a straight layout with sharp
+corners. By contrast, the B@"{a}renreiter has a bold and almost
+voluptuous rounded look. Our flat symbol is designed after, among
+others, this one. It is tuned it to harmonize with the thickness of
+our staff lines, which are also much thicker than Henle's lines.
@multitable @columnfractions .1 .3 .3 .3
@item @tab
@cindex regular rhythms
@cindex regular spacing
-The fragment that was printed uses only quarter notes: notes that are
-played in a constant rhythm. The spacing should reflect
-that. Unfortunately, the eye deceives us a little: the eye not only
-notices the distance between note heads, but also between consecutive
-stems. As a result, the notes of an up-stem/down-stem combination
-should be put farther apart, and the notes of a down-up combination
-should be put closer together, all depending on the combined vertical
-positions of the notes. The first two measures are printed with this
-correction, the last two measures without. The notes in the last two
-measures form down-stem/up-stems clumps of notes.
-
-@node Computerized typography
-@section Computerized typography
+The fragment only uses quarter notes: notes that are played in a
+constant rhythm. The spacing should reflect that. Unfortunately, the
+eye deceives us a little: not only does it notice the distance between
+note heads, it also takes into account the distance between
+consecutive stems. As a result, the notes of an up-stem/down-stem
+combination should be put farther apart, and the notes of a down-up
+combination should be put closer together, all depending on the
+combined vertical positions of the notes. The first two measures are
+printed with this correction, the last two measures without. The notes
+in the last two measures form down-stem/up-stems clumps of notes.
+
+@node Typography and program architecture
+@section Typography and program architecture
Producing good engraving requires skill and knowledge. It was our
challenge to see if we could put such typographical knowledge into a
<< PITCHES >>
-In version 2.0, this syntax will be changed to
+It is not necessary to update files to this syntax, but it will be for
+using LilyPond version 2.0. In version 2.0, this syntax will be
+changed to
< PITCHES > for chords
\simultaneous { .. } for simultaneous music.
+To convert your files from <PITCHES> to <<PITCHES>>, use the script
+included in buildscripts/convert-new-chords.py
+
** A new uniform postfix syntax for articulation has been introduced.
A beamed slurred pair of eighth notes can be entered as
--- /dev/null
+
+# to nwe chord syntax.
+import re
+import string
+import sys
+import getopt
+import os
+
+
+def sub_chord (m):
+ str = m.group(1)
+
+ origstr = '<%s>' % str
+ if re.search (r'\\\\', str):
+ return origstr
+
+ if re.search (r'\\property', str):
+ return origstr
+
+ if re.match (r'^\s*\)?\s*\\[a-zA-Z]+', str):
+ return origstr
+
+ durs = []
+ def sub_durs (m):
+ durs.append(m.group(2))
+ return m.group (1)
+
+ str = re.sub ("([a-z]+[,'!? ]*)([0-9.]+)", sub_durs, str)
+ dur_str = ''
+
+ for d in durs:
+ if dur_str == '':
+ dur_str = d
+ if dur_str <> d:
+ return '<%s>' % m.group (1)
+
+ pslur_strs = ['']
+ dyns = ['']
+ slur_strs = ['']
+
+ last_str = ''
+ while last_str <> str:
+ last_str = str
+ def sub_dyn_end (m):
+ dyns.append (' -\!')
+ return ' ' + m.group(2)
+
+ str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str)
+ def sub_slurs(m):
+ if '-)' not in slur_strs:
+ slur_strs.append ( '-)')
+ return m.group(1)
+ def sub_p_slurs(m):
+ if '-\)' not in slur_strs:
+ slur_strs.append ( '-\)')
+ return m.group(1)
+ str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
+ str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
+ def sub_begin_slurs(m):
+ if '-(' not in slur_strs:
+ slur_strs.append ( '-(')
+ return m.group(1)
+ str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(", sub_begin_slurs, str)
+ def sub_begin_p_slurs(m):
+ if '-\(' not in slur_strs:
+ slur_strs.append ( '-\(')
+ return m.group(1)
+
+ str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(", sub_begin_p_slurs, str)
+
+ def sub_dyns (m):
+ s = m.group(0)
+ if s == '@STARTCRESC@':
+ slur_strs.append ("-\\<")
+ elif s == '@STARTDECRESC@':
+ slur_strs.append ("-\\>")
+ elif s == r'-?\\!':
+ slur_strs.append ('-\\!')
+ return ''
+
+ str = re.sub (r'@STARTCRESC@', sub_dyns, str)
+ str = re.sub (r'-?\\!', sub_dyns, str)
+
+ def sub_articulations (m):
+ a = m.group(1)
+ if a not in slur_strs:
+ slur_strs.append (a)
+ return ''
+
+ str = re.sub (r"([_^-]\@ACCENT\@)", sub_articulations, str)
+ str = re.sub (r"([_^-]\\[a-z]+)", sub_articulations, str)
+ str = re.sub (r"([_^-][>_.+|^-])", sub_articulations, str)
+
+ def sub_pslurs(m):
+ slur_strs.append ( ' -\\)')
+ return m.group(1)
+ str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str)
+
+ suffix = string.join (slur_strs, '') + string.join (pslur_strs, '') \
+ + string.join (dyns, '')
+
+ return '@STARTCHORD@%s@ENDCHORD@%s%s' % (str , dur_str, suffix)
+
+
+
+
+simend = '}'
+simstart = "\n\\simultaneous {"
+chordstart = '<'
+chordend = '>'
+
+old_syntax = 1
+
+if old_syntax:
+ simend = '>'
+ simstart = "<"
+ chordstart = '<<'
+ chordend = '>>'
+
+
+marker_str = '%% new-chords-done %%'
+
+def sub_chords (str):
+ if re.search (marker_str,str):
+ return str
+ str= re.sub (r'\\<', '@STARTCRESC@', str)
+ str= re.sub (r'\\>', '@STARTDECRESC@', str)
+ str= re.sub (r'([_^-])>', r'\1@ACCENT@', str)
+ str = re.sub ('<([^<>{}]+)>', sub_chord, str)
+ str = re.sub (r'\\! *@STARTCHORD@([^@]+)@ENDCHORD@',
+ r'@STARTCHORD@\1@ENDCHORD@-\!',
+ str)
+ str = re.sub ('<([^?])', r'%s\1' % simstart, str)
+ str = re.sub ('>([^?])', r'%s\1' % simend, str)
+ str = re.sub ('@STARTCRESC@', r'\\<', str)
+ str = re.sub ('@STARTDECRESC@', r'\\>' ,str)
+ str = re.sub (r'\\context *Voice *@STARTCHORD@', '@STARTCHORD@', str)
+ str = re.sub ('@STARTCHORD@', chordstart, str)
+ str = re.sub ('@ENDCHORD@', chordend, str)
+ str = re.sub (r'@ACCENT@', '>', str)
+ return str
+
+def articulation_substitute (str):
+ str = re.sub (r"""([^-])\[ *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+ r" \1 \2-[", str)
+ str = re.sub (r"""([^-])\) *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+ r"\1 \2-)", str)
+ str = re.sub (r"""([^-])\\! *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+ r"\1 \2-\\!", str)
+ return str
+
+def help ():
+ print r"""
+new-chords.py -- update .ly files to new syntax.
+
+Usage:
+ new-chords.py [OPTIONS] FILE(S)
+
+Options
+
+ -e, --edit in-place edit
+ -h, --help this help
+
+Description
+
+ This script converts old chord notation to new chord notation, i.e.
+
+ \< <a )b>
+
+ becomes
+
+ <<a b>> -\< -)
+
+ It will also convert slur-end, beam-start and cresc-end to postfix
+ notation, i.e.
+
+ [ \! )a
+
+ becomes
+
+ a-\!-)-[
+
+ By default, the script will print the result on stdout. Use with -e
+ if you are confident that it does the right thing.
+
+Warning
+
+ This conversion does not convert all files correctly. It is
+ recommended to verify the output of the new file manually.
+ In particular, files with extensive Scheme code (markups, like
+
+ #'(italic "foo")
+
+ and Scheme function definitions may be garbled by the textual
+ substitution.
+
+"""
+
+
+(opts, files)= getopt.getopt( sys.argv[1:], 'eh',['help','edit'])
+edit = 0
+for (o,a) in opts:
+ if o == '-e' or o == '--edit':
+ edit = 1
+ if o == '-h' or o == '--help':
+ help ()
+ sys.exit (0)
+
+if not files:
+ print 'Error: no input files.\n use -h for help.'
+ sys.exit(2)
+
+
+for a in files:
+ str = open (a).read()
+ if re.search (marker_str, str):
+ continue
+
+ sys.stderr.write ("processing %s\n" %a)
+
+ str = sub_chords (str) + marker_str + '\n'
+ str = articulation_substitute (str)
+
+ if edit:
+ open (a + '.NEW', 'w').write (str)
+ os.rename (a, a + '~')
+ os.rename (a + '.NEW', a)
+ else:
+ print str
+
+
+##
+## regexes for postfix slur & beam:
+##
+#PYTHON
+##
+#EMACS
+## \([^-]\)\[ *\([a-z]+[!?]?[,']*[0-9:]*\.*\)
+#### ->
+## \1 \2-[
+##
+## \([^-]\)) *\([a-z]+[!?]?[,']*[0-9:]*\.*\)
+#### ->
+## \1 \2-)
+
+++ /dev/null
-
-# to nwe chord syntax.
-import re
-import string
-import sys
-import getopt
-import os
-
-
-def sub_chord (m):
- str = m.group(1)
-
- origstr = '<%s>' % str
- if re.search (r'\\\\', str):
- return origstr
-
- if re.search (r'\\property', str):
- return origstr
-
- if re.match (r'^\s*\)?\s*\\[a-zA-Z]+', str):
- return origstr
-
- durs = []
- def sub_durs (m):
- durs.append(m.group(2))
- return m.group (1)
-
- str = re.sub ("([a-z]+[,'!? ]*)([0-9.]+)", sub_durs, str)
- dur_str = ''
-
- for d in durs:
- if dur_str == '':
- dur_str = d
- if dur_str <> d:
- return '<%s>' % m.group (1)
-
- pslur_strs = ['']
- dyns = ['']
- slur_strs = ['']
-
- last_str = ''
- while last_str <> str:
- last_str = str
- def sub_dyn_end (m):
- dyns.append (' -\!')
- return ' ' + m.group(2)
-
- str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str)
- def sub_slurs(m):
- if '-)' not in slur_strs:
- slur_strs.append ( '-)')
- return m.group(1)
- def sub_p_slurs(m):
- if '-\)' not in slur_strs:
- slur_strs.append ( '-\)')
- return m.group(1)
- str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
- str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
- def sub_begin_slurs(m):
- if '-(' not in slur_strs:
- slur_strs.append ( '-(')
- return m.group(1)
- str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(", sub_begin_slurs, str)
- def sub_begin_p_slurs(m):
- if '-\(' not in slur_strs:
- slur_strs.append ( '-\(')
- return m.group(1)
-
- str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(", sub_begin_p_slurs, str)
-
- def sub_dyns (m):
- s = m.group(0)
- if s == '@STARTCRESC@':
- slur_strs.append ("-\\<")
- elif s == '@STARTDECRESC@':
- slur_strs.append ("-\\>")
- elif s == r'-?\\!':
- slur_strs.append ('-\\!')
- return ''
-
- str = re.sub (r'@STARTCRESC@', sub_dyns, str)
- str = re.sub (r'-?\\!', sub_dyns, str)
-
- def sub_articulations (m):
- a = m.group(1)
- if a not in slur_strs:
- slur_strs.append (a)
- return ''
-
- str = re.sub (r"([_^-]\@ACCENT\@)", sub_articulations, str)
- str = re.sub (r"([_^-]\\[a-z]+)", sub_articulations, str)
- str = re.sub (r"([_^-][>_.+|^-])", sub_articulations, str)
-
- def sub_pslurs(m):
- slur_strs.append ( ' -\\)')
- return m.group(1)
- str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str)
-
- suffix = string.join (slur_strs, '') + string.join (pslur_strs, '') \
- + string.join (dyns, '')
-
- return '@STARTCHORD@%s@ENDCHORD@%s%s' % (str , dur_str, suffix)
-
-
-
-
-simend = '}'
-simstart = "\n\\simultaneous {"
-chordstart = '<'
-chordend = '>'
-
-old_syntax = 1
-
-if old_syntax:
- simend = '>'
- simstart = "<"
- chordstart = '<<'
- chordend = '>>'
-
-
-marker_str = '%% new-chords-done %%'
-
-def sub_chords (str):
- if re.search (marker_str,str):
- return str
-
- str= re.sub (r'\\<', '@STARTCRESC@', str)
- str= re.sub (r'\\>', '@STARTDECRESC@', str)
- str= re.sub (r'([_^-])>', r'\1@ACCENT@', str)
- str = re.sub ('<([^<>{}]+)>', sub_chord, str)
-
- str = re.sub ('<([^?])', r'%s\1' % simstart, str)
- str = re.sub ('>([^?])', r'%s\1' % simend, str)
- str = re.sub ('@STARTCRESC@', r'\\<', str)
- str = re.sub ('@STARTDECRESC@', r'\\>' ,str)
- str = re.sub (r'\\context *Voice *@STARTCHORD@', '@STARTCHORD@', str)
- str = re.sub ('@STARTCHORD@', chordstart, str)
- str = re.sub ('@ENDCHORD@', chordend, str)
- str = re.sub (r'@ACCENT@', '>', str)
- return str
-
-(opts, files)= getopt.getopt( sys.argv[1:], 'e',['edit'])
-edit = 0
-for (o,a) in opts:
- if o == '-e' or o == '--edit':
- edit = 1
-
-for a in files:
- str = open (a).read()
- if re.search (marker_str, str):
- continue
-
- sys.stderr.write ("processing %s\n" %a)
-
- str = sub_chords (str) + marker_str + '\n'
-
- if edit:
- open (a + '.NEW', 'w').write (str)
- os.rename (a, a + '~')
- os.rename (a + '.NEW', a)
- else:
- print str
-
-
-##
-## regexes for postfix slur & beam:
-##
-#PYTHON
-## ([^-])\[ *([a-z]+[!?]?[,']*[0-9:]+\.*) -> " \1 \2-["
-## ([^-])\( *([a-z]+[!?]?[,']*[0-9:]+\.*) -> "\1 \2-("
-##
-#EMACS
-## \([^-]\)\[ *\([a-z]+[!?]?[,']*[0-9:]*\.*\)
-#### ->
-## \1 \2-[
-##
-## \([^-]\)) *\([a-z]+[!?]?[,']*[0-9:]*\.*\)
-#### ->
-## \1 \2-)
-
TAR = @TAR@
YACC = @YACC@
ZIP = @ZIP@
+
+PAPERSIZE=a4
LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
LILYPOND_BOOK_FLAGS=--extra-options '-e "(ly:set-option (quote internal-type-checking) \#t)"'
+
include $(depth)/make/stepmake.make
TITLE=LilyPond Regression Tests
%{_bindir}/musedata2ly
%{_bindir}/pmx2ly
-
+%doc buildscripts/out/convert-new-chords
%if %{info}
%{_infodir}/*
pstops '2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)' $<.tmp $@
$(outdir)/%.pdf: $(outdir)/%.dvi
- dvips -u +lilypond.map -o $@.pdfps -Ppdf $<
- ps2pdf $@.pdfps $@
+ dvips -u +lilypond.map -o $@.pdfps -t $(DVIPS_PAPERSIZE) -Ppdf $<
+ ps2pdf -sPAPERSIZE=$(DVIPS_PAPERSIZE) $@.pdfps $@
$(outdir)/%.html.omf: %.tely
$(outdir)/%.pdf: $(outdir)/%.dvi
- dvips -u +lilypond.map -o $@.pdfps -Ppdf $<
- ps2pdf $@.pdfps $@
+ dvips -u +lilypond.map -t $(DVIPS_PAPERSIZE) -o $@.pdfps -Ppdf $<
+ ps2pdf -sPAPERSIZE=$(DVIPS_PAPERSIZE) $@.pdfps $@
$(outdir)-$(PAPERSIZE)/%.dvi: %.ly
$(PYTHON) $(LY2DVI) --output=$@ --dependencies --set=papersize=$(PAPERSIZE) $<
export TEXPICTS:=$(outdir)$(PATHSEP)$(TEXPICTS)
-# better not define DVIPS_PAPERSIZE here,
-# since it must be synched with the texinfo setting.
+DVIPS_PAPERSIZE=$(PAPERSIZE)
# we want footers even if website builds (or is built) partly
$(footify) $@
-
$(outdir)/%.html.omf: %.texi
$(call GENERATE_OMF,html)
$(deep-footify) $(sort $(wildcard $(outdir)/$(*F)/*.html))
$(outdir)/%.dvi: $(outdir)/%.texi
- cd $(outdir); texi2dvi --batch -t $(TEXINFO_PAPERSIZE) $(<F)
+ cd $(outdir); texi2dvi --batch $(TEXINFO_PAPERSIZE_OPTION) $(<F)
$(outdir)/%.txt: $(outdir)/%.texi
$(MAKEINFO) -I $(pwd) -I $(outdir) --no-split --no-headers --output $@ $<
GENERATE_OMF = $(PYTHON) $(depth)/buildscripts/texi2omf.py --format $(1) --location $(local_package_docdir)/$(current-relative-dir)/out-www/$(notdir $(basename $@)) --version $(TOPLEVEL_VERSION) $< > $@
+TEXINFO_PAPERSIZE_OPTION= $(if $(findstring $(PAPERSIZE),a4),,-t @afourpaper)