Peter Bjuhr wrote: > is there already a function that converts a string "4." to > the fraction '3/8', or the other-way round? I don't think you need ly:duration->string; I think you can just skip that step. And as far as I know, you do need to copy out the definition of parse-simple-duration, and above it add: #(use-modules (ice-9 regex))
The whole thing will look like this: ____________________________________________________________ #(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 (note-to-moment notestr) (let ((parsed (parse-simple-duration notestr))) (ly:duration-length (ly:make-duration (car parsed) (cadr parsed))))) ____________________________________________________________ Then you would use it like this: \set Timing.baseMoment = #(note-to-moment "4.") Hope that helps. - Mark _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user