Hi Alexander,
On 11/04/2008, Alexander Kobel <[EMAIL PROTECTED]> wrote:
> I think there's another drawback of the snippet.
> I had a very similar problem, trying to add marks like "Moderato (* =
> 63)", yet using rehearsal marks at the same time for sectioning the piece.
> Problem is, Lily can't handle two RehearsalMark events on the same beat
> (don't know whether there's a workaround), so I wanted to use
> MetronomeMarks. Here's my snippet to do so; I suspect it should be
> fairly straightforward to modify to mimic the rhythmMark behaviour.
I hope you don't mind, but I've added your snippet to the LSR as
"Adding a text indication to metronome marks". Unfortunately, it
doesn't work under 2.10, so it's waiting for LSR to move to 2.11 (and
the nod from Valentin to approve it).
> Of course it would be nice if the \tempo command would be run directly
> in \tempoChangeMarkup; however I'm running into type problems here.
> Is it possible to convert string->duration via Scheme? Else I always had
> to type
> \tempoChangeMarkup #"foo" #(make-duration 4) #"120"
> or am I wrong there?
There's a function in define-markup-commands.scm called
parse-simple-duration which will convert a duration string to a list.
You can then just use ly:make-duration to turn the list elements into
a duration:
#(use-modules (ice-9 regex))
#(define (parse-simple-duration duration-string)
"Parse the `duration-string', e.g. ''4..'' or ''breve.'', and return
a (log dots) list."
(let ((match (regexp-exec (make-regexp
"(breve|longa|maxima|[0-9]+)(\\.*)") duration-string)))
(if (and match (string=? duration-string (match:substring match 0)))
(let ((len (match:substring match 1))
(dots (match:substring match 2)))
(list (cond ((string=? len "breve") -1)
((string=? len "longa") -2)
((string=? len "maxima") -3)
(else (log2 (string->number len))))
(if dots (string-length dots) 0)))
(ly:error (_ "not a valid duration string: ~a") duration-string))))
#(define (string-to-duration duration)
(let ((parsed (parse-simple-duration duration)))
(ly:make-duration (car parsed) (cadr parsed)))
)
I think the main problem is how to set tempoWholesPerMinute, unless
you're not bothered about MIDI output.
Regards,
Neil
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user