lilypond-user
[Top][All Lists]
Advanced

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

Re: Find out denominator of current time signature


From: Thomas Weber
Subject: Re: Find out denominator of current time signature
Date: Thu, 12 Jan 2017 11:26:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

11.01.2017 um 18:46 schrieb Malte Meyn:
You can get the duration from the context property timeSignatureFraction
or baseMoment:

%%%%%
\version "2.19.53"

{
   \time 12/8
   \applyContext
   #(lambda (context)
      (display (ly:context-property
                     context
                     'baseMoment)))
                     %'timeSignatureFraction)))
}
%%%%%

I don’t know how you can make a music function that uses this and
returns music. \applyContext #(lambda (context) (make-music …)) has no
visible output. But maybe it’s a start.



That's definitely going into the right direction - many thanks. I tried this:


    \new Staff <<
      {
        c'4 d'4 e'4 f'4
      }
      {
        \applyContext
          #(lambda (context)
            (make-music
              'SkipEvent
              'articulations
                (list (make-music
                  'AbsoluteDynamicEvent
                  'text
                  "ff"))
              'duration
                (ly:make-duration 0 0 1 (cdr (ly:context-property
                  context
                  'timeSignatureFraction)))))
      }
    >>


which is apparently valid, but the created skip event is not inserted into the 
music (which your reply already suggested).  I guess the problem boils down to 
how to get hold of the context without \applyContext.



reply via email to

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