lilypond-user
[Top][All Lists]
Advanced

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

"Pausing" Voice


From: Thomas Morley
Subject: "Pausing" Voice
Date: Wed, 8 Jul 2020 19:20:58 +0200

Hi all,

if temporary Voices occur, then the main Voice may not contain
rhythmic-events for the duration of those temporary Voices.
I'd like to identify where the main Voice "pauses", like in this test-code:

My_test_engraver =
#(lambda (context)
  (let* ((mus-event #f))
    (make-engraver
      (listeners
        ((rhythmic-event this-engraver event)
          (set! mus-event
                (cons
                  (ly:context-current-moment context)
                  (ly:prob-property event 'length)))))
      ((process-music this-engraver)
        (if (and mus-event
                 (equal? (ly:context-current-moment context) (car mus-event)))
            (begin
              (format #t
                "\nEvent seen starting at ~a ending at ~a"
                (car mus-event) (ly:moment-add (car mus-event) (cdr mus-event)))
              (set! mus-event #f))
            (format #t
              "\nCurrent context has no rhythmic-event starting at ~a"
              (ly:context-current-moment context)))))))
\new Voice
  \with { \consists \My_test_engraver }
  {
    b1
    R
    \new Voice d''
    s
    << e' \\ c' >>
    r
  }

==>
Event seen starting at #<Mom 0> ending at #<Mom 1>
Event seen starting at #<Mom 1> ending at #<Mom 2>
Current context has no rhythmic-event starting at #<Mom 2>
Event seen starting at #<Mom 3> ending at #<Mom 4>
Current context has no rhythmic-event starting at #<Mom 4>
Event seen starting at #<Mom 5> ending at #<Mom 6>
Current context has no rhythmic-event starting at #<Mom 6>

Questions
(a) Is there a better possibility than calculating, based on
current-moment and 'length of the event?
(b) Are there other possibilities where a Voice-context "pauses"? I.e.
staying alive, but not containing rhythmic-events?

Thanks,
  Harm



reply via email to

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