Ok, the following somewhat naive approach which treats music and markup expressions sort of like cut&pasteable strings falls apart horribly.
How do I do this sort of thing properly? The goal is to be able to write something like \Discant #130 and get an accordion discant symbol with 1 dot at the top, 3 in the middle, and none in the bottom. There is a slight twist where the digits 4 5 6 7 in the middle place deliver asymmetric one- and two-dot patterns (those are sometimes used to indicate different configurations on special instruments). But that just pertains to the right-dot formula and is not really relevant for the problem.
discant = \markup { \musicglyph #"accordion.accDiscant" } dot = \markup { \musicglyph #"accordion.accDot" } Discant = #(define-music-function (parser location code) (number?) (let* ((piccolo (if (zero? (modulo code 100)) #{ #} #{ \combine \raise #2.5 \dot #})) (left (if (even? (quotient code 20)) #{ #} #{ \combine \translate #'(-1 . 0) \raise #1.5 \dot #})) (middle (if (even? (quotient code 10)) #{ #} #{ \combine \raise #1.5 \dot #})) (right (if (eq? (even? (quotient code 20)) (even? (quotient code 40))) #{ #} #{ \combine \translate #'(1 . 0) \raise #1.5 \dot #})) (bass (if (even? code) #{ #} #{ \combine \raise #0.5 \dot #}))) #{ ^\markup { $piccolo $left $middle $right $bass discant } #})) \layout { ragged-right = ##t } \score { \relative c' { c\Discant #131 d \Discant #11 }}
-- David Kastrup
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user