lilypond-user
[Top][All Lists]
Advanced

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

Re: Writing Scheme in Lilypond to control glyph used for custom custos f


From: Thomas Morley
Subject: Re: Writing Scheme in Lilypond to control glyph used for custom custos function
Date: Mon, 8 Mar 2021 11:54:57 +0100

Am Mo., 8. März 2021 um 02:26 Uhr schrieb Matthew Fong <oxengen@gmail.com>:
>
> Hello everyone,
>
>
> I'm writing a function that places a custos after the double bar to give 
> singers an indication of the pitch of their next note. Usually, custos are 
> are used within a piece, but in chant, I have verses that are part of new 
> scores, and it is helpful to indicate the pitch of the first note.
>
>
> I wanted to custos to be consistent with the intra-piece custos as I have set 
> it up, that is,
>
>
> 1/ Notes on the ledger line up until b' use custodes.vaticana.u1 (long stem 
> up)
>
> 2/ Notes in between the ledger up until b' use custodes.vaticana.u0 (short 
> stem up)
>
> 3/ Notes on the ledger line from b' use ustodes.vaticana.d1 (long stem down)
>
> 4/ Notes in between the ledger from b' use custodes.vaticana.d0 (short stem 
> down)
>
>
> And this should work regardless of the key signature of the piece (since 
> things might get transposed).
>
>
> May I get some pointers of how the logic might be coded up?
>
>
> Here is what I have so far, with help from this list, and taken from
>
> https://lilypond.org/doc/v2.20/Documentation/notation/substitution-function-examples
>
>
> addCustos =
>
> #(define-music-function (noteList)
>
> (ly:music?)
>
> #{
>
> \tweak NoteHead.stencil #ly:text-interface::print
>
> \tweak NoteHead.font-size #3
>
> \tweak NoteHead.text \markup {
>
> \musicglyph "custodes.vaticana.u1"
>
> }
>
> \tweak Stem.stencil ##f
>
> $(first (music-pitches noteList)) 4
>
> #}
>
> )
>
>
>
> Many thanks,
> mattfong

Hi,

not sure I correctly understood your conditions...
Maybe below?

addCustos =
#(define-music-function (noteList) (ly:music?)
  #{
    \once \override NoteHead.stencil =
      #(lambda (grob)
         (let* ((style (ly:grob-property grob 'style 'vaticana))
                (staff-pos (ly:grob-property grob 'staff-position))
                (glyph
                  (format #f "custodes.~a.~a~a"
                    style
                    (if (negative? staff-pos) "u" "d")
                    (if (even? (abs staff-pos)) 0 1))))
           (grob-interpret-markup grob
             (make-musicglyph-markup glyph))))

    \once \override Stem.stencil = ##f
    \once \override Flag.stencil = ##f
    \once \override Dots.stencil = ##f
    $(first (music-pitches noteList)) 4
  #})


mus =
\relative {
  a4 b c d e f g a b c d e f g a b c
}

\new Staff
  \with { instrumentName = "Test" }
  $(make-sequential-music
    (map addCustos (extract-named-music mus 'NoteEvent)))

\relative {
  a4 b c d e f \addCustos g g a b c d e f g a b c
}

Cheers,
  Harm



reply via email to

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