]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/transcription-of-ancient-music-with-incipit.ly
Fix references when using --use-source-file-names (issue 4046)
[lilypond.git] / Documentation / snippets / transcription-of-ancient-music-with-incipit.ly
index de79faf66012b65c3a1dd0f608453e56e7170ebc..28ae9b4451851c1f7fb53620aed204c127bc603d 100644 (file)
@@ -1,25 +1,13 @@
 %% DO NOT EDIT this file manually; it is automatically
-%% generated from LSR http://lsr.dsi.unimi.it
+%% generated from LSR http://lsr.di.unimi.it
 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
 %% and then run scripts/auxiliar/makelsr.py
 %%
 %% This file is in the public domain.
-\version "2.12.2"
+\version "2.18.0"
 
 \header {
-  lsrtags = "ancient-notation, tweaks-and-overrides"
-
-%% Translation of GIT committish: 59caa3adce63114ca7972d18f95d4aadc528ec3d
-  texidoces = "
-A modo de alternativa para obtener auténticos «incipit»
-independientes de la partitura principal, se incluyen como
-elemento de marcado en el campo que se usa normalmente para el
-nombre del instrumento. Por el momento, la letra sólo se puede
-añadir como marcado directo. Por desgracia, su espaciado no es
-análogo al de la letra principal.
-
-"
-  doctitlees = "Transcripción de música antigua con incipit"
+  lsrtags = "ancient-notation, specific-notation, tweaks-and-overrides, workaround"
 
   texidoc = "
 As a workaround to get real incipits which are independent from the
@@ -32,28 +20,80 @@ main lyrics.
   doctitle = "Transcription of Ancient music with incipit"
 } % begin verbatim
 
+incipit =
+#(define-music-function (parser location incipit-music) (ly:music?)
+  #{
+    \once \override Staff.InstrumentName.self-alignment-X = #RIGHT
+    \once \override Staff.InstrumentName.self-alignment-Y = ##f
+    \once \override Staff.InstrumentName.padding = #0.3
+    \once \override Staff.InstrumentName.stencil =
+      #(lambda (grob)
+         (let* ((instrument-name (ly:grob-property grob 'long-text)))
+          (set! (ly:grob-property grob 'long-text)
+           #{ \markup
+              \score
+              {
+                { \context MensuralStaff \with {
+                  instrumentName = #instrument-name
+                } $incipit-music
+              }
+              \layout { $(ly:grob-layout grob)
+                line-width = \indent
+                indent =
+                 % primitive-eval is probably easiest for
+                 % escaping lexical closure and evaluating
+                 % everything respective to (current-module).
+                   #(primitive-eval
+                     '(or (false-if-exception (- indent incipit-width))
+                        (* 0.5 indent)))
+                ragged-right = ##f
+                ragged-last = ##f
+                system-count = #1 }
+              }
+          #})
+           (system-start-text::print grob)))
+  #})
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
+
 global = {
   \set Score.skipBars = ##t
   \key g \major
   \time 4/4
-  %make the staff lines invisible on staves
-  \override Staff.BarLine #'transparent = ##t
-  \skip 1*8 % the actual music
+
+  % the actual music
+  \skip 1*8
+
   % let finis bar go through all staves
-  \override Staff.BarLine #'transparent = ##f
+  \override Staff.BarLine.transparent = ##f
+
   % finis bar
   \bar "|."
 }
 
+discantusIncipit = <<
+  \new MensuralVoice = "discantusIncipit" <<
+    \repeat unfold 9 { s1 \noBreak }
+    {
+      \clef "neomensural-c1"
+      \key f \major
+      \time 2/2
+      c''1.
+    }
+  >>
+  \new Lyrics \lyricsto discantusIncipit { IV- }
+>>
+
 discantusNotes = {
   \transpose c' c'' {
-    \clef treble
+    \clef "treble"
     d'2. d'4 |
     b e' d'2 |
     c'4 e'4.( d'8 c' b |
     a4) b a2 |
     b4.( c'8 d'4) c'4 |
-    \once \override NoteHead #'transparent = ##t c'1 |
+    \once \hide NoteHead
+    c'1 |
     b\breve |
   }
 }
@@ -68,53 +108,103 @@ discantusLyrics = \lyricmode {
   -us. |
 }
 
+altusIncipit = <<
+  \new MensuralVoice = "altusIncipit" <<
+    \repeat unfold 9 { s1 \noBreak }
+    {
+      \clef "neomensural-c3"
+      \key f \major
+      \time 2/2
+      r1 f'1.
+    }
+  >>
+  \new Lyrics \lyricsto altusIncipit { IV- }
+>>
+
 altusNotes = {
   \transpose c' c'' {
-    \clef treble
-    r2 g2. e4 fis g | % two bars
+    \clef "treble"
+    % two measures
+    r2 g2. e4 fis g |
     a2 g4 e |
     fis g4.( fis16 e fis4) |
     g1 |
-    \once \override NoteHead #'transparent = ##t g1 |
+    \once \hide NoteHead
+    g1 |
     g\breve |
   }
 }
 
 altusLyrics = \lyricmode {
-  Ju -- bi -- la -- te | % two bars
+  % two measures
+  Ju -- bi -- la -- te |
   De -- o, om -- |
   nis ter -- ra, |
   "..." |
   -us. |
 }
 
+tenorIncipit = <<
+  \new MensuralVoice = "tenorIncipit" <<
+    \repeat unfold 9 { s1 \noBreak }
+    {
+      \clef "neomensural-c4"
+      \key f \major
+      \time 2/2
+      r\longa
+      r\breve
+      r1 c'1.
+    }
+  >>
+  \new Lyrics \lyricsto tenorIncipit { IV- }
+>>
+
 tenorNotes = {
   \transpose c' c' {
     \clef "treble_8"
     R1 |
     R1 |
     R1 |
-    r2 d'2. d'4 b e' | % two bars
-    \once \override NoteHead #'transparent = ##t e'1 |
+    % two measures
+    r2 d'2. d'4 b e' |
+    \once \hide NoteHead
+    e'1 |
     d'\breve |
   }
 }
 
 tenorLyrics = \lyricmode {
-  Ju -- bi -- la -- te | % two bars
+  % two measures
+  Ju -- bi -- la -- te |
   "..." |
   -us.
 }
 
+bassusIncipit = <<
+  \new MensuralVoice = "bassusIncipit" <<
+    \repeat unfold 9 { s1 \noBreak }
+    {
+      \clef "bass"
+      \key f \major
+      \time 2/2
+      %% incipit
+      r\maxima
+      f1.
+    }
+  >>
+  \new Lyrics \lyricsto bassusIncipit { IV- }
+>>
+
 bassusNotes = {
   \transpose c' c' {
-    \clef bass
+    \clef "bass"
     R1 |
     R1 |
     R1 |
     R1 |
     g2. e4 |
-    \once \override NoteHead #'transparent = ##t e1 |
+    \once \hide NoteHead
+    e1 |
     g\breve |
   }
 }
@@ -125,176 +215,64 @@ bassusLyrics = \lyricmode {
   -us.
 }
 
-incipitDiscantus = \markup {
-  \score {
-    {
-      \set Staff.instrumentName = #"Discantus "
-      \override NoteHead #'style = #'neomensural
-      \override Rest #'style = #'neomensural
-      \override Staff.TimeSignature #'style = #'neomensural
-      \cadenzaOn
-      \clef "neomensural-c1"
-      \key f \major
-      \time 2/2
-      c''1._"IV-" s2  %two bars
-      \skip 1*8 % eight bars
-    }
-    \layout {
-      \context {
-        \Voice
-        \remove "Ligature_bracket_engraver"
-        \consists "Mensural_ligature_engraver"
-      }
-      line-width = 4.5\cm
-    }
-  }
-}
-
-incipitAltus = \markup {
-  \score {
-    {
-      \set Staff.instrumentName = #"Altus "
-      \override NoteHead #'style = #'neomensural
-      \override Rest #'style = #'neomensural
-      \override Staff.TimeSignature #'style = #'neomensural
-      \cadenzaOn
-      \clef "neomensural-c3"
-      \key f \major
-      \time 2/2
-      r1        % one bar
-      f'1._"IV-" s2   % two bars
-      \skip 1*7 % seven bars
-    }
-    \layout {
-      \context {
-        \Voice
-        \remove "Ligature_bracket_engraver"
-        \consists "Mensural_ligature_engraver"
-      }
-      line-width = 4.5\cm
-    }
-  }
-}
-
-incipitTenor = \markup {
-  \score {
-    {
-      \set Staff.instrumentName = #"Tenor  "
-      \override NoteHead #'style = #'neomensural
-      \override Rest #'style = #'neomensural
-      \override Staff.TimeSignature #'style = #'neomensural
-      \cadenzaOn
-      \clef "neomensural-c4"
-      \key f \major
-      \time 2/2
-      r\longa   % four bars
-      r\breve   % two bars
-      r1        % one bar
-      c'1._"IV-" s2   % two bars
-      \skip 1   % one bar
-    }
-    \layout {
-      \context {
-        \Voice
-        \remove "Ligature_bracket_engraver"
-        \consists "Mensural_ligature_engraver"
-      }
-      line-width = 4.5\cm
-    }
-  }
-}
-
-incipitBassus = \markup {
-  \score {
-    {
-      \set Staff.instrumentName = #"Bassus  "
-      \override NoteHead #'style = #'neomensural
-      \override Rest #'style = #'neomensural
-      \override Staff.TimeSignature #'style = #'neomensural
-      \cadenzaOn
-      \clef "bass"
-      \key f \major
-      \time 2/2
-      % incipit
-      r\maxima  % eight bars
-      f1._"IV-" s2    % two bars
-    }
-    \layout {
-      \context {
-        \Voice
-        \remove "Ligature_bracket_engraver"
-        \consists "Mensural_ligature_engraver"
-      }
-      line-width = 4.5\cm
-    }
-  }
-}
-
-%StaffGroup is used instead of ChoirStaff to get bar lines between systems
 \score {
   <<
     \new StaffGroup = choirStaff <<
       \new Voice = "discantusNotes" <<
         \global
-        \set Staff.instrumentName = \incipitDiscantus
+        \set Staff.instrumentName = #"Discantus "
+        \incipit \discantusIncipit
         \discantusNotes
       >>
       \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
-
       \new Voice = "altusNotes" <<
         \global
-        \set Staff.instrumentName = \incipitAltus
+        \set Staff.instrumentName = #"Altus "
+        \incipit \altusIncipit
         \altusNotes
       >>
       \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics }
-
       \new Voice = "tenorNotes" <<
         \global
-        \set Staff.instrumentName = \incipitTenor
+        \set Staff.instrumentName = #"Tenor "
+        \incipit \tenorIncipit
         \tenorNotes
       >>
       \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
-
       \new Voice = "bassusNotes" <<
         \global
-        \set Staff.instrumentName = \incipitBassus
+        \set Staff.instrumentName = #"Bassus "
+        \incipit \bassusIncipit
         \bassusNotes
       >>
+      \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
     >>
-    \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
-    %Keep the bass lyrics outside of the staff group to avoid bar lines
-    %between the lyrics.
   >>
-
   \layout {
     \context {
       \Score
-      % no bars in staves
-      \override BarLine #'transparent = ##t
+      %% no bar lines in staves or lyrics
+      \hide BarLine
     }
-    % the next three instructions keep the lyrics between the bar lines
+    %% the next two instructions keep the lyrics between the bar lines
     \context {
       \Lyrics
       \consists "Bar_engraver"
-      \override BarLine #'transparent = ##t
-    }
-    \context {
-      \StaffGroup
       \consists "Separating_line_group_engraver"
     }
     \context {
       \Voice
-      % no slurs
-      \override Slur #'transparent = ##t
-      % Comment in the below "\remove" command to allow line
-      % breaking also at those barlines where a note overlaps
-      % into the next bar.  The command is commented out in this
-      % short example score, but especially for large scores, you
-      % will typically yield better line breaking and thus improve
-      % overall spacing if you comment in the following command.
-      %\remove "Forbid_line_break_engraver"
+      %% no slurs
+      \hide Slur
+      %% Comment in the below "\remove" command to allow line
+      %% breaking also at those bar lines where a note overlaps
+      %% into the next measure.  The command is commented out in this
+      %% short example score, but especially for large scores, you
+      %% will typically yield better line breaking and thus improve
+      %% overall spacing if you comment in the following command.
+      %%\remove "Forbid_line_break_engraver"
     }
-    indent = 5\cm
+    indent = 6\cm
+    incipit-width = 4\cm
   }
 }
-