lilypond-user
[Top][All Lists]
Advanced

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

Re: Help with correct pitch after function call within \relative


From: Artur Dobija
Subject: Re: Help with correct pitch after function call within \relative
Date: Mon, 8 Jan 2024 23:57:34 +0100

Dear Lilypond-user, 
I sent this mail to the wrong mail, I should have send it to lilypond-user-request@gnu.org ! Sorry!
Best,
Artur Dobija

pon., 8 sty 2024 o 23:56 Artur Dobija <arturdobija@gmail.com> napisał(a):
Dear Experts,

I am working on writing my own function which combines several notes into one custom symbol (ligature).
(For the context, I now about Mensural_ligature_engraver, but I want to create something that will allow for more flexibility, as I try to engrave symbols as close to one of different manuscripts from different eras and by different hands)

My code is like:
\relative { a \customLigatura { b c d } f }

In my approach, I want to remove all the notes except the first, which will receive the ligature stencil.
I need to *remove* them, not only hide, because if they are still there, they still heavily affect the spacing in unexpected ways!
What I ask you is: how to remove notes "c" and "d" in such a way, that it would not mess up the relative mode and think, that the note "f" is calculated from the note "d" (otherwise it will be octave lower)? The function is agnostic of the pitch before and pitch after.

What I tried:
– \resetRelativeOctave
– setting to-relative-callback note property to ##f

customLigatura =
#(define-music-function
  (music)
  (ly:music?)

  (let ((notes (list)) ; notes participating in ligature creation: pitch, duration, shape (square, punctum, obliqua, pes, )
        (total-duration (make-duration-of-length (ly:music-length music))))
   
    ; get all those notes only that will form ligature's stencil
    (for-some-music
      (lambda (m)
       (if (equal? (ly:music-property m 'name) 'NoteEvent)
         (set! notes
               (append notes
                      (list (make-music
                        'NoteEvent
                        'pitch (ly:music-property m 'pitch)
                        'duration (ly:music-property m 'duration)
                  'mensural-ligature-shape (ly:music-property m 'mensural-ligature-shape)))))
         #f))
      music)

  #{
      \once \override MensuralVoice.NoteHead.stencil = #ly:text-interface::print
      \once \override MensuralVoice.NoteHead.text = \markup \translate #'(0 . -0.5) "Ligatura" % this will be my stencil.

     % only the first note with new stencil must be printed
      #(make-music
         'NoteEvent
         'duration total-duration
         'pitch (ly:music-property (list-ref notes 0) 'pitch))

    %{************************************************************
           What goes here to trick the relative mode to think
          that it must calculate the pitch from the LAST note
          (and not the given note)?
           something like: \countRelativeFrom d

      I tried:
  (ly:make-music-relative! music (ly:make-pitch
                                                     -1
                                                     (quotient
                                                     (ly:pitch-steps (ly:make-pitch 1 0))
                                                     2)))
  \resetRelativeOctave #(last (music-pitches music))
    ************************************************************%}
  #}))

% TESTS
<<
\new MensuralStaff \new MensuralVoice \relative { \clef F g,1 \ligatura { a a' c,, g''} a }
\new MensuralStaff \new MensuralVoice \relative { \clef F g,1 a a' c,, g'' a }
>>
<<
\new MensuralStaff \new MensuralVoice \relative { a1 \ligatura { b c d } f }
\new MensuralStaff \new MensuralVoice \relative { a1 b c d f }
>>

% ArturJD, Engraving Chant, https://www.instagram.com/engraving.chant/


reply via email to

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