|
From: | Matt Hood |
Subject: | What is the proper way of programmatically generating markup? |
Date: | Sun, 24 Apr 2016 13:00:17 +1000 |
Hi everyone, So I’m writing a function that reimplements the ‘\compoundMeter’ command with an Orff-style time signature, whereby the denominator of the signature is a note head (as opposed to a number), e.g. 4/4 = 4/crotchet, 9/8 = 3/dotted-crotchet, 15/16+2/4 = 5/dotted-quaver + 2/crotchet. I’ve been able to implement the first two cases, i.e. no additive signatures, but I’d like to make the third example work. **My first question is: does anyone know where can I find the source (scm or otherwise) for \compoundMeter? I can’t find it in the ‘share/scm’ folder. I feel like it would be helpful to reference.** My attempts to make this work have involved trying to generate the markup using foreach loops, that crawl through a list of lists that might look like: ( (3 3 (ly:make-duration 3 1)) (4 (ly:make-duration 2)) ) which would be equal to: (9+9/16)+(4/4). All elements except for the last of each loop are numerators, while the last is the denominator. ----------------- This is the scheme code doing the work (not finished, but the basics should work?). The list-of-lists is referred to as ‘durs': \version “2.18.2" ... (markup (#:line ( for-each (lambda (x) (markup "+") ( #:center-column ;; Numerator Markup. The list supplied to the for-each loop doesn’t contain the duration. [“(cdr (reverse x))”] (#:line (for-each (lambda (y) ( ( markup "+") (#:number (number->string y) ) ) ) (cdr (reverse x)) ) ) ;; Denominator markup. (#:note-by-number (ly:duration-log (car (reverse x))) (ly:duration-dot-count (car (reverse x))) DOWN ) ) ) durs ) ) ) This haphazard collection of markup needs to somehow fit into: \override Score.TimeSignature #'text = which accepts ‘markup’, singular, only. This throws errors such as: warning: type check for `stencil' failed; value `#<unspecified>' must be of type `stencil' ------------------ **So my second question is: How do I programmatically generate markup from information taken from a list, and then put it into a single markup variable?** Any help at all would be greatly appreciated. Cheers, Matt. |
[Prev in Thread] | Current Thread | [Next in Thread] |