lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function or command to omit only certain accidentals of a chord?


From: Thomas Morley
Subject: Re: Function or command to omit only certain accidentals of a chord?
Date: Fri, 2 Feb 2018 10:54:59 +0100

2018-02-02 3:55 GMT+01:00 Stefano Troncaro <address@hidden>:

> @Thomas
> I was not aware that it was possible to write a function inside of a
> parameter of a grob, and that before-line-breaking and after-line-breaking
> served this purpose. The documentation describes them as booleans and "dummy
> properties" so I never payed them mind. I'm truly surprised. When I said
> that I didn't believe an override would do it I wasn't considering an
> "intelligent" override. Something like this could actually work!
>
> After looking a bit through the documentation, I found here that the the
> note-column-interface has a note-heads property, which provides an array of
> all the note-head grobs of the NoteColumn. I wanted to go through that list
> and modify the grobs according to their position on the list, but I am
> unable to get the list in the first place:
>>
>> \version "2.19.80"
>> \language "english"
>>
>> command = {
>>   \once \override NoteColumn.before-line-breaking =
>>     #(lambda (this-column)
>>         (display (ly:grob-property this-column 'note-heads "couldn't find
>> it")))
>> }
>>
>> \score {
>>   \new Staff {
>>     \new Voice \relative c'' {
>>       \key b \minor \accidentalStyle modern
>>       \partial 4 <as c,> |
>>       <b b,> \command <a cs,> <g d~> <fs d>
>>     }
>>   }
>> }
>
> Do you think this is possible?

Sure:

\version "2.19.80"
\language "english"

command =
  \once \override NoteColumn.before-line-breaking =
    #(lambda (this-column)
      (let* ((nhs (ly:grob-object this-column 'note-heads)))

        (if (ly:grob-array? nhs)
            (begin
              ;; array
              (pretty-print nhs)
              ;; first entry of array
              (pretty-print (ly:grob-array-ref nhs 0))
              ;; list, suitable for (map ...) and friends
              (pretty-print (ly:grob-array->list nhs))))

        ))

\score {
  \new Staff {
    \new Voice \relative c'' {
      \key b \minor \accidentalStyle modern
      \partial 4 <as c,> |
      <b b,> \command <a cs,> <g d~> <fs d>
    }
  }
}

HTH,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]