|
From: | Nils Nommensen |
Subject: | Re: Accidentals from note grob |
Date: | Fri, 2 Aug 2019 08:43:51 +0200 |
Am Do., 1. Aug. 2019 um 15:23 Uhr schrieb Nils Nommensen
<address@hidden>:
>
> Sorry to bother you with this, but I'm really new to Lilypond and Scheme. I need a String representation of the name. If I use display on the return value, I get something like: "accidentals.natural"#<unspecified>".
> How can I extract the "natural" part?
Well, it's not clear what you want.
"accidentals.natural" _is_ the glyph-name in the Emmentaler-font.
Ofcourse you could do some string-operation on it to get the
"natural", but I have my doubts this would be helpfull.
Probably you don't want the glyph-name displayed, but rather see
whether there is some (which) alteration:
\version "2.19.83"
#(define get-accidental
(lambda (note)
(let* ((acc (ly:grob-object note 'accidental-grob))
(alt (ly:grob-property acc 'alteration)))
(newline)
(write
(case alt
((-1) "double-flat")
((-1/2) "flat")
((0) "natural")
((1/2) "sharp")
((1) "double-sharp")
(else (format #f "not yet kown alteration: ~a" alt)))
))))
{
\override NoteHead.after-line-breaking = #get-accidental
ceses'
ces'
c'
cis'
cisis'
ceh'
}
HTH,
Harm
[Prev in Thread] | Current Thread | [Next in Thread] |