Tom Hall <reg <at> ludions.com> writes: > > > OK, I'll do it this way, the arguments to the music-fn are now strings and not > integers, so no integer-> string conversion needed. It would be better to still > use integers and then pad a 0 where required, but I'm not sure how to do this.
Use the format procedure. You can read more about the format procedure at the Guile reference manual: http://www.gnu.org/software/guile/manual/html_node/ Formatted-Output.html#Formatted-Output LilyPond uses a simplified version of the format procedure to reduce calculation time. If the output you want is not supported by the lilypond format (roman numerals, for example), you can get the full format procedure in lilypond by calling fancy-format. stopwatch = #(define-music-function (parser location minutes seconds) (integer? integer?) "Put the time given by @var{minutes} and @var{seconds} in a rounded box." (let ((pretty-seconds (format #f "~2,'0d" seconds)) (minutes-string (number->string minutes))) #{ \mark \markup \rounded-box \small \concat { $minutes-string \char ##x2032 $pretty-seconds \char ##x2033 } #})) { c'1 \stopwatch #4 #3 c' \stopwatch #2 #45 c' } HTH, Carl _______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
