lilypond-user
[Top][All Lists]
Advanced

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

Re: Stopwatch time in markup


From: Mark Polesky
Subject: Re: Stopwatch time in markup
Date: Sun, 25 Jan 2009 12:05:53 -0800 (PST)

Tom Hall wrote:
> This works well for most times, except when secs <10
> 
> { c'1 \timestamp #4 #03 c' }
> 
> Here 03 gets passed in as an integer of 3 I guess
> so the result looks not so good: 4"3'
> 
> WOuld you know how to add to the func a way to pad a zero 
> in case of situations like the above?

Whoops.

_____________________________________________________________


\version "2.12.1"

%{
%% paranoid version:
timestamp =
#(define-music-function (parser location minutes seconds) (number? number?)
   (let* ((tens (if (< seconds 10) "0" ""))
          (min  (number->string minutes))
          (sec  (string-append tens (number->string seconds))))
    #{ \mark \markup \rounded-box \small \concat
        { $min \char ##x2032 $sec \char ##x2033 } #}))
%}

timestamp =
#(define-music-function (parser location minutes seconds) (number? number?)
   (let* ((tens (if (< seconds 10) "0" ""))
          (min  (number->string minutes))
          (sec  (string-append tens (number->string seconds))))
    #{ \mark \markup \rounded-box \small \concat { $min ′ $sec ″ } #}))

{ c'1 \timestamp #4 #03 c' \timestamp #4 #33 c' }

_____________________________________________________________


- Mark








reply via email to

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