lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can LilyPond do incipits?


From: Aaron Dalton
Subject: Re: Can LilyPond do incipits?
Date: Sun, 21 Nov 2010 20:42:35 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 11/21/2010 8:11 PM, Patrick Karl wrote:
> I'm trying to duplicate in LilyPond a very ugly photocopied piece of
> music, which was handed out in an Early Music workshop, which includes
> "incipits".  Does LilyPond do incipits?  The only thing I find in the
> v2.12 NR is:

Yes, it can do beautiful incipits. I place the following code at the top
of the file (retrieved from the snippets repository):

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 = #UP
    \once \override Staff.InstrumentName #'Y-offset = #4
    \once \override Staff.InstrumentName #'padding = #0.3
    \once \override Staff.InstrumentName #'stencil =
    #(lambda (grob)
       (let* ((instrument-name (ly:grob-property grob 'long-text))
              (layout (ly:output-def-clone (ly:grob-layout grob)))
              (music (make-music 'SequentialMusic
                      'elements (list (make-music 'ContextSpeccedMusic
                                        'context-type 'MensuralStaff
                                        'element (make-music 'PropertySet
                                                   'symbol 'instrumentName
                                                   'value instrument-name))
                                      $incipit-music)))
              (score (ly:make-score music))
              (mm (ly:output-def-lookup layout 'mm))
              (indent (ly:output-def-lookup layout 'indent))
              (width (ly:output-def-lookup layout 'incipit-width))
              (incipit-width (if (number? width)
                                 (* width mm)
                                 (* indent 0.5))))
         (ly:output-def-set-variable! layout 'indent (- indent
incipit-width))
         (ly:output-def-set-variable! layout 'line-width indent)
         (ly:output-def-set-variable! layout 'ragged-right #f)
         (ly:output-def-set-variable! layout 'ragged-last #f)
         (ly:output-def-set-variable! layout 'system-count 1)
         (ly:score-add-output-def! score layout)
         (set! (ly:grob-property grob 'long-text)
               (markup #:score score))
         (ly:system-start-text::print grob)))
  #})

Then something like the following:

        cantusIncipit = <<
  \new MensuralVoice = cantusIncipit <<
    \repeat unfold 9 { s1 \noBreak }
    {
          \override Rest #'style = #'neomensural
      \clef "neomensural-c1"
      \key c \major
      \time 2/2
      r2 a'2
    }
  >>

Then finally in the \score:

\new Voice = "cantus" <<
        \incipit \cantusIncipit
        \cantusMusic
>>
\new Lyrics \lyricsto "cantus" \cantusLyrics

Aaron

P.S. I tried to send a PDF of a single page, but it was apparently too
big. You can see the incipits in a modern edition I did at
http://hdl.handle.net/1880/47815








reply via email to

[Prev in Thread] Current Thread [Next in Thread]