]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/notation/input.itely
Revert "Merge branch 'footnote' into HEAD"
[lilypond.git] / Documentation / notation / input.itely
index 504670d7cacb74ec17f7888b707ab5e7982a15a8..9294d5cd0838826481f4dd87fd5f90783cc0d074 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.13.36"
+@c \version "2.15.32"
 
 @node General input and output
 @chapter General input and output
@@ -22,6 +22,7 @@ rather than specific notation.
 * Working with input files::
 * Controlling output::
 * MIDI output::
+* Extracting musical information::
 @end menu
 
 
@@ -412,9 +413,10 @@ music expression will be translated into
         @{ c'4 d' e'2 @}
       @}
     @}
+    \layout @{ @}
   @}
-       \layout @{ @}
-       \header @{ @}
+  \paper @{ @}
+  \header @{ @}
 @}
 @end example
 
@@ -492,7 +494,7 @@ circumstances to avoid errors:
 @item After every command or variable, i.e. every item that
 begins with a @code{\} sign.
 @item After every item that is to be interpreted as a Scheme
-expression, i.e. every item that begins with a @code{#} sign.
+expression, i.e. every item that begins with a @code{#}@tie{}sign.
 @item To separate all elements of a Scheme expression.
 @item In @code{lyricmode} to separate all the terms in both
 @code{\override} and @code{\set} commands.  In particular, spaces
@@ -502,7 +504,6 @@ after the entire command.
 
 @end itemize
 
-
 @seealso
 Learning Manual:
 @rlearning{How LilyPond input files work}.
@@ -517,13 +518,14 @@ some pieces include a lot more information.
 @menu
 * Creating titles headers and footers::
 * Custom headers footers and titles::
+* Creating footnotes::
 * Reference to page numbers::
 * Table of contents::
 @end menu
 
 
 @node Creating titles headers and footers
-@subsection Creating titles, headers, and footers
+@subsection Creating titles headers and footers
 
 @menu
 * Title blocks explained::
@@ -708,6 +710,7 @@ Notation Reference:
 Installed Files:
 @file{ly/titling-init.ly}.
 
+
 @node Default layout of headers and footers
 @unnumberedsubsubsec Default layout of headers and footers
 
@@ -775,7 +778,7 @@ To remove the @code{tagline} set the value to @code{##f}.
 
 
 @node Custom headers footers and titles
-@subsection Custom headers, footers, and titles
+@subsection Custom headers footers and titles
 
 @c TODO: somewhere put a link to header spacing info
 @c       (you'll have to explain it more in NR 4).
@@ -1012,6 +1015,252 @@ Notation Reference:
 @ref{Default layout of book and score title blocks}.
 
 
+@node Creating footnotes
+@subsection Creating footnotes
+
+There are two types of footnotes that can be created; automatic
+footnotes and manual footnotes.
+
+@menu
+* Footnotes overview::
+* Automatic footnotes::
+* Manual footnotes::
+@end menu
+
+@node Footnotes overview
+@unnumberedsubsubsec Footnotes overview
+
+Automatic footnotes create incrementing, numerical indicators and
+manual footnotes allow a custom indicator to be created instead.  All
+grobs, top-level @code{\markup} and chorded notes can be annotated.
+
+The order in which each grob is drawn determines the order in which each
+indicator and so footnotes are created during compilation.
+
+
+@node Automatic footnotes
+@unnumberedsubsubsec Automatic footnotes
+
+Automatic footnotes take three arguments; the @var{Layout Object} to be
+annotated, the @samp{(x . y)} position of the indicator and a
+@code{\markup} that will appear in the footnote at the bottom of the
+page.
+
+The command @code{\footnote} must come @emph{before} the grob that the
+footnote is being attached to:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \relative c' {
+    \footnote #'(0.5 . -2) #'NoteHead
+      \markup { The first note }
+    a'4 b8
+    \footnote #'(0.5 . 1) #'NoteHead
+      \markup { The third note }
+    e c4 d4
+  }
+}
+@end lilypond
+
+To annotate chorded notes, the @code{\footnote} must come @emph{after}
+the note to which the footnote is being attached as a @code{TextScript}:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \relative c' {
+    <
+    c-\footnote #'(1 . -1.25) "Here is a C"
+    es-\footnote #'(2 . -0.25) \markup { \italic "An E-flat" }
+    g-\footnote #'(2 . 3) \markup { \bold "This is a G" }
+    >1
+  }
+}
+@end lilypond
+
+@warning {When footnotes have the same vertical position, the footnotes
+are printed in order of descendancy; the higher the footnote, the
+higher up in the list.}
+
+Here are some more examples of footnoted grobs, also showing the
+relative position of the footnotes to the tagline and copyright.
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { copyright = \markup { "Copyright 1970" } }
+  \relative c' {
+    \footnote #'(-3 . 0) #'DynamicText
+      \markup { \bold Forte }
+
+    \footnote #'(0 . 1.5) #'Slur
+      \markup { A slur }
+    a'4\f(
+
+    \footnote #'(0 . -2) #'Beam
+      \markup { Beam }
+    b8)[ e]
+
+    \footnote #'(1 . -1) #'Stem
+      \markup  { \teeny { This is a stem } }
+    c4
+
+    \footnote #'(0 . 0.5) #'AccidentalCautionary
+      \markup \italic { A cautionary accidental }
+
+    \footnote #'(0.5 . -0.5) #'TextScript
+      \markup \italic { Slow Down }
+    dis?4_"rit."
+  }
+}
+@end lilypond
+
+For top-level @code{\markup}, the @code{\auto-footnote} command is
+required:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \markup { \auto-footnote "A simple tune" \italic "By me" }
+  \relative c' {
+    a'4 b8 e c4 d
+  }
+}
+@end lilypond
+
+
+@node Manual footnotes
+@unnumberedsubsubsec Manual footnotes
+
+@cindex footnotes, manual
+
+Manual footnotes takes four arguments; the @var{Layout Object} to be
+annotated, the @samp{(x . y)} position of the indicator and two
+@code{\markup} commands; the first is the indicator attached to the note
+or grob and the second is the footnote at the bottom of the page.
+
+Like automatic footnotes, manual @code{\footnote} commands must come
+@emph{before} the grob that the footnote is annotating and attached as a
+@code{TextScript}:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \relative c' {
+    a'4-\footnote
+          "1" #'(0.5 . -2) #'NoteHead \markup { \italic "1. The first note" }
+    b8
+    e-\footnote
+          \markup { \bold "2" } #'(0.5 . 1) #'NoteHead "2. The second note"
+    c4
+    d\p-\footnote "3" #'(0.5 . -1) #'DynamicText "3. Piano"
+  }
+}
+@end lilypond
+
+To annotate chorded notes with manual footnotes:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \relative c' {
+    <
+    c-\footnote "1" #'(1 . -1.25) "1. C"
+    es-\footnote
+       \markup { \bold "b" } #'(2 . -0.25) "b. E-flat"
+    g-\footnote "3" #'(2 . 3) \markup { \italic "iii. G" }
+    >1
+  }
+}
+@end lilypond
+
+@warning {When footnotes have the same vertical position, the footnotes
+are printed in order of descendancy; the higher the footnote, the
+higher up in the list.}
+
+Here are some examples of manually footnoted grobs, also showing
+the relative position of the footnotes to the tagline and copyright
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \relative c' {
+    \footnote
+      \markup { \teeny 1 } #'(-3 . 0) #'DynamicText
+      \markup { 1. \bold Forte }
+
+    \footnote
+      \markup { \teeny b } #'(0 . 1.5) #'Slur
+      \markup { b. A slur }
+    a'4\f(
+
+    \footnote
+      \markup { \teeny 3 } #'(0 . -2) #'Beam
+      \markup { 3. Beam }
+    b8)[ e]
+
+    \footnote
+      \markup { 4 } #'(1 . -1) #'Stem
+      \markup  { \bold 4. { This is a stem } }
+    c4
+
+    \footnote
+      \markup \concat \teeny { "sharp (v)" }
+          #'(0 . 0.5) #'AccidentalCautionary
+      \markup \italic { v. A cautionary accidental }
+
+    \footnote
+      \markup \concat \teeny { "a" } #'(0.5 . -0.5) #'TextScript
+      \markup \italic { a. Slow Down }
+    dis?4_"rit."
+
+    \breathe
+    \footnote
+      \markup { \teeny \musicglyph #"rests.4" }
+          #'(1.5 . -0.25) #'BreathingSign
+      \markup { \null }
+  }
+}
+@end lilypond
+
+To manually footnote a top-level @code{\markup}:
+
+@lilypond[verbatim,quote,ragged-right,papersize=a8]
+\book {
+  \header { tagline = ##f }
+  \markup { "A simple tune" \footnote "*" \italic "* By me" }
+  \relative c' {
+    a'4 b8 e c4 d4
+  }
+}
+@end lilypond
+
+@seealso
+Learning Manual:
+@rlearning{Objects and interfaces}.
+
+Notation Reference:
+@ref{Balloon help},
+@ref{Page layout},
+@ref{Text marks},
+@ref{Text scripts},
+@ref{Titles and headers}.
+
+Internals Reference:
+@rinternals{FootnoteEvent},
+@rinternals{FootnoteItem},
+@rinternals{FootnoteSpanner},
+@rinternals{Footnote_engraver}.
+
+@knownissues
+Multiple footnotes for the same page can only be stacked, one on top of
+the other, and cannot be printed on the same line.  Footnotes cannot be
+attached to @code{MultiMeasureRests} and may collide with @code{Staff},
+@code{\markup} objects and other @code{footnote} annotations.  When
+using any manual @code{footnote} command a @code{\paper} block
+containing @code{footnote-auto-number = ##f} is required.
+
+
 @node Reference to page numbers
 @subsection Reference to page numbers
 
@@ -1064,13 +1313,13 @@ ie. a two digit number.
 
 @node Table of contents
 @subsection Table of contents
-A table of contents is included using the @code{\markuplines \table-of-contents}
+A table of contents is included using the @code{\markuplist \table-of-contents}
 command.  The elements which should appear in the table of contents are
 entered with the @code{\tocItem} command, which may be used either at
 top-level, or inside a music expression.
 
 @verbatim
-\markuplines \table-of-contents
+\markuplist \table-of-contents
 \pageBreak
 
 \tocItem \markup "First score"
@@ -1153,7 +1402,7 @@ tocAct =
    (add-toc-item! 'tocActMarkup text))
 
 \book {
-  \markuplines \table-of-contents
+  \markuplist \table-of-contents
   \tocAct \markup { Atto Primo }
   \tocItem \markup { Coro. Viva il nostro Alcide }
   \tocItem \markup { Cesare. Presti omai l'Egizzia terra }
@@ -1173,17 +1422,16 @@ Dots can be added to fill the line between an item and its page number:
 }
 
 \book {
-  \markuplines \table-of-contents
+  \markuplist \table-of-contents
   \tocItem \markup { Allegro }
   \tocItem \markup { Largo }
   \markup \null
 }
 @end lilypond
 
-
 @seealso
-Init files: @file{../ly/toc-init.ly}.
-
+Installed Files:
+@file{ly/toc-init.ly}.
 
 @predefined
 @funindex \table-of-contents
@@ -1199,8 +1447,7 @@ Init files: @file{../ly/toc-init.ly}.
 @menu
 * Including LilyPond files::
 * Different editions from one source::
-* Text encoding::
-* Displaying LilyPond notation::
+* Special characters::
 @end menu
 
 
@@ -1258,7 +1505,7 @@ been brought into the main file, so the file names they specify
 must all be relative to the directory containing the main file,
 not the directory containing the included file.  However,
 this behavior can be changed by passing the option
-@code{-drelative-includes} option at the command line
+@option{-drelative-includes} option at the command line
 (or by adding @code{#(ly:set-option 'relative-includes #t)}
 at the top of the main input file).  With @code{relative-includes}
 set, the path for each @code{\include} command will be taken
@@ -1306,32 +1553,30 @@ version of LilyPond.
 Some simple examples of using @code{\include} are shown in
 @rlearning{Scores and parts}.
 
-
 @seealso
 Learning Manual:
 @rlearning{Other sources of information},
 @rlearning{Scores and parts}.
 
-
 @knownissues
-
 If an included file is given a name which is the same as one in
 LilyPond's installation files, LilyPond's file from the
 installation files takes precedence.
 
 
-
 @node Different editions from one source
 @subsection Different editions from one source
 
-Several mechanisms are available to facilitate the generation
-of different versions of a score from the same music source.
-Variables are perhaps most useful for combining lengthy sections
-of music and/or annotation in various ways, while tags are more
-useful for selecting one from several alternative shorter sections
-of music.  Whichever method is used, separating the notation from
-the structure of the score will make it easier to change the
-structure while leaving the notation untouched.
+Several methods can be used to generate different versions of a score
+from the same music source.  Variables are perhaps the most useful for
+combining lengthy sections of music and/or annotation.  Tags are more
+useful for selecting one section from several alternative shorter
+sections of music, and can also be used for splicing pieces of music
+together at different points.
+
+Whichever method is used, separating the notation from the structure of
+the score will make it easier to change the structure while leaving the
+notation untouched.
 
 @menu
 * Using variables::
@@ -1406,9 +1651,12 @@ LilyPond files}.
 @funindex \tag
 @funindex \keepWithTag
 @funindex \removeWithTag
+@funindex \pushToTag
+@funindex \appendToTag
 @cindex tag
 @cindex keep tagged music
 @cindex remove tagged music
+@cindex splice into tagged music
 
 The @code{\tag #'@var{partA}} command marks a music expression
 with the name @var{partA}.
@@ -1533,6 +1781,30 @@ expression will cause @emph{all} tagged sections to be removed, as
 the first filter will remove all tagged sections except the one
 named, and the second filter will remove even that tagged section.
 
+Sometimes you want to splice some music at a particular place in an
+existing music expression.  You can use @code{\pushToTag} and
+@code{\appendToTag} for adding material at the front or end of the
+@code{elements} of an existing music construct.  Not every music
+construct has @code{elements}, but sequential and simultaneous music are
+safe bets:
+
+@lilypond[verbatim,quote]
+test = { \tag #'here { \tag #'here <<c''>> } }
+
+{
+  \pushToTag #'here c'
+  \pushToTag #'here e'
+  \pushToTag #'here g' \test
+  \appendToTag #'here c'
+  \appendToTag #'here e'
+  \appendToTag #'here g' \test
+}
+@end lilypond
+
+Both commands get a tag, the material to splice in at every occurence of
+the tag, and the tagged expression.  The commands make sure to
+copy everything that they change so that the original @code{\test}
+retains its meaning.
 
 @seealso
 Learning Manual:
@@ -1542,19 +1814,18 @@ Notation Reference:
 @ref{Automatic part combining},
 @ref{Including LilyPond files}.
 
-
 @ignore
 @c This warning is more general than this placement implies.
 @c Rests are not merged whether or not they come from tagged sections.
 @c Should be deleted?  -td
 
 @knownissues
-
 Multiple rests are not merged if you create a score with more
 than one tagged section at the same place.
 
 @end ignore
 
+
 @node Using global settings
 @unnumberedsubsubsec Using global settings
 
@@ -1582,12 +1853,24 @@ Learning Manual:
 Notation Reference:
 @ref{Including LilyPond files}.
 
+
+@node Special characters
+@subsection Special characters
+
+@cindex special characters
+@cindex non-ASCII characters
+
+@menu
+* Text encoding::
+* Unicode::
+* ASCII aliases::
+@end menu
+
+
 @node Text encoding
-@subsection Text encoding
+@unnumberedsubsubsec Text encoding
 
-@cindex Unicode
 @cindex UTF-8
-@cindex non-ASCII characters
 
 LilyPond uses the character repertoire defined by the Unicode
 consortium and ISO/IEC 10646.  This defines a unique name and
@@ -1652,6 +1935,12 @@ portuguese = \lyricmode {
 \addlyrics { \portuguese }
 @end lilypond
 
+
+@node Unicode
+@unnumberedsubsubsec Unicode
+
+@cindex Unicode
+
 To enter a single character for which the Unicode code point is
 known but which is not available in the editor being used, use
 either @code{\char ##xhhhh} or @code{\char #dddd} within a
@@ -1687,7 +1976,7 @@ lyrics and as stand-alone text below the score:
   }
   \addlyrics { O \markup { \concat { Ph \char ##x0153 be! } } }
 }
-\markup { "Copyright 2008--2011" \char ##x00A9 }
+\markup { "Copyright 2008--2012" \char ##x00A9 }
 @end lilypond
 
 @cindex copyright sign
@@ -1700,35 +1989,57 @@ To enter the copyright sign in the copyright notice use:
 @}
 @end example
 
-@node Displaying LilyPond notation
-@subsection Displaying LilyPond notation
 
-@funindex \displayLilyMusic
-Displaying a music expression in LilyPond notation can be
-done with the music function @code{\displayLilyMusic} but only when
-using the command line.  For example,
+@node ASCII aliases
+@unnumberedsubsubsec ASCII aliases
 
-@example
-@{
-  \displayLilyMusic \transpose c a, @{ c4 e g a bes @}
-@}
-@end example
+A list of ASCII aliases for special characters can be included:
 
-will display
+@lilypond[quote,verbatim]
+\paper {
+  #(include-special-characters)
+}
 
-@example
-@{ a,4 cis e fis g @}
-@end example
+\markup "&flqq; &ndash; &OE;uvre incomplète&hellip; &frqq;"
 
-By default, LilyPond will print these messages to the console
-along with all the other LilyPond compilation messages.  To split
-up these messages and save the results of @code{\display@{STUFF@}},
-redirect the output to a file.
+\score {
+  \new Staff { \repeat unfold 9 a'4 }
+  \addlyrics {
+    This is al -- so wor -- kin'~in ly -- rics: &ndash;_&OE;&hellip;
+  }
+}
 
-@example
-lilypond file.ly >display.txt
-@end example
+\markup \column {
+  "The replacement can be disabled:"
+  "&ndash; &OE; &hellip;"
+  \override #'(replacement-alist . ()) "&ndash; &OE; &hellip;"
+}
+@end lilypond
+
+You can also make your own aliases, either globally:
+
+@lilypond[quote,verbatim]
+\paper {
+  #(add-text-replacements!
+    '(("100" . "hundred")
+      ("dpi" . "dots per inch")))
+}
+\markup "A 100 dpi."
+@end lilypond
+
+or locally:
+
+@lilypond[quote,verbatim]
+\markup \replace #'(("100" . "hundred")
+                    ("dpi" . "dots per inch")) "A 100 dpi."
+@end lilypond
 
+@seealso
+Notation Reference:
+@ref{List of special characters}.
+
+Installed Files:
+@file{ly/text-replacements.ly}.
 
 
 @node Controlling output
@@ -1771,7 +2082,7 @@ More clip regions can be defined by adding more pairs of
 rhythmic-locations to the list.
 
 In order to use this feature, LilyPond must be invoked with
-@code{-dclip-systems}.  The clips are output as EPS files, and are
+@option{-dclip-systems}.  The clips are output as EPS files, and are
 converted to PDF and PNG if these formats are switched on as well.
 
 For more information on output formats, see @rprogram{Invoking lilypond}.
@@ -1834,8 +2145,8 @@ The default output formats for the printed score are Portable
 Document Format (PDF) and PostScript (PS).  Scalable Vector
 Graphics (SVG), Encapsulated PostScript (EPS) and Portable
 Network Graphics (PNG) output formats are also available through
-command line options, see @rprogram{Command line options for
-lilypond}.
+command line options, see
+@rprogram{Basic command line options for LilyPond}.
 
 
 @node Replacing the notation font
@@ -1861,19 +2172,21 @@ Here are a few sample bars of music set in LilyPond's Feta font:
 
 Download and extract the zip file.  Copy the @code{lilyfonts}
 directory to @file{@var{SHARE_DIR}/lilypond/current}; for more
-information, see @rlearning{Other sources of information}.
-Move the existing @code{fonts} directory to @code{fonts_orig} and
-move the @code{lilyfonts} directory to @code{fonts}.  Simply move
-@code{fonts_orig} back to @code{fonts} to revert back to Feta.
+information, see @rlearning{Other sources of information}.  Rename the
+existing @code{fonts} directory to @code{fonts_orig} and the
+@code{lilyfonts} directory to @code{fonts}.  To revert back to Feta,
+reverse the process.
 
 @seealso
-Learning Manual: @rlearning{Other sources of information}.
+Learning Manual:
+@rlearning{Other sources of information}.
 
 @knownissues
-
-Gonville cannot be used to typeset @q{Ancient Music} notation.  Please
-refer to the author's website for more information on this and other
-specifics including licensing of Gonville.
+Gonville cannot be used to typeset @q{Ancient Music} notation and it is
+likely newer glyphs in later releases of LilyPond may not exist in the
+Gonville font family.  Please refer to the author's website for more
+information on these and other specifics, including licensing of
+Gonville.
 
 
 @node MIDI output
@@ -1897,10 +2210,9 @@ Standard MIDI oputput is somewhat crude; optionally, an enhanced and
 more realistic MIDI output is available by means of
 @ref{The Articulate script}.
 
-@c TODO Check this
-The midi output allocates a channel for each staff, and one for global
-settings.  Therefore the midi file should not have more than 15 staves
-(or 14 if you do not use drums).  Other staves will remain silent.
+The MIDI output allocates a channel for each staff, and reserves channel
+10 for drums.  There are only 16 MIDI channels per device, so if the
+score contains more than 15 staves, MIDI channels will be reused.
 
 @menu
 * Creating MIDI files::
@@ -2003,7 +2315,7 @@ instrument is used.
 
 @snippets
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
+@lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
 {changing-midi-output-to-one-channel-per-voice.ly}
 
 @knownissues
@@ -2053,24 +2365,16 @@ indication to be printed:
 \score @{
   @var{...music...}
   \midi @{
-    \context @{
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 4)
-    @}
+    \tempo 4 = 72
   @}
 @}
 @end example
 
 In this example the tempo is set to 72 quarter note
-beats per minute.  This kind of tempo specification cannot take
-a dotted note length as an argument.  If one is required, break
-the dotted note into smaller units.  For example, a tempo of 90
-dotted quarter notes per minute can be specified as 270 eighth
-notes per minute:
-
-@example
-tempoWholesPerMinute = #(ly:make-moment 270 8)
-@end example
+beats per minute.  @code{\tempo} is actually a music command for
+setting properties during the interpretation of music: in the
+context of output definitions like a @code{\midi} block, as a matter of
+courtesy those are reinterpreted as if they were context modifications.
 
 @cindex MIDI context definitions
 
@@ -2317,9 +2621,9 @@ volume is limited to the range 0.2 - 0.5.
   >>
   \layout {}
   \midi {
+    \tempo 2 = 72
     \context {
       \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
       midiMinimumVolume = #0.2
       midiMaximumVolume = #0.5
     }
@@ -2369,10 +2673,7 @@ correctly.
   >>
   \layout {}
   \midi {
-    \context {
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
-    }
+    \tempo 2 = 72
   }
 }
 @end lilypond
@@ -2438,10 +2739,7 @@ to the same values as the previous example.
   >>
   \layout { }
   \midi {
-    \context {
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
-    }
+    \tempo 2 = 72
   }
 }
 @end lilypond
@@ -2544,3 +2842,114 @@ example shown above as it enables performing abbreviatures such as
 
 Articulate shortens chords and some music (esp. organ music) could
 sound worse.
+
+
+@node Extracting musical information
+@section Extracting musical information
+
+In addition to creating graphical output and MIDI, LilyPond can
+display musical information as text.
+
+@menu
+* Displaying LilyPond notation::
+* Displaying scheme music expressions::
+* Saving music events to a file::
+@end menu
+
+@node Displaying LilyPond notation
+@subsection Displaying LilyPond notation
+
+@funindex \displayLilyMusic
+Displaying a music expression in LilyPond notation can be
+done with the music function @code{\displayLilyMusic}.  To see the
+output, you will typically want to call LilyPond using the command
+line.  For example,
+
+@example
+@{
+  \displayLilyMusic \transpose c a, @{ c4 e g a bes @}
+@}
+@end example
+
+will display
+
+@example
+@{ a,4 cis e fis g @}
+@end example
+
+By default, LilyPond will print these messages to the console
+along with all the other LilyPond compilation messages.  To split
+up these messages and save the results of @code{\display@{STUFF@}},
+redirect the output to a file.
+
+@example
+lilypond file.ly >display.txt
+@end example
+
+@funindex \void
+Note that Lilypond does not just display the music expression, but
+also interprets it (since @code{\displayLilyMusic} returns it in
+addition to displaying it).  This is convenient since you can just
+insert @code{\displayLilyMusic} into existing music in order to get
+information about it.  If you don't actually want Lilypond to
+interpret the displayed music as well as display it, use @code{\void}
+in order to have it ignored:
+
+@example
+@{
+  \void \displayLilyMusic \transpose c a, @{ c4 e g a bes @}
+@}
+@end example
+
+
+@node Displaying scheme music expressions
+@subsection Displaying scheme music expressions
+
+See @rextend{Displaying music expressions}.
+
+
+@node Saving music events to a file
+@subsection Saving music events to a file
+
+Music events can be saved to a file on a per-staff basis by
+including a file in your main score.
+
+@example
+\include "event-listener.ly"
+@end example
+
+This will create file(s) called @file{FILENAME-STAFFNAME.notes} or
+@file{FILENAME-unnamed-staff.notes} for each staff.  Note that if
+you have multiple unnamed staves, the events for all staves will
+be mixed together in the same file.  The output looks like this:
+
+@example
+0.000   note     57       4   p-c 2 12
+0.000   dynamic  f
+0.250   note     62       4   p-c 7 12
+0.500   note     66       8   p-c 9 12
+0.625   note     69       8   p-c 14 12
+0.750   rest     4
+0.750   breathe
+@end example
+
+The syntax is a tab-delimited line, with two fixed fields on each
+line followed by optional parameters.
+
+@example
+@var{time}  @var{type}  @var{...params...}
+@end example
+
+This information can easily be read into other programs such as
+python scripts, and can be very useful for researchers wishing to
+perform musical analysis or playback experiments with LilyPond.
+
+
+@knownissues
+
+Not all lilypond music events are supported by
+@file{event-listener.ly}.  It is intended to be a well-crafted
+@qq{proof of concept}.  If some events that you want to see are
+not included, copy @file{event-listener.ly} into your lilypond
+directory and modify the file so that it outputs the information
+you want.