produce ties from the engraver itself, do not broadcast TieEvent.
* lily/my-lily-lexer.cc: remove pitch & duration.
* lily/parser.yy (TODO): remove \pitch and \duration
* input/test/explicit.ly: remove file.
* Documentation/user/refman.itely (Pitches): remove \pitch
\duration command.
+2003-09-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * Documentation/user/*.itely: fixes everywhere
+
+ * lily/completion-note-heads-engraver.cc: rewrite engraver:
+ produce ties from the engraver itself, do not broadcast TieEvent.
+
+ * lily/my-lily-lexer.cc: remove pitch & duration.
+
+ * lily/parser.yy (TODO): remove \pitch and \duration
+
+ * input/test/explicit.ly: remove file.
+
+ * Documentation/user/refman.itely (Pitches): remove \pitch
+ \duration command.
+
2003-09-16 Heikki Junes <hjunes@cc.hut.fi>
* buildscripts/lilypond.words.py: add all slur types to Emacs
@chapter Introduction
There are a lot of programs that let you print sheet music with a
-computer. Unfortunately, most of them do not do good job. Most
-computer printouts have a bland, mechanical look, and are unpleasant
-to play from. If you agree with us on that, then you will like
-LilyPond: we have tried to capture the original look of hand-engraved
-music in a program: we have tuned our algorithms, font-designs, and
-program settings to make the output match that of the old editions
-that we love to see and love to play from.
+computer, but most of them do not do good job. Most computer
+printouts have a bland, mechanical look, and are unpleasant to play
+from. If you agree with us on that, then you will like LilyPond: we
+have tried to capture the original look of hand-engraved music. We
+have tuned our algorithms, font-designs, and program settings to make
+the program produce prints that match the quality of the old editions
+we love to see and love to play from.
@menu
-* Music notation and engraving::
-* Notation and engraving in LilyPond::
+* Notation in LilyPond ::
+* Engraving in LilyPond::
* Typography and program architecture::
* Music representation::
* Example applications::
* About this manual::
@end menu
-@node Music notation and engraving
-@section Music notation and engraving
+@node Notation in LilyPond
+@section Notation in LilyPond
@cindex engraving
@cindex typography
-@c eerste zin beetje deur in huis
-Making sheet music may seem trivial, ``you print 5 lines, and then put
-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 for what. Second, one has to master music
-engraving: the art of placing symbols such that the result looks
-pleasing.
+Printing sheet music consists of two non-trivial tasks. First, one has
+to master music notation: the science of knowing which symbols to use
+for what. Second, one has to master music engraving: the art of
+placing symbols such that the result looks pleasing.
+
+Common music notation is a system of recording music that has evolved
+over the past 1000 years. The form that is now in common use, dates
+from the early renaissance. Although, the basic form (note heads on a
+5-line staff) has not changed, the details still change to express the
+innovations of contemporary notation. Hence, it encompasses some 500
+years of music. Its applications range from monophonic melodies to
+monstruous counterpoint for large orchestras.
+
+How can we get a grip on such a many-headed beast, and force it into
+the confines of a computer program? Our solution is to make a strict
+distinction between notation, @emph{what} symbols to use, and
+engraving, @emph{where} to put them. Anything related to the second
+question is considered ``engraving'' (i.e. typography).
+
+For tackling the first problem, notation, we have broken up the
+problem into digestible (and programmable) chunks: every type of
+symbol is handled by a separate program module, a so-called plug-in.
+Each plug-in are completely modular and independent, so each can be
+developed and improved separately. When put together, the plug-ins
+can solve the music notation program in cooperation. People that put
+graphics to musical ideas are called copyists or engravers, so by
+analogy, each plug-in is also @code{engraver}.
+
+In the following example, we see how we start out with a note head
+engraver.
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+
+\score { \topVoice
+\paper {
+ \translator { \VoiceContext
+ \remove "Stem_engraver"
+ \remove "Phrasing_slur_engraver"
+ \remove "Slur_engraver"
+ \remove "Script_engraver"
+ \remove "Beam_engraver"
+ \remove "Auto_beam_engraver"
+
+ }
+ \translator { \StaffContext
+ \remove "Accidental_engraver"
+ \remove "Key_engraver"
+ \remove "Clef_engraver"
+ \remove "Bar_engraver"
+ \remove "Time_signature_engraver"
+ \remove "Staff_symbol_engraver"
+ \consists "Pitch_squash_engraver"
+ }
+
+}
+}
+@end lilypond
+
+Then a @code{Staff_symbol_engraver} adds the staff:
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+
+\score { \topVoice
+\paper {
+ \translator { \VoiceContext
+ \remove "Stem_engraver"
+ \remove "Phrasing_slur_engraver"
+ \remove "Slur_engraver"
+ \remove "Script_engraver"
+ \remove "Beam_engraver"
+ \remove "Auto_beam_engraver"
+
+ }
+ \translator { \StaffContext
+ \remove "Accidental_engraver"
+ \remove "Key_engraver"
+ \remove "Clef_engraver"
+ \remove "Bar_engraver"
+ \consists "Pitch_squash_engraver"
+ \remove "Time_signature_engraver"
+ }
+
+}
+}
+@end lilypond
+
+ The @code{Clef_engraver} defines a reference point for the staff:
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+
+\score { \topVoice
+\paper {
+ \translator { \VoiceContext
+ \remove "Stem_engraver"
+ \remove "Phrasing_slur_engraver"
+ \remove "Slur_engraver"
+ \remove "Script_engraver"
+ \remove "Beam_engraver"
+ \remove "Auto_beam_engraver"
+ }
+ \translator { \StaffContext
+ \remove "Accidental_engraver"
+ \remove "Key_engraver"
+ \remove "Bar_engraver"
+ \remove "Time_signature_engraver"
+ }
+
+}
+}
+@end lilypond
+
+And the @code{Stem_engraver} adds stems:
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+
+\score { \topVoice
+\paper {
+ \translator { \VoiceContext
+ \remove "Phrasing_slur_engraver"
+ \remove "Slur_engraver"
+ \remove "Script_engraver"
+ \remove "Beam_engraver"
+ \remove "Auto_beam_engraver"
+ }
+ \translator { \StaffContext
+ \remove "Accidental_engraver"
+ \remove "Key_engraver"
+ \remove "Bar_engraver"
+ \remove "Time_signature_engraver"
+ }
+}
+}
+@end lilypond
+
+The @code{Stem_engraver} is notified of any note head coming along.
+Every time one (or more, for a chord) note heads is seen, a stem
+object is created, and attached to the note head.
+By adding engravers for beams, slurs, accents, accidentals, bar lines,
+time signature, and key signature, we get a complete piece of
+notation.
-@lilypondfile[notexidoc]{puer-fragment.ly}
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+
+\score { \topVoice }
+@end lilypond
+
+
+
+This system works well for monophonic music, but what about
+polyphony? In polyphonic notation, many voices can share a staff.
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+\score { \context Staff << \topVoice \\ \botVoice >> }
+@end lilypond
-@center A fragment of neume notation
+In this situation, the accidentals and staff are shared, but the
+stems, slurs, beams, etc. are private to each voice. Hence, engravers
+should be grouped. The engravers for note head, stems, slurs, etc. go
+into a group called ``Voice context,'' while the engravers for key,
+accidental, bar, etc. go into a group called ``Staff context.'' In the
+case of polyphony, a single Staff context contains more than one Voice
+context. In polyphonic notation, many voices can share a staff:
+Similarly, more Staff contexts can be put into a single Score context.
+
+@lilypond[notexidoc]
+\include "engraver-example.ly"
+\score {
+<< \new Staff << \topVoice \\ \botVoice >>
+\new Staff << \pah \\ \hoom >>
+ >>
+}
+@end lilypond
-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
-neumes, to indicate a reference pitch, which later became the staff.
-Over many centuries, improvements and extensions were added, while
-other concepts disappeared. For example, the neume notation did not
-have an explicit notion of rhythm, but it did have @emph{custodes},
-symbols at the end of the line to indicate the starting pitch of the
-next line. Mensural notation, a notation where each note head takes a
-fixed amount of time, came into being together with the rise of
-counterpoint in the early renaissance. The graphic language of
-notation is still under development; the innovations of contemporary
-music require still newer and more complex notations.
+@node Engraving in LilyPond
+@section Engraving in LilyPond
The term music engraving derives from the traditional process of music
advanced software, music requires lots of manual fine tuning before it
is acceptable for publication.
+
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
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 show 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
Until that time, users must have a way to deal with imperfections:
these 25%, 10% or 5% of the cases that are not handled
automatically. In these cases, a user must be able to override
-formatting decisions. A way to accomplish this, is to store decisions
-in generic variables, and let the user manipulate these variables.
-For example, consider the following fragment of notation:
+formatting decisions. To accomplish this we store decisions in generic
+variables, and let the user manipulate thosed. For example, consider
+the following fragment of notation:
@lilypond
\score { \notes \relative c'' {
\stemUp
- a4^\f f'8
+ a4_\f f,8
}
\paper { raggedright = ##t }
}
\score { \notes \relative c'' {
\stemUp
\once\property Voice. DynamicLineSpanner \override #'padding = #4.0
- a4^\f f'8
+ a4_\f f,8
}
\paper { raggedright = ##t }
}
\property Score.Stem \override #'thickness = #2.0
\once\property Voice. DynamicLineSpanner \override #'padding = #4.0
\stemUp
- a4^\f f8
+ a4_\f f,8
}
\paper { raggedright = ##t }
}
There are also more practical concerns. Our users have to key in the
music into the file directly, so the input format should have a
friendly syntax: a quarter note C is entered as @code{c4}, the code
-@code{r8.} signifies a dotted eighth rest. Notes and rests form the
-simplest musical expressions in the input syntax. More complex
-constructs are produced by combining them into compound
-structures. This is done in much the same way that complex
+@code{r8.} signifies a dotted eighth rest.
+
+Notes and rests form the simplest musical expressions in the input
+syntax. More complex constructs are produced by combining them into
+compound structures. This is done in much the same way that complex
mathematical formulas are built from simple expressions such as
numbers and operators.
grammar. The grammar formally specificies what types of input form
valid `sentences'. Reading such languages, and splitting them into
grammatical structures is a problem with standard solutions.
-Moreover, they make the format easier to understand: a concise
-formal definition permits a simple informal description.
+Moreover, rigid definitions make the format easier to understand: a
+concise formal definition permits a simple informal description.
The user-interface of LilyPond is its syntax. That part is what users
see most. As a results, some users think that music representation is
@ifhtml The
@end ifhtml
@emph{@ref{Tutorial}}
-gives a gentle introduction into typesetting music.
+gives a gentle introduction to typesetting music.
First time users should start here.
@item
@ifhtml
@end ifhtml
@emph{@ref{Notation manual}}
discusses topics grouped by notation construct. Once you master the
-basics, this is the place to lookup details.
+basics, this is the place to look up details.
@item
@ifhtml
The
@end ifhtml
-@emph{@ref{Literature}}
-chapter lists useful reference books on notation and engraving.
+@emph{@ref{Literature list}}
+ contains a set of useful reference books, for those who wish to know
+ more on notation and engraving.
@item
@ifhtml
The
@end ifhtml
@emph{@ref{Invoking LilyPond}} explains how to run LilyPond and its helper
programs.
+
+@item
+@ifhtml
+The
+@end ifhtml
+@emph{@ref{lilypond-book manual}}
+explains the details behind creating documents with in-line music
+examples (like this manual).
+
+
+@item
+@ifhtml
+The chapter
+@end ifhtml
+@emph{@ref{Converting from other formats}}
+explains how to run the conversion programs. These programs
+are supplied with the LilyPond package, and convert a variety of music
+formats to the @code{.ly} format. In addition, this section explains
+how to upgrade input files from previous versions of LilyPond.
+
@end itemize
Once you are an experienced user, you can use the manual as reference:
@cindex using the manual
-If you are not familiar with music notation, or music terminology
+If you are not familiar with music notation or music terminology
(especially if you are a non-native English speaker), then it is
advisable to consult the glossary as well. The glossary explains
musical terms, and includes translations to various languages. It is a
(available @uref{../../../input/template/out-www/collated-files.html,here})
@end ifhtml
-After you have gone through the tutorial, in theory you should be able
-to write input files. In practice, writing files from scratch turns
-out to be intimidating. To give you a headstart, we have collected a
-number of often-used formats in example files. These files can be
-used as a start, by copying the template, and adding notes in the
-appropriate places.
+After you have gone through the tutorial, you should be able to write
+input files. In practice, writing files from scratch turns out to be
+intimidating. To give you a headstart, we have collected a number of
+often-used formats in example files. These files can be used as a
+start: simply copy the template, and add notes in the appropriate
+places.
@item
Various input examples
@item
- The regression test
+ The regression tests
@ifhtml
(available @uref{../../../input/regression/out-www/collated-files.html,here})
@end ifhtml
The Texinfo command @code{pagesize} is not interpreted. Almost all
La@TeX{} commands that change margins and line widths are ignored.
+Only the first @code{\score} of a LilyPond block is processed.
+
The size of a music block is limited to 1.5 kb, due to technical
problems with the Python regular expression engine. For longer files,
use @code{\lilypondfile}. Using @code{\lilypondfile} also makes
this means that changes made to global GUILE definitions, e.g. done
with @code{set!} or @code{set-cdr!}, can leak from one fragment into
the next fragment.
+
* Tutorial:: A tutorial introduction.
* Notation manual:: All notation supported, and how to
produce it.
-* Literature:: Books about notation and engraving.
+* Literature list:: Books about notation and engraving.
* Technical manual:: How it all works.
* Invoking LilyPond:: Operation.
* Converting from other formats:: Converting to lilypond source format.
-@node Literature
-@chapter Literature
+@node Literature list
+@chapter Literature list
If you need to know more about music notation, here are some
interesting titles to read. The source archive includes a more
@unnumbered Preface
@menu
+* Preface to version 2.0::
* Preface to version 1.8::
* Preface to version 1.6::
@end menu
+
+@node Preface to version 2.0
+@unnumberedsec Preface to version 2.0
+
+
+Due to personal circumstances, I have been able to do a lot more on
+LilyPond during the past months. A testament to that is the quick
+release of version 2.0, less than two months after 1.8. We have taken
+the opportunity to make a few radical changes to the syntax: note
+attributes, like articulation, dynamics and fingerings are now
+post-fix exclusively. This makes entering scores easier: you never
+have to think about the order of the attributes. With version 2.0, we
+have a new and improved platform for working on notation and
+typography features for coming versions,
+
+@c
+
+Han-Wen,
+
+Utrecht/Eindhoven, The Netherlands, September 2003.
+
@node Preface to version 1.8
@unnumberedsec Preface to version 1.8
@node Notation manual
@chapter Notation manual
+This chapter describes all the different types of notation supported
+by LilyPond. It is intended as a reference for users that are already
+somewhat familiar with using LilyPond.
+
@menu
* Note entry::
* Easier music entry::
@section Note entry
@cindex Note entry
-This chapter describes all the different types of notation supported
-by LilyPond. It is intended as a reference for users that are already
-somewhat familiar with using LilyPond.
-
+The basic elements of any piece of music are the notes. This section
+is about basic notation elements notes, rests and related constructs,
+such as stems, tuplets and ties.
@menu
* Notes::
a flat is formed by adding @code{-es}. Double sharps and double flats
are obtained by adding @code{-isis} or @code{-eses}. These
names are the Dutch note names. In Dutch, @code{aes} is contracted to
-@code{as} in Dutch, but both forms are accepted. Similarly, both
+@code{as}, but both forms are accepted. Similarly, both
@code{es} and @code{ees} are accepted.
There are predefined sets of note names for various other languages.
@end lilypond
-There is also a verbose syntax for pitch specification:
-
-@c TODO: junk this?
-@cindex @code{\pitch}
-@example
- \pitch @var{scmpitch}
-@end example
-
-
-where @var{scmpitch} is a Scheme object of the @code{Pitch} type.
-
@refcommands
Notes can be hidden and unhidden with the following commands:
@seealso
@noindent
+
+bla
+
@internalsref{NoteEvent}, and @internalsref{NoteHead}.
@node Chromatic alterations
@lilypond[singleline,verbatim]
\score {
- \context Staff <<
+ \new Staff <<
{ \time 4/8 \skip 2 \time 4/4 }
\notes\relative c'' { a2 a1 }
>>
@cindex duration
-@cindex @code{\duration}
In Note, Chord, and Lyrics mode, durations are designated by numbers
a4
@end lilypond
-Durations can also be produced using the verbose syntax
-@code{\duration @var{Scheme object}}:
-@lilypond[verbatim,fragment]
- c'\duration #(ly:make-duration 4 1)
-@end lilypond
-
-
@refcommands
@node Stems
@subsection Stems
-Whenever a note is found, a
-@internalsref{Stem} object is created automatically. For whole notes
-and rests, stem objects are also created, but in those cases, the stem
-is invisible.
+Whenever a note is found, a @internalsref{Stem} object is created
+automatically. For whole notes and rests, they are also created but
+made invisible.
@refcommands
@refbugs
Tieing only a subset of the note heads of a pair of chords is not
-supported in a simple way. It can be achieved by moving the
+supported in a simple way.
+
+@ignore
+It can be achieved by moving the
tie-engraver into the @internalsref{Thread} context and turning on and
off ties per @internalsref{Thread}.
+@end ignore
-Switching staves when a tie is active, will not produce a slanted tie.
+Switching staves when a tie is active will not produce a slanted tie.
Formatting of ties is a difficult subject. The results are often not
optimal.
\times @var{fraction} @var{musicexpr}
@end example
-The duration of @var{musicexpr} will be multiplied by the fraction.
-In the sheet music, the fraction's denominator will be printed over
-the notes, optionally with a bracket. The most common tuplet is the
-triplet in which 3 notes have the length of 2, so the notes are 2/3
-of their written length:
+@noindent
+The duration of @var{musicexpr} will be multiplied by the fraction.
+The fraction's denominator will be printed over the notes, optionally
+with a bracket. The most common tuplet is the triplet in which 3
+notes have the length of 2, so the notes are 2/3 of their written
+length:
@lilypond[fragment,verbatim,center]
g'4 \times 2/3 {c'4 c' c'} d'4 d'4
@cindex Music entry
When entering music it is easy to introduce errors. This section deals
-with tricks and features of the input language that help when entering
-music, and find and correct mistakes. Some features of the input
-language ease entering music, but also have other applications. They
-are not described in this section.
+with tricks and features of the input language that were added solely
+to help entering music, and find and correct mistakes.
It is also possible to use external programs, for example GUI
interfaces, or MIDI transcription programs, to enter or edit
is denoted by a set of alterations (flats or sharps) at the start of
the staff.
-WARNING! The key signature only changes the output, not the music
-itself. An F-sharp in the key of D major is still an F-sharp, not
-an F -- you must type @code{fis}, not @code{f}. If you don't modify
-a pitch with @code{-is} or @code{-es}, LilyPond will assume that
-you want a natural note. See this example:
-
-@quotation
-@example
-\key d \major
-fis4 f fes fis
-g2 fis
-@end example
-@end quotation
-
-@lilypond[noindent]
-\score{ \notes { \relative c'{
-\key d \major
-fis4 f fes fis
-g2 fis
-}}}
-@end lilypond
-
-
@syntax
Setting or changing the key signature is done with the @code{\key}
@internalsref{Staff}.@code{keySignature}. Non-standard key signatures
can be specified by setting this property directly.
+Accidentals and key signatures often confuse new users, because
+unaltered notes get natural signs depending on the keysignature. The
+tutorial explains why this is so in @ref{More about pitches}.
+
@refbugs
The ordering of a key cancellation is wrong when it is combined with
@end lilypond
Internally the @code{set-octavation} function sets the properties
-@code{ottavation} (eg. to @code{"8va"}) and @code{centralCPosition}.
-
-@seealso
+@code{ottavation} (eg. to @code{"8va"}) and
+@code{centralCPosition}. The function also takes arguments -1 (for 8va
+bassa) and 2 (for 15ma).
@internalsref{OttavaSpanner}.
Partial measures, for example in upsteps, are entered using the
@code{\partial} command:
-@lilypond[fragment,verbatim]
-\partial 16*5 c'16 c4 | a'2. ~ a'8. a'16 | g'1
+@lilypond[fragment,verbatim,relative 1]
+\partial 16*5 c16 cis d dis e | a2. c,4 | b2
@end lilypond
The syntax for this command is
@end lilypond
The default chord name layout is a system for Jazz music, proposed by
-Klaus Ignatzek (see @ref{Literature}). It can be tuned through the
+Klaus Ignatzek (see @ref{Literature list}). It can be tuned through the
following properties:
@table @code
In the 20th century, composers have greatly expanded the musical
vocabulary. With this expansion, many innovations in musical notation
have been tried. For a comprehensive overview, refer to @cite{Stone
-1980} (see @ref{Literature}). In general, the use of new, innovative
+1980} (see @ref{Literature list}). In general, the use of new, innovative
notation makes a piece harder to understand and perform and its use
should therefore be avoided if possible. For this reason, support for
contemporary notation in LilyPond is limited.
-c -*-texinfo-*-
+@c -*-texinfo-*-
@c TODO:
@c * more details about running lilypond; error messages,
Using LilyPond comes down to encoding music in an input file. After
entering the music, the program is run on the file producing output
which can be viewed or printed. In this tutorial, we will show step
-by step how to enter such files, by showing fragments of input and the
-corresponding output. At the end of every section, a paragraph will
-list where to find further information on the topics discussed.
+by step how to enter such files, and illustrate the process with
+fragments of input and the corresponding output. At the end of every
+section, a paragraph will list where to find further information on
+the topics discussed.
Many people learn programs by trying and fiddling around with the
program. This is also possible with LilyPond. If you click on a
@menu
* First steps::
* Running LilyPond::
-* More about pitches and accidentals::
+* More about pitches ::
* Octave entry::
* Combining music into compound expressions::
* Adding articulation marks to notes::
Now the piece of music is almost ready to be printed. The final step is to
combine the music with a printing command.
-The printing command is the so-called @code{\paper} block. The
-@code{\paper} block is used to customize printing specifics, but we
-accept the defaults for now. The music and the @code{\paper} block
-are combined by enclosing them in @code{\score @{ ... @}}. The
-following is a complete and valid input file.
+The printing command is the so-called @code{\paper} block:
+
+@example
+\paper @{ @}
+@end example
+
+The @code{\paper} block is used to customize printing specifics. The
+customization commands go between @code{@{} and @code{@}}, but for
+now, we accept the defaults. The music and the @code{\paper} block
+are combined by enclosing them in @code{\score @{ ... @}}, so the
+following is a complete and valid input file:
@example
\score @{
}
@end lilypond
-During the rest of the tutorial, we will often leave out @code{\score}
-and @code{\paper}, for clarity. However, both must be present when
+In the rest of the tutorial we will often leave out @code{\score}
+and @code{\paper} for clarity. However, both must be present when
feeding the file to LilyPond.
-More elaborate information on entering pitches and durations is in
-@ref{Pitches} and @ref{Durations}. Clefs are fully explained in
-@ref{Clef}. Time signatures and other timing commands are described
-in @ref{Time signature}.
+For more elaborate information on
+@table @asis
+@item entering pitches and durations
+see
+@ref{Pitches} and @ref{Durations}.
+@item Clefs
+see @ref{Clef}
+@item Time signatures and other timing commands
+see @ref{Time signature}.
+@end table
@node Running LilyPond
@section Running LilyPond
@cindex xdvi
The result is the file @file{test.pdf}.@footnote{For @TeX{}
-afficionados, there is also a @file{test.dvi} file. It can be viewed
+afficionados: there is also a @file{test.dvi} file. It can be viewed
with @code{xdvi}. The DVI uses a lot of PostScript specials, which do
not show up in the magnifying glass. The specials also mean that the
DVI file cannot be processed with @code{dvilj}. Use @code{dvips} for
gsview32 test.pdf
@end example
@end quotation
+
+@noindent
If the music on your screen looks good, you can print it by clicking
File/Print inside your viewing program.
@file{C:\Cygwin\home\@var{your-name}} in the explorer and double-click
@file{test.pdf}.
@item
-If you prefer the keyboard, you can also try the list of commands
-shown before. If none work, go to
+If you prefer the keyboard, you can try to enter one of the commands
+from the list shown before in the terminal. If none work, go to
@uref{http://www.cs.wisc.edu/~ghost/} to install the proper software.
@end itemize
The commands for formatting and printing music on all platforms are
detailed in @ref{Invoking LilyPond}.
-@node More about pitches and accidentals
-@section More about pitches and accidentals
+@node More about pitches
+@section More about pitches
-A @rglos{sharp} (@texisharp{}) is made by adding @samp{is}, a
-@rglos{flat} (@texiflat{}) by adding @samp{es}. As you might expect,
-a @rglos{double sharp} or @rglos{double flat} is made by adding
-@samp{isis} or @samp{eses}:@footnote{This syntax derived from note
-naming conventions in Nordic and Germanic languages, like German and
-Dutch.}
+A @rglos{sharp} (@texisharp{}) pitch is made by adding @samp{is} to
+the name, a @rglos{flat} (@texiflat{}) pitch by adding @samp{es}. As
+you might expect, a @rglos{double sharp} or @rglos{double flat} is
+made by adding @samp{isis} or @samp{eses}:@footnote{This syntax
+derived from note naming conventions in Nordic and Germanic languages,
+like German and Dutch.}
@example
cis1 ees fisis aeses
@end lilypond
@end quotation
-WARNING! The key signature only affects the way the output is printed,
-not the music itself. If you type
-@example
-@code{
+Key signatures together with the pitch (including alterations) are
+used together to determine when to print accidentals. This is a
+feature that often causes confusion to newcomers, so let us explain it
+in more detail:
+
+
+LilyPond has a sharp distinction between musical content and
+layout. The alteration (flat, natural or sharp) of a note is part of
+the pitch, and is therefore musical content. Whether an accidental (a
+flat, natural or sharp @emph{sign}) is a printed in front of the
+corresponding note is a question of layout. Layout is something that
+follows rules, so accidentals are printed automatically according to
+those rules. The pitches in your music are works of art, so they will
+not be added automatically, and you must enter what you want to hear.
+
+For example, in this example:
+@lilypond[fragment]
+\property Staff.TimeSignature = #'()
\key d \major
-d e f g
-}
-@end example
+d' cis' fis'
+@end lilypond
-LilyPond will print an F-natural. An F-sharp in the key of D major
-is still an F-sharp! To print an F-sharp, you must use @code{fis},
-no matter what the key signature is. See this example:
+@noindent
+no note gets an explicit accidental, but still you enter
-@quotation
@example
\key d \major
-fis4 f fes fis |
-g2 fis
+d cis fis
@end example
-@end quotation
-@lilypond[noindent]
-\score{ \notes { \relative c'{
-\key d \major
-fis4 f fes fis
-g2 fis
-}}}
+The code @code{d} does not mean ``print a black dot just below the
+staff.'' Rather, it means: ``a note with pitch D-natural.'' In the key
+of A-flat, it gets an accidental:
+
+@lilypond[fragment]
+\property Staff.TimeSignature = #'()
+\key as \major
+d'
@end lilypond
-@separate
+
+@noindent
+@example
+\key as \major
+d
+@end example
+
+Adding all alterations explicitly might require some more effort when
+typing, but the advantage is that transposing is easier, and music can
+be printed according to different conventions. See @ref{Accidentals}
+for some examples how accidentals can be printed according to
+different rules.
+
@cindex tie
A tie is created by adding a tilde ``@code{~}'' to the first note
being tied:
@quotation
@lilypond[fragment,verbatim,relative 2]
-g4-~ g a2-~ a4
+g4~ g a2~ a4
@end lilypond
@end quotation
@separate
\key g \minor
\clef violin
r4 r8 a8 gis4 b
- g8 d4.-~ d e'8
- fis4 fis8 fis8 eis4 a8 gis-~
+ g8 d4.~ d e'8
+ fis4 fis8 fis8 eis4 a8 gis~
gis2 r2
@}
\paper @{ @}
\key g \minor
\clef violin
r4 r8 a8 gis4 b
- g8 d4.-~ d e8
- fis4 fis8 fis8 eis4 a8 gis-~
+ g8 d4.~ d e8
+ fis4 fis8 fis8 eis4 a8 gis~
gis2 r2
}}
\paper { linewidth = #(* 50 staffspace) }
relevant: in the printout, these are ordered according to standard
notation conventions.
-Accidentals (sharps and flats) do not have to be marked explicitly:
-you just enter the pitch of the note, and an accidental is printed
-only when necessary. The flip side of this mechanism, is that you have
-to mark notes as sharp or flat, even when they do not get accidentals.
-For example, in this example:
-@lilypond[fragment]
-\clef bass
-\property Staff.TimeSignature = #'()
-\key cis \major
-cis dis eis fis gis ais bis
-@end lilypond
-no note gets an explicit accidental, but still you enter
-@example
-\clef bass
-\key cis \major
-cis dis eis fis gis ais bis
-@end example
-
-Adding all alterations explicitly might require some more effort when
-typing, but the advantage is that transposing is easier. It also makes
-it possible to use different conventions for when to print
-accidentals.
@cindex beams, by hand
Beams are drawn automatically, but if you do not like where they are
@end quotation
@separate
-Rests are described in full detail in @ref{Rests}.
+For more information on
+@table @asis
+@item Rests
+see @ref{Rests}.
+
+@item Ties
+see @ref{Ties}.
+
+@item Accidentals
+see @ref{Accidentals}
-The notation manual discusses ties in @ref{Ties}.
+@item Key signature
+see @ref{Key signature}
+
+@item Beams
+see @ref{Beaming}
+@end table
@node Octave entry
@separate
-Since most music has small intervals, in relative mode pieces can be
-written almost without using octavation quotes. In relative mode, the
-Mozart example is entered as
+Since most music has small intervals, pieces can be written almost
+without octavation quotes in relative mode. The previous example is
+entered as
@c
@lilypond[singleline,fragment,verbatim]
\relative c'' {
@c added another example below.
@c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
@c in eerste instantie drong het `relative' niet door zonder extra uitleg.
-Larger intervals are made by adding octavation quotes. Quotes or
-commas do not determine the absolute height of a note; the height of a
-note is relative to the previous one.
-@c do not use commas or quotes in this sentence
-For example: @code{c f,} goes down; @code{f, f} are both the same;
-@code{c' c} are the same; and @code{c g'} goes up:
-
+Larger intervals are made by adding octavation quotes.
@quotation
@example
\relative c'' @{
@end quotation
@separate
+Quotes or commas do not determine the absolute height of a note; the
+height of a note is relative to the previous one.
+@c do not use commas or quotes in this sentence
+For example: @code{c f,} goes down; @code{f, f} are both the same;
+@code{c' c} are the same; and @code{c g'} goes up:
+
+
Here is an example of the difference between relative mode and
``normal'' (non-relative) mode:
@separate
-
+For more information on Relative octaves see @ref{Relative octaves}
+and @ref{Octave check}.
vertically. The notation @code{<< .. >>} can also be used as a
shorthand for @code{\simultaneous @{ .. @}}.
-@code{\context} introduces a ``notation context''. To understand this
-concept, imagine that you are performing a piece of music. When you
-perform the music, you combine the symbols printed at a certain point
-with contextual information. For example, without knowing the current
-clef, and the accidentals in the last measure, it would be impossible
-to determine the pitch of a note. In other words, this information
-forms context that helps you decipher a score. LilyPond produces
-notation from music, so in effect, it does the inverse of reading
-scores. Therefore, it also needs to keep track of contextual
-information. This information is maintained in ``notation contexts.''
-There are several types of contexts, e.g. @code{Staff}, @code{Voice}
-and @code{Score}, but also @code{Lyrics} and
-@code{ChordNames}. Prepending @code{\context} to a chunk of music
-indicates what kind of context to use for interpreting it.
-
-By specifying different names (in this case @code{staffA} and
-@code{staffB}), two different contexts are created, leading to two
-staves. It does not matter which names they are given, as long as they
-are different. If they get the same name, the chunks of music are
-assumed to belong on the same staff, and will be printed like that.
+The command @code{\new} introduces a ``notation context''. To
+understand this concept, imagine that you are performing a piece of
+music. When you are playing, you combine the symbols printed at a
+certain point with contextual information. For example, without
+knowing the current clef, and the accidentals in the last measure, it
+would be impossible to determine the pitch of a note. In other words,
+this information forms context that helps you decipher a
+score. LilyPond produces notation from music, so in effect, it does
+the inverse of reading scores. Therefore, it also needs to keep track
+of contextual information. This information is maintained in
+``notation contexts.'' There are several types of contexts,
+e.g. @code{Staff}, @code{Voice} and @code{Score}, but also
+@code{Lyrics} and @code{ChordNames}. Prepending @code{\new} to a chunk
+of music indicates what kind of context to use for interpreting it,
+and ensures that the argument is interpreted with a fresh instance of
+the context indicated.
+
@separate
The example shows how small chunks of music, for example, the notes
@code{c2}, @code{e4}, etc. of the second staff, are combined to form a
larger chunk by enclosing it in braces. Again, a larger chunk is
-formed by prefix @code{\context Staff} to it, and that chunk is
-combined with @code{<< >>}. This mechanism is similar with mathematical
-formulas: in a formula, a so-called expression is formed by combining
-simpler expressions into larger expressions. For example,
+formed by prefix @code{\new Staff} to it, and that chunk is combined
+with @code{<< >>}. This mechanism is similar with mathematical
+formulas: a big formula is created by composing small formulas. Such
+formulas are called expressions, and their definition is recursive, so
+you can make arbitrarily complex and large expressions. For example,
@quotation
1
@end quotation
@cindex expression
@cindex music expression
-is a sequence of expressions, where each expression is contained in
-the next one. The simplest expressions are numbers and operators
-(like +, * and /). Parentheses are used to group expressions. In
-LilyPond input, a similar mechanism is used. Here, the simplest
-expressions are notes and rests. By enclosing expressions in @code{<<
->>} and @code{@{ @}}, more complex music is formed. The @code{\context}
-also forms new expressions; prepending it to a music expression yields
-a new expression.
+This example shows a sequence of expressions, where each expression is
+contained in the next one. The simplest expressions are numbers and
+operators (like +, * and /). Parentheses are used to group
+expressions. In LilyPond input, a similar mechanism is used. Here,
+the simplest expressions are notes and rests. By enclosing
+expressions in @code{<< >>} and @code{@{ @}}, more complex music is
+formed. The @code{\new} command also forms new expressions; prepending
+it to a music expression yields a new expression.
Like mathematical expressions, music expressions can be nested
arbitrarily deep, e.g.
@end example
+For more information on context see the Technical manual description
+in @ref{Interpretation context}.
+
@node Adding articulation marks to notes
is attached to:
@quotation
@lilypond[verbatim,relative 1]
-c2\< c2\!\ff c2\> c2\!
+c2\< c2\!\ff\> c2 c2\!
@end lilypond
@end quotation
@separate
@end quotation
@separate
@cindex slurs versus ties
-A slur is different from a tie. A tie simply makes the first note
-sound longer, and can only be used on pairs of notes with the same
-pitch. Slurs indicate the articulations of notes, and can be used on
-larger groups of notes. Slurs and ties are also nested in practice:
+A slur looks like a tie, but it has a different meaning. A tie simply
+makes the first note sound longer, and can only be used on pairs of
+notes with the same pitch. Slurs indicate the articulations of notes,
+and can be used on larger groups of notes. Slurs and ties are also
+nested in practice:
+@c
@lilypond[fragment, relative=1]
-c2-~( c8 fis fis4 ~ fis2 g2)
+c2~( c8 fis fis4 ~ fis2 g2)
@end lilypond
@cindex phrasing slurs
@end quotation
-More information on fingering, articulation, slurs, phrasing slurs,
-and dynamics can be found in @ref{Fingering instructions},
-@ref{Articulations}, @ref{Slurs}, @ref{Phrasing slurs}, and @ref{Dynamics},
-respectively.
+For more information on
+@table @asis
+@item fingering
+ see @ref{Fingering instructions}
+@item articulations
+ see @ref{Articulations}
+@item slurs
+ see @ref{Slurs}
+@item phrasing slurs
+ see @ref{Phrasing slurs}
+@item dynamics
+ see @ref{Dynamics}
+@item fingering
+@end table
@node Combining notes into chords
@section Combining notes into chords
must be placed outside the chord markers:
@quotation
@lilypond[relative 0, fragment,verbatim]
-r4 <c e g>8[ <c f a>]-~ <c f a>
+r4 <c e g>8[ <c f a>]~ <c f a>
@end lilypond
@end quotation
@cindex grace notes
@cindex accacciatura
Grace notes are also made by prefixing a note, or a set of notes with
-a keyword. In this case, the keyword is @code{\grace}:
+a keyword. In this case, the keywords are @code{\appoggiatura}
+and @code{\acciaccatura}
+@cindex appoggiatura
+@cindex acciaccatura
+
@lilypond[relative 1, verbatim,fragment]
- c4 \grace b16( c4)
- \grace { d16( e } d4)
+ c4 \appoggiatura b16 c4
+ c4 \acciaccatura b16 c4
@end lilypond
@noindent
-More information on grace notes, tuplets and upsteps are in @ref{Grace
-notes}, @ref{Tuplets} and @ref{Partial measures}.
+
+For more information on
+@table @asis
+@item grace notes
+see @ref{Grace notes},
+@item tuplets
+see @ref{Tuplets},
+@item upsteps
+see @ref{Partial measures}.
+@end table
Like notes, lyrics are also a form of music, but they must not be
printed on a staff, which is the default way to print music. To print
-them as lyrics, they must be marked with @code{ \context Lyrics}:
+them as lyrics, they must be marked with @code{ \new Lyrics}:
@example
- \context Lyrics \lyrics @{ I want to break free @}
+ \new Lyrics \lyrics @{ I want to break free @}
@end example
The melody for this song is as follows:
@example
\addlyrics
\notes @{ @dots{} @}
- \context Lyrics @dots{}
+ \new Lyrics @dots{}
@end example
The final result is
c8
\times 2/3 { f g g } \times 2/3 { g4( a2) }
}
- \context Lyrics \lyrics { I want to break free }
+ \new Lyrics \lyrics { I want to break free }
}
\paper{ }
}
@cindex extender line
@c synonyms?
This melody ends on a @rglos{melisma}, a single syllable (``free'')
-sung to more than one note. This is indicated with a @emph{extender
+sung to more than one note. This is indicated with an @emph{extender
line}. It is entered as two underscores, i.e.
@example
\lyrics @{ I want to break free __ @}
\hideNotes
c32
}
- \context Lyrics \lyrics { I want to break free __ }
+ \new Lyrics \lyrics { I want to break free __ }
}
\paper{ linewidth = 9.0 \cm }
}
\score {
\addlyrics \notes \relative f' { \time 2/4
f4 f c' c' }
- \context Lyrics \lyrics { Twin -- kle twin -- kle
+ \new Lyrics \lyrics { Twin -- kle twin -- kle
}
\paper { linewidth = 6.0 \cm }
}
In popular music, it is common to denote accompaniment as chord-names.
Using them in LilyPond has two parts, just like lyrics: entering the
-chords (with @code{\chords}), and printing them (with @code{\context
+chords (with @code{\chords}), and printing them (with @code{\new
ChordNames}).
Chord names are entered by starting chords mode (with @code{\chords}).
\context ChordNames \chords { c2 f4.:m g4.:maj7 gis8:dim7 }
@end lilypond
-@cindex lead sheet
+@cindex lead sheet
+@separate
When put together, chord names, lyrics and a melody form
a lead sheet, for example,
Bibliographic information is entered in a separate block, the
@code{\header} block. The name of the piece, its composer, etc. are
-entered as assignment, within @code{\header @{ @dots{} @}}. For
+entered as an assignment, within @code{\header @{ @dots{} @}}. For
example,
@example
\header @{
@cindex composer
@cindex Engraved by LilyPond
-When the file is processed by @code{lilypond}, the title and composer
-specified are printed above the music. The `tagline' is a short line
-printed at bottom of the last page, which normally says ``Engraved
-by LilyPond, version @dots{}''. In the example above, it is replaced by the
-line ``small is beautiful''.
+When the file is processed by the @code{lilypond} wrapper script, then
+the title and composer specified are printed above the music. The
+`tagline' is a short line printed at bottom of the last page, which
+normally says ``Engraved by LilyPond, version @dots{}''. In the
+example above, it is replaced by the line ``small is
+beautiful.''@footnote{Nicely printed parts are good PR for us, so do
+us a favor, and leave the tagline if you can.}
Normally, the @code{\header} is put at the top of the file. However,
-for a document that contains multiple pieces (e.g. a etude book, or
-part with multiple movements), then the header can be put into the
-@code{\score} block as follows; in this case, the name of each piece
-will be printed before each movement:
+for a document that contains multiple pieces (e.g. an etude book, or
+an orchestral part with multiple movements), then the header can be
+put into the @code{\score} block as follows; in this case, the name of
+each piece will be printed before each movement:
@cindex Lily was here
@cindex voices, more -- on a staff
When different melodic lines are combined on a single staff, these are
-printed as polyphonic voices: each voice has its own stems, slurs
-and beams, and the top voice has the stems up, while the bottom voice
-has stems down.
+printed as polyphonic voices: each voice has its own stems, slurs and
+beams, and the top voice has the stems up, while the bottom voice has
+them down.
Entering such parts is done by entering each voice as a sequence (with
@code{@{ .. @}}), and combining those simultaneously, separating the
voices with @code{\\}:
@example
- << @{ a4 g2 f4-~ f4 @} \\
+ << @{ a4 g2 f4~ f4 @} \\
@{ r4 g4 f2 f4 @} >>
@end example
@lilypond[relative 1]
-\context Staff << { a4 g2 f4-~ f4 } \\
+\context Staff << { a4 g2 f4~ f4 } \\
{ r4 g4 f2 f4 } >>
@end lilypond
are rests that do not print. It is useful for filling up voices that
temporarily do not play:
@example
- << @{ a4 g2 f4-~ f4 @} \\
+ << @{ a4 g2 f4~ f4 @} \\
@{ s4 g4 f2 f4 @} >>
@end example
@lilypond[relative 1]
-\context Staff << { a4 g2 f4-~ f4 } \\
+\context Staff << { a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 } >>
@end lilypond
<<
\new Staff
\relative c''
- << { a4 g2 f4-~ f4 } \\
+ << { a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 } >>
\new Staff
- << { \clef bass <c g>1 } \\
- { f4 d e2 }
+ << { \clef bass <c g>1 ~ <c g>4 } \\
+ { f4 d e2 ~ e4}
>>
>>
@end lilypond
but now this entire expression must be interpreted as a
@code{PianoStaff}:
@example
- \context PianoStaff << \context Staff @dots{} >>
+ \new PianoStaff << \new Staff @dots{} >>
@end example
Here is a full-fledged example:
@lilypond[relative 0,fragment]
-\context PianoStaff
+\new PianoStaff
<< \new Staff { \time 2/4
c4 c g' g }
\new Staff {
from left-to-right order, similar to what happens when we read
music. During this step, context-sensitive information, such as the
accidentals to print, and where barlines must be placed, are stored in
-variables. These variables are called @emph{translation properties}.
+variables. These variables are called @emph{context properties}.
The properties can also be manipulated from input files. Consider this input:
@example
\property Staff.autoBeaming = ##f
@end example
-It sets the property named @code{autoBeaming} in the current staff to
-@code{##f}, which means `false'. This property controls whether beams
-are printed automatically:
+
+@noindent
+It sets the property named @code{autoBeaming} in the current staff at
+this point in the music to @code{##f}, which means `false'. This
+property controls whether beams are printed automatically:
+@c
@lilypond[relative 1,fragment,verbatim]
c8 c c c
\property Staff.autoBeaming = ##f
\property Staff.timeSignatureFraction = #'(3 . 4)
@end example
+@item a list, which is also introduced by a quote character. In the
+following example, the @code{breakAlignOrder} property is set to a
+list of symbols:
+@example
+ \property Score.breakAlignOrder =
+ #'(left-edge time-signature key-signatures)
+@end example
+
@end itemize
There are many different properties, and not all of them are listed in
-this manual. However, the internal documentation lists them all in the
-@internalsref{All translation properties}, and most properties
-are demonstrated in one of the
+this manual. However, the program reference lists them all in the
+section @internalsref{Context-properties}, and most properties are
+demonstrated in one of the
@ifhtml
@uref{../../../input/test/out-www/collated-files.html,tips-and-tricks}
@end ifhtml
respectively.
The exact tuning possibilities for each type of layout object are
-documented in the internal documentation of the respective
+documented in the program reference of the respective
object. However, many layout objects share properties, which can be
used to apply generic tweaks. We mention a couple of these:
in that voice, the tie appears to cross voices:
@lilypond[fragment,relative 1,verbatim]
-\context Staff << {
+ c4 << {
\once \property Voice.Stem \set #'transparent = ##t
b8~ b8
} \\ {
example; a more elaborate explanation is in @ref{Constructing a
tweak}:
-@lilypond[relative 1]
+@lilypond[relative 1,verbatim]
c2\fermata
\property Voice.Script \set #'padding = #3
b2\fermata
When all of the elements discussed earlier are combined to produce
larger files, the @code{\score} blocks get a lot bigger, because the
music expressions are longer, and, in the case of polyphonic and/or
-orchestral pieces, more deeply nested.
+orchestral pieces, more deeply nested. Such large expressions can
+become unwieldy.
By using variables, also known as identifiers, it is possible to break
-up complex music expressions.
-An identifier is assigned as follows:
+up complex music expressions. An identifier is assigned as follows:
+@c
@example
namedMusic = \notes @{ @dots{}
@end example
The contents of the music expression @code{namedMusic}, can be used
later by preceding the name with a backslash, i.e. @code{\namedMusic}.
-In the next example, a two note motive is repeated thrice by using
+In the next example, a two note motive is repeated two times by using
variable substitution:
@lilypond[singleline,verbatim]
dis'8 e'8
}
\score { \notes {
- \seufzer \seufzer \seufzer
+ \seufzer \seufzer
} }
@end lilypond
-The name of an identifier should only have alphabetic characters only,
-and no numbers, underscores or dashes. The assignment should be
-outside of the @code{\score} block.
+The name of an identifier should have alphabetic characters only, and
+no numbers, underscores or dashes. The assignment should be outside of
+the @code{\score} block.
It is possible to use variables for many other types of objects in the
input. For example,
@} @}
\end@{lilypond@}
-Notice that the music line length matches the margin settings of the
-document.
-
If you have no \verb+\score+ block in the fragment,
\texttt@{lilypond-book@} will supply one:
}
@end lilypond
-Notice that the music line length matches the margin settings of the
-document.
-
If you have no @code{\score} block in the fragment,
@code{lilypond-book} will supply one:
-
\version "1.9.4"
\header{
\notes\relative c'{
\time 2/4
- c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
+ c2. c8 d4 e f g a b c2.. b8 a g16 f4 e d c8. c2
}
\paper{
\translator{
--- /dev/null
+#(ly:set-option 'old-relative)
+
+\version "1.9.6"
+\header {
+
+texidoc ="In polyphonic notation, many voices can share a staff: In
+this situation, the accidentals and staff are shared, but the stems,
+slurs, beams, etc. are private to each voice. Hence, engravers should
+be grouped. The engravers for note head, stems, slurs, etc. go into a
+group called ``Voice context,'' while the engravers for key,
+accidental, bar, etc. go into a group called ``Staff context.'' In the
+case of polyphony, a single Staff context contains more than one Voice
+context. Similarly, more Staff contexts can be put into a single Score
+context. "
+
+}
+
+\include "engraver-example.ly"
+
+\score {
+\context Staff << \topVoice \\ \botVoice >>
+}
+
+
+\score {
+<< \new Staff << \topVoice \\ \botVoice >>
+\new Staff << \pah \\ \hoom >>
+ >>
+}
+
+
+
--- /dev/null
+\header {
+% texidoc = "Include file for engraver example."
+}
+
+\paper { raggedright = ##t }
+
+topVoice = \notes \relative c'
+{
+ \key d\major
+ es8([ g] a[ fis])
+ b4
+ b16[-. b-. b-. cis-.]
+ d4->
+}
+
+
+
+botVoice = \notes \relative c'
+{
+ \key d\major
+ c8[( f] b[ a)]
+ es4
+ es16[-. es-. es-. fis-.]
+ b4->
+}
+
+
+hoom = \notes \relative c {
+ \key d \major
+ \clef bass
+
+ g8-. r
+ r4
+ fis8-.
+ r8
+ r4
+ b'4->
+}
+
+pah = \notes \relative c'
+{
+ r8 b-.
+ r4
+ r8 g8-.
+ r16 g-. r8
+ \clef treble
+ fis'4->
+}
--- /dev/null
+#(ly:set-option 'old-relative)
+
+\version "1.9.6"
+\header {
+
+texidoc = "The notation problem, @emph{what} symbols to create,
+ is handled by plugins. Each plugin is called Engraver. In this example,
+ we switch on engravers one by one, in the following order
+
+@itemize
+@item Note heads
+@item Staff symbol
+@item Clef
+@item Stem
+@item Beams, slurs, accents
+@item Accidentals, bar lines, time signature, and key signature.
+@end itemize
+
+Engravers are grouped. For example, note heads, slurs, beams etc. form
+a Voice context. Engravers for key, accidental, bar, etc. form the
+Staff context.
+
+"
+
+ }
+\paper { raggedright = ##t }
+\include "engraver-example.ly"
+
+
+%
+% setup for Request->Element conversion. Guru-only
+%
+
+MyStaffContext=\translator {
+ \type "Engraver_group_engraver"
+ \name Staff
+
+ \description "Handles clefs, bar lines, keys, accidentals. It can contain
+@code{Voice} contexts."
+
+
+ \consists "Output_property_engraver"
+
+ \consists "Font_size_engraver"
+
+ \consists "Volta_engraver"
+ \consists "Separating_line_group_engraver"
+ SeparatingGroupSpanner \override #'spacing-procedure
+ = #Separating_group_spanner::set_spacing_rods_and_seqs
+ \consists "Dot_column_engraver"
+
+ \consists "Ottava_spanner_engraver"
+ \consists "Rest_collision_engraver"
+ \consists "Piano_pedal_engraver"
+ \consists "Instrument_name_engraver"
+ \consists "Grob_pq_engraver"
+ \consists "Forbid_line_break_engraver"
+ \consistsend "Axis_group_engraver"
+\consists "Pitch_squash_engraver"
+
+ minimumVerticalExtent = #'(-6 . 6)
+ extraVerticalExtent = ##f
+ verticalExtent = ##f
+ localKeySignature = #'()
+
+ % explicitly set instrument, so we don't get
+ % weird effects when doing instrument names for
+ % piano staves
+
+ instrument = #'()
+ instr = #'()
+
+ \accepts "Voice"
+}
+
+
+MyVoiceContext = \translator {
+ \type "Engraver_group_engraver"
+ \name Voice
+
+\description "
+ Corresponds to a voice on a staff. This context handles the
+ conversion of dynamic signs, stems, beams, super- and subscripts,
+ slurs, ties, and rests.
+
+ You have to instantiate this explicitly if you want to have
+ multiple voices on the same staff."
+
+ localKeySignature = #'()
+ \consists "Font_size_engraver"
+
+ % must come before all
+ \consists "Voice_devnull_engraver"
+ \consists "Output_property_engraver"
+ \consists "Arpeggio_engraver"
+ \consists "Multi_measure_rest_engraver"
+ \consists "Text_spanner_engraver"
+ \consists "Grob_pq_engraver"
+ \consists "Note_head_line_engraver"
+ \consists "Glissando_engraver"
+ \consists "Ligature_bracket_engraver"
+ \consists "Breathing_sign_engraver"
+ % \consists "Rest_engraver"
+ \consists "Grace_beam_engraver"
+ \consists "New_fingering_engraver"
+ \consists "Chord_tremolo_engraver"
+ \consists "Percent_repeat_engraver"
+ \consists "Slash_repeat_engraver"
+ \consists "Melisma_engraver"
+
+%{
+ Must come before text_engraver, but after note_column engraver.
+
+%}
+ \consists "Text_engraver"
+ \consists "Dynamic_engraver"
+ \consists "Fingering_engraver"
+
+ \consists "Script_column_engraver"
+ \consists "Rhythmic_column_engraver"
+ \consists "Cluster_spanner_engraver"
+ \consists "Tie_engraver"
+ \consists "Tie_engraver"
+ \consists "Tuplet_engraver"
+ \consists "A2_engraver"
+
+ \consists "Skip_event_swallow_translator"
+ \accepts Thread % bug if you leave out this!
+}
+
+MyThreadContext = \translator{
+ \type Engraver_group_engraver
+ \name Thread
+ localKeySignature = #'()
+\description "
+ Handles note heads, and is contained in the Voice context. You
+ have to instantiate this explicitly if you want to adjust the
+ style of individual note heads.
+"
+ \consists "Font_size_engraver"
+ \consists "Thread_devnull_engraver"
+ \consists "Note_heads_engraver"
+ \consists "Rest_engraver"
+
+ % why here ?
+ \consists "Output_property_engraver"
+
+}
+
+
+
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+
+MyStaffContext = \translator {
+ \MyStaffContext
+ \consists "Staff_symbol_engraver"
+}
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyStaffContext = \translator {
+ \MyStaffContext
+ \consists "Clef_engraver"
+ \remove "Pitch_squash_engraver"
+}
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyVoiceContext = \translator {
+ \MyVoiceContext
+ \consists "Stem_engraver"
+ }
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyVoiceContext = \translator {
+ \MyVoiceContext
+ \consists "Beam_engraver"
+}
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyVoiceContext= \translator {
+ \MyVoiceContext
+ \consists "Phrasing_slur_engraver"
+ \consists "Slur_engraver"
+ \consists "Script_engraver"
+}
+
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyStaffContext = \translator {
+ \MyStaffContext
+ \consists "Bar_engraver"
+ \consists "Time_signature_engraver"
+
+}
+
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+
+MyStaffContext = \translator
+ { \MyStaffContext
+ \consists "Accidental_engraver"
+ \consists "Key_engraver"
+}
+\score {
+ \topVoice
+ \paper {
+ \translator { \MyStaffContext }
+ \translator { \MyVoiceContext }
+ \translator { \MyThreadContext }
+ }
+}
+++ /dev/null
-\version "1.9.4"
-
-\header{ texidoc="@cindex Explicit Pitch and Duration
-Explicit pitches and durations. "
-}
-\score {
- \notes {
- \pitch #(ly:make-pitch 0 0 0) \duration #(ly:make-duration 1 0)
- \pitch #(ly:make-pitch 1 1 1) \duration #(ly:make-duration 2 0)
-
- }
-\paper{raggedright = ##t}
-}
-
#include "item.hh"
#include "score-engraver.hh"
#include "warn.hh"
+#include "spanner.hh"
+#include "tie.hh"
/*
class Completion_heads_engraver : public Engraver
{
Link_array<Item> notes_;
+ Link_array<Item> prev_notes_;
+ Link_array<Grob> ties_;
Link_array<Item> dots_;
Link_array<Music> note_reqs_;
announce_grob (note,req->self_scm ());
notes_.push (note);
}
+
+ if (prev_notes_.size() == notes_.size ())
+ {
+ for (int i= 0; i < notes_.size(); i++)
+ {
+ Grob * p = new Spanner (get_property ("Tie"));
+ Tie::set_interface (p); // cannot remove yet!
+
+ Tie::set_head (p, LEFT, prev_notes_[i]);
+ Tie::set_head (p, RIGHT, notes_[i]);
+
+ ties_.push (p);
+ announce_grob(p, SCM_EOL);
+ }
+ }
left_to_do_ -= note_dur.get_length ();
-
/*
don't do complicated arithmetic with grace notes.
*/
{
left_to_do_ = Rational (0,0);
}
-
}
void
Completion_heads_engraver::stop_translation_timestep ()
{
+ for (int i = ties_.size (); i--;)
+ typeset_grob (ties_[i]);
+ ties_.clear();
+
for (int i=0; i < notes_.size (); i++)
{
typeset_grob (notes_[i]);
}
+ if (notes_.size())
+ prev_notes_ = notes_;
notes_.clear ();
for (int i=0; i < dots_.size (); i++)
scm_gc_unprotect_object (scratch_note_reqs_[i]->self_scm () );
}
+
scratch_note_reqs_.clear();
}
-Music * tie_req = 0;
-
void
Completion_heads_engraver::start_translation_timestep ()
{
if (note_end_mom_.main_part_ <= now.main_part_)
{
note_reqs_.clear ();
- }
-
- if (left_to_do_)
- {
- if (!tie_req)
- tie_req = make_music_by_name (ly_symbol2scm ("TieEvent"));
-
- bool succ = daddy_trans_->try_music (tie_req);
- if (!succ)
- {
- programming_error ("Completion_heads_engraver: no-one to make tie.");
- }
+ prev_notes_.clear ();
}
}
/* descr */ "This engraver replaces "
"@code{Note_heads_engraver}. It plays some trickery to "
"break long notes and automatically tie them into the next measure.",
-/* creats*/ "NoteHead Dots",
+/* creats*/ "NoteHead Dots Tie",
/* accepts */ "busy-playing-event note-event",
/* acks */ "",
/* reads */ "centralCPosition measurePosition measureLength",
{"default", DEFAULT},
{"denies", DENIES},
{"description", DESCRIPTION},
- {"duration", DURATION},
{"figures",FIGURES},
{"grace", GRACE},
{"grobdescriptions", GROBDESCRIPTIONS},
{"paper", PAPER},
{"partcombine", PARTCOMBINE},
{"partial", PARTIAL},
- {"pitch", PITCH},
{"pitchnames", PITCHNAMES},
{"property", PROPERTY},
{"relative", RELATIVE},
%token DEFAULT
%token DENIES
%token DESCRIPTION
-%token DURATION
%token EXTENDER
%token FIGURES FIGURE_OPEN FIGURE_CLOSE
%token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
%token PAPER
%token PARTCOMBINE
%token PARTIAL
-%token PITCH
%token PITCHNAMES
%token PROPERTY
%token RELATIVE
%type <music> note_chord_element chord_body chord_body_element
%type <scm> chord_body_elements
%type <scm> steno_duration optional_notemode_duration multiplied_duration
-%type <scm> verbose_duration
%type <scm> post_events
%type <music> gen_text_def direction_less_event direction_reqd_event
%type <scm> steno_pitch pitch absolute_pitch pitch_also_in_chords
-%type <scm> explicit_pitch steno_tonic_pitch
+%type <scm> steno_tonic_pitch
%type <scm> duration_length fraction
%type <scm> new_chord step_number chord_items chord_item chord_separator step_numbers
$$ = $1->self_scm ();
scm_gc_unprotect_object ($$);
}
- | verbose_duration {
- $$ = $1;
- }
| number_expression {
$$ = $1;
}
csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
- SCM new_id = scm_number_to_string (gh_int2scm (new_context_count ++),
- gh_int2scm (10));
+ char s[1024];
+ snprintf (s, 1024, "uniqueContext%d", new_context_count ++);
+
+ SCM new_id = scm_makfrom0str (s);
csm->set_mus_property ("context-id", new_id);
$$ = csm;
}
steno_pitch {
$$ = $1;
}
- | explicit_pitch {
- $$ = $1;
- }
;
pitch_also_in_chords:
| steno_tonic_pitch
;
-explicit_pitch:
- PITCH embedded_scm {
- $$ = $2;
- if (!unsmob_pitch ($2)) {
- THIS->parser_error (_f ("Expecting musical-pitch value", 3));
- $$ = Pitch ().smobbed_copy ();
- }
- }
- ;
-verbose_duration:
- DURATION embedded_scm {
- $$ = $2;
- if (!unsmob_duration ($2))
- {
- THIS->parser_error (_ ("Must have duration object"));
- $$ = Duration ().smobbed_copy ();
- }
- }
- ;
+
+
extender_req:
EXTENDER {
multiplied_duration {
$$ = $1;
}
- | verbose_duration {
- $$ = $1;
- }
;
optional_notemode_duration:
THIS->beam_check ($$);
}
- | verbose_duration {
- $$ = $1;
- THIS->default_duration_ = *unsmob_duration ($$);
- }
;
steno_duration:
}
+/*
+ these are too many props.
+ */
ADD_INTERFACE (Stem,"stem-interface",
"A stem",
- "french-beaming up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-free-lengths beamed-extreme-minimum-free-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length flag-style no-stem-extend stroke-style");
+ "tremolo-flag french-beaming up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-free-lengths beamed-extreme-minimum-free-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length flag-style no-stem-extend stroke-style");
#(ly:set-option 'old-relative)
\version "1.9.1"
-breve = \duration #(ly:make-duration -1 0)
-longa = \duration #(ly:make-duration -2 0 )
-maxima = \duration #(ly:make-duration -3 0)
+breve = #(ly:make-duration -1 0)
+longa = #(ly:make-duration -2 0 )
+maxima = #(ly:make-duration -3 0)
\include "nederlands.ly" % dutch
\include "chord-modifiers-init.ly"
(Y-offset-callbacks . (,Side_position_interface::aligned_side))
(self-alignment-X . 0)
(direction . 1)
- (padding . 2)
+ (padding . 1.3)
(font-family . number)
(meta . ((interfaces . (side-position-interface self-alignment-interface font-interface spanner-interface text-interface))))
))
(Y-offset-callbacks . (,Side_position_interface::aligned_side))
(self-alignment-X . 0)
(direction . 1)
- (padding . 2)
+ (padding . 1.5)
(font-family . roman)
(meta . ((interfaces . (side-position-interface self-alignment-interface font-interface spanner-interface text-interface))))
))
)
(make <texi-node>
- #:name "Translation properties"
- #:desc "All translation properties"
+ #:name "Context properties"
+ #:desc "All context properties"
#:text texi)
))
conversions.append (((1,9,5), conv, 'HaraKiriVerticalGroup -> RemoveEmptyVerticalGroup'))
def conv (str):
- if re.search ("ly:get-font", str):
+ if re.search ("ly:get-font", str) :
+ sys.stderr.write (r"(ly:get-font foo ..) has been replaced by" + \
+ " (ly:paper-get-font (ly:grob-get-paper foo) .. ).\n" +\
+ "please update manually.")
+
+ raise FatalConversionError()
+
+ if re.search ("\\pitch *#", str) :
+ sys.stderr.write (r"\\pitch has been deprecated. " +\
+ " Use Scheme code to construct arbitrary note events.")
+
+ raise FatalConversionError()
+
+ if re.search ("ly:get-font", str) :
sys.stderr.write (r"(ly:get-font foo ..) has been replaced by" + \
" (ly:paper-get-font (ly:grob-get-paper foo) .. ).\n" +\
"please update manually.")
conversions.append (((1,9,6), conv, 'ly:get-font deprecated.'))
+
+
################################
# END OF CONVERSIONS
################################
taken_file_names[basename] = 0
else:
taken_file_names[basename] = taken_file_names[basename] + 1
- basename = basename + "-%i" % taken_file_names[basename]
+ basename = basename + "-t%i" % taken_file_names[basename]
update_file (file_body, os.path.join (g_outdir, basename) + '.ly')
needed_filetypes = ['tex']