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: Caagr98
Subject: Re: Function or command to omit only certain accidentals of a chord?
Date: Fri, 2 Feb 2018 13:52:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

I'm not sure if EE supports ApplyOutputEvents, but you could try something like 
this:

⋘
  \applyOutput Voice.Accidental
    #(let ((n 1))
       (lambda (grob ctx1 ctx2)
         (if (= n 0)
           (ly:grob-set-property! grob 'stencil #f))
         (set! n (1- n))))
  <as cis> % Will omit the N-th accidental (defined above; in this case 1-th, 
on the cis)
⋙

That could probably be abstracted away to a music function, but I'm uncertain 
of how grob paths work.

On 02/02/18 03:55, Stefano Troncaro wrote:
> @Jan-Peter
> 
>     /this is a feature I long to implement for quite some time. This means it 
> is not possible with the EE right now.
>     The following ideas came up to provide a solution: 1. add IDs to certain 
> elements and allow addressing elements b ID. 2. Add tweaks with a predicate, 
> e.g. at moment x, if NoteEvent has pitch cis'' add tweak./
> 
> 
> That is going to be a huge improvement!
> 
> 
> @David
> 
>     /I have seen no comment whatsoever about what you find wrong with using/
>     /\single \omit Accidental in the way I showed in the code example I gave./
> 
> 
> I'm sorry, Caagr98 proposed that solution in his/her first message, to which 
> I already replied. But I should have addressed that part of your reply 
> instead of leaving it uncommented. I apologize.
> 
> The short explanation is that I need a solution that works with Openlilylib's 
> Edition Engraver and \single \omit Accidental doesn't. This is because the 
> Edition Engraver can't yet insert a tweak inside a chord.
> 
> 
> @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 
> <http://lilypond.org/doc/v2.19/Documentation/internals/note_002dcolumn_002dinterface>
>  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?
> 
> 
> 2018-02-01 18:49 GMT-03:00 Thomas Morley <address@hidden 
> <mailto:address@hidden>>:
> 
>     2018-02-01 16:59 GMT+01:00 Stefano Troncaro <address@hidden 
> <mailto:address@hidden>>:
> 
>     > Ideally, I wanted a function
>     > that I could use with the edition-engraver to tweak target elements 
> inside
>     > chords. I framed the question around accidentals in the post above, but
>     > ultimately I hoped to be able to use the same function (or a very 
> similar
>     > one) to tweak ties of specific notes instead of being forced to use one
>     > override for the whole chord, or to tweak other properties of specific 
> notes
>     > should the need arise.
> 
>     Well, we have
>     (1) override.
>     Aplied to a chord it will work on all relevant grobs found.
>     One could define some selection, ofcourse.
>     Like:
>     command =
>     \override NoteHead.before-line-breaking =
>       #(lambda (grob)
>         (let* ((cause (ly:grob-property grob 'cause))
>                (pitch (ly:prob-property cause 'pitch))
>                (alteration (ly:pitch-alteration pitch))
>                (accidental (ly:grob-object grob 'accidental-grob)))
>         (if (and (ly:grob? accidental) (eqv? alteration 1/2))
>             (ly:grob-set-property! accidental 'stencil #f))))
> 
>     But you wrote you would prefer to address specific notes, not the whole 
> chord.
>     Therefore we have:
> 
>     (2) tweak
>     But you didn't like the already proposed
>     \single \omit Accidental
>     which _is_ a tweak
> 
>     (3) context-properties
>     basically accidentalStayle sets context-properties.
>     But ofcourse can't change other note-head-properties as you seem to like.
> 
> 
>     So I'm at a loss guessing what you desire.
> 
> 
>     Cheers,
>       Harm
> 
> 
> 
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 



reply via email to

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