lilypond-user
[Top][All Lists]
Advanced

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

Re: passing a duration expression the \tempo function


From: Neil Puttock
Subject: Re: passing a duration expression the \tempo function
Date: Sun, 24 Oct 2010 12:57:22 +0100

On 11 October 2010 10:31, Steve Yegge <address@hidden> wrote:

> Is there a succinct way to do it?

Sort of...

\version "2.13.36"

baseTempo = 50

myTempo =
#(define-music-function (parser location dur count) (ly:music? integer?)
   ;; `tempo' is the syntax constructor (defined in
scm/ly-syntax-constructors.scm)
   ;; used by the parser when parsing \tempo [text] dur = count
   (tempo parser location #f
          (ly:music-property
           (car (extract-named-music dur 'SkipEvent)) 'duration)
          count))

\relative c' {
  \myTempo s4 #baseTempo
  c1
  \myTempo s4 #(* 2 baseTempo)
  c1
}

You have to brew your own music function here since the parser expects
a bare number for the count (which can't be stored in an identifier).

Cheers,
Neil



reply via email to

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