Alright, it was a mistake on my side. Your solutions work perfectly.

Thanks a lot for your help!

Am Fr., 2. Aug. 2019 um 09:48 Uhr schrieb Urs Liska <[email protected]>:

>
>
> Am 2. August 2019 08:43:51 MESZ schrieb Nils Nommensen <
> [email protected]>:
> >That's exactly the point, I actually need the glyph name.
> >If I am noch mistaken, the alteration attribute also incorporates the
> >information of the key signature. I need to know which accidental is
> >directly in front of the notehead.
> >Therefore, the glyph name is probably what I need. However,  the line
> >
> >(write (ly:grob-property acc 'glyph-name))
> >
> >is not a string, but something else and I'm not really sure how to
> >extract
> >the string part of it. Do you have a suggestion?
>
> I'm somewhat confused now. This expression "is" not a string but the
> result of the "write" procedure, which I "nothing". If you strip off the
> "write" part you have the actual glyph name (and to reiterate: the glyph
> name is "accidentals.natural", not "natural") which you can then work with.
>
> Maybe that's not a string but a symbol (don't have a PC with me to check),
> in which case you could use the (symbol->string sym) procedure to convert
> it to a string.
>
> Urs
>
> >
> >Am Fr., 2. Aug. 2019 um 00:16 Uhr schrieb Thomas Morley <
> >[email protected]>:
> >
> >> Am Do., 1. Aug. 2019 um 15:23 Uhr schrieb Nils Nommensen
> >> <[email protected]>:
> >> >
> >> > 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
> >>
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to