lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function returning #beats and beat duration


From: Malte Meyn
Subject: Re: scheme function returning #beats and beat duration
Date: Fri, 22 Jun 2018 15:18:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0



Am 22.06.2018 um 14:46 schrieb Gianmaria Lari:
Is there any scheme function returning the number of beats and the duration of each beat of the mesure where the function is invoked?
For instance, I would like this code..

    \version "2.19.81"
    {
      \time 3/4
      \writeBeats \writeBeatDuration
      a4 b a %just some music
      \time 4/4
      \writeBeats \writeBeatDuration
      a4 b a b
      \time 2/8
      \writeBeats \writeBeatDuration
      a8 b
    }


... output:

3 4
4 4
2 8

How about this?

writeBeats = \applyContext
#(lambda (context)
   (let ((fraction (ly:context-property context 'timeSignatureFraction)))
     (display (car fraction))))

writeBeatDuration = \applyContext
#(lambda (context)
   (let ((fraction (ly:context-property context 'timeSignatureFraction)))
     (display (cdr fraction))))



reply via email to

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