lilypond-user
[Top][All Lists]
Advanced

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

Re: How to extract the current time signature


From: tisimst
Subject: Re: How to extract the current time signature
Date: Thu, 22 Jan 2015 06:17:26 -0700 (MST)

Harm,


Thomas Morley-2 wrote
> Maybe:
> 
> \version "2.19.15"
> 
> printTimeSignatureFraction =
> \applyContext #(lambda (ctx)
>   (let* ((context
>            (ly:context-property-where-defined ctx 'timeSignatureFraction))
>          (time-sig-frac
>            (ly:context-property context 'timeSignatureFraction)))
>   (display time-sig-frac)))
> 
> \relative c' {
>     \time 3/2
>     \printTimeSignatureFraction % => (3 . 2)
>     c''1
>         \compoundMeter #'((1 4) (3 8))
>     \printTimeSignatureFraction % => (5 . 8) !!
>         \repeat unfold 5 c8 \repeat unfold 10 c16
> }
> 
> Though the compound TimeSig will return "summarized"
> 
> Cheers,
>   Harm

That works great! Thanks so much for your help. Perhaps I should have
mentioned it in the original post, but I'd like to be able to use the values
in time-sig-frac to automatically make a MultiMeasureRest with the duration
of the full measure, but when I attempt to do so, nothing gets added to my
score. Here's my latest and greatest:

%<------------------------------

\version "2.18.2" 

autoMMR = 
\applyContext #(lambda (ctx) 
  (let* ((context 
           (ly:context-property-where-defined ctx 'timeSignatureFraction)) 
         (time-sig-frac 
           (ly:context-property context 'timeSignatureFraction))
         (num (car time-sig-frac))
         (den (cdr time-sig-frac)))
    (make-music 'MultiMeasureRestMusic
       'duration
       (ly:make-duration 0 0 num den)
       'articulations
       '())
)) 

\relative c' { 
  \time 3/2 
  \autoMMR
  c'1. 

  \compoundMeter #'((1 4)(3 8)) 
  \autoMMR
  \repeat unfold 5 c8 \repeat unfold 10 c16 
}

%<------------------------------

I know that applyContext creates its own "(make-music ..." block, so maybe
there's some scoping issue I'm not aware of. Any further help would be
greatly appreciated!

-Abraham



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/How-to-extract-the-current-time-signature-tp170857p170865.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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