Hi Aaron,
The three forms

 * \tempo 4 = 96
 * \tempo Crazy 4 = 260-270
 * \tempo "Sluggishly slow"

are hardcoded as variants into the parser. My guess is that this might
be hard (or impossible) to accomplish in a music function.

You just need to be a little creative.
That's what I hoped would happen. :-) If I understand it correctly, both the genius and the drawback of your solution lies in having the user write an explicit "\tempo" in order to invoke the parser's hard-wired way of dealing with the possible syntax variants, right?
%%%%
\version "2.20.0"

#(define (tempo? arg)
  (and (ly:music? arg)
       (not (null? (extract-typed-music arg 'tempo-change-event)))))

Maybe I'm overly cautious, but I'd prefer this to be more specific so that it accepts only actual "\tempo ..."-constructs. For example:

#(use-modules (scm display-lily)) #(define (tempo? arg)   (and (ly:music? arg)        (string-startswith (music->lily-string test) "\\tempo")))

This is probably an awful waste of computing effort, but I liked it better than checking for the kind-of special internal structure of a music expression containing only a \tempo (namely, a sequential-music containing both a TempoChangeEvent and a PropertySet specced to context Score.)

Lukas

Reply via email to