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

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

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

Stefano Troncaro
Hello again everyone!

Suppose I have the following example:
\version "2.19.80"
\language "english"

command = {
  %What should go here to omit the sharp while keeping the natural?
}

\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> 
    }
  }
}
If for whatever reason I wanted to omit the sharp while keeping the natural sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a loss as to how to tackle this problem, and looking through the documentation hasn't helped.

Does anyone have an idea?
Stéfano

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

caagr98
You could try \single instead of \once, as in <a \single \omit Accidental cs,>.

On 01/31/18 21:27, Stefano Troncaro wrote:

> Hello again everyone!
>
> Suppose I have the following example:
>
> \version "2.19.80" \language "english" command = { %What should go here to omit the sharp while keeping the natural? } \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>
>     } } }
>
> If for whatever reason I wanted to omit the sharp while keeping the natural sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a loss as to how to tackle this problem, and looking through the documentation hasn't helped.
>
> Does anyone have an idea?
> Stéfano
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Stefano Troncaro
I just tried it, but unfortunately it appears to only work when used inside the chord, and I need to find a way to do it from outside.

2018-01-31 17:39 GMT-03:00 Caagr98 <[hidden email]>:
You could try \single instead of \once, as in <a \single \omit Accidental cs,>.

On 01/31/18 21:27, Stefano Troncaro wrote:
> Hello again everyone!
>
> Suppose I have the following example:
>
> \version "2.19.80" \language "english" command = { %What should go here to omit the sharp while keeping the natural? } \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>
>     } } }
>
> If for whatever reason I wanted to omit the sharp while keeping the natural sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a loss as to how to tackle this problem, and looking through the documentation hasn't helped.
>
> Does anyone have an idea?
> Stéfano
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

caagr98
In that case, you could use something like this:


\version "2.19.80"

nth =
#(define-music-function
  (n tweak mus) (integer? ly:music? ly:music?)
  (single tweak (list-ref (ly:music-property mus 'elements) n))
  mus)

{
  <a cis>
  \nth 1 \omit Accidental <a cis> % Remember, zero-indexed
}


If you could be a bit more specific about your goal (hiding all sharps? Hiding accidentals on even-indexed notes? Hiding accidentals specifically on cis?), that would make it possible to make a more specific function for your goals.

(Note that this function can only be used inline, so it won't work with edition-engraver or similar.)


On 01/31/18 21:56, Stefano Troncaro wrote:

> I just tried it, but unfortunately it appears to only work when used inside the chord, and I need to find a way to do it from outside.//
>
> 2018-01-31 17:39 GMT-03:00 Caagr98 <[hidden email] <mailto:[hidden email]>>:
>
>     You could try \single instead of \once, as in <a \single \omit Accidental cs,>.
>
>     On 01/31/18 21:27, Stefano Troncaro wrote:
>     > Hello again everyone!
>     >
>     > Suppose I have the following example:
>     >
>     > \version "2.19.80" \language "english" command = { %What should go here to omit the sharp while keeping the natural? } \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>
>     >     } } }
>     >
>     > If for whatever reason I wanted to omit the sharp while keeping the natural sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a loss as to how to tackle this problem, and looking through the documentation hasn't helped.
>     >
>     > Does anyone have an idea?
>     > Stéfano
>     >
>     >
>     > _______________________________________________
>     > lilypond-user mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > https://lists.gnu.org/mailman/listinfo/lilypond-user <https://lists.gnu.org/mailman/listinfo/lilypond-user>
>     >
>
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

David Kastrup
In reply to this post by Stefano Troncaro
Stefano Troncaro <[hidden email]> writes:

> Hello again everyone!
>
> Suppose I have the following example:
>
> \version "2.19.80"\language "english"
> command = {
>   %What should go here to omit the sharp while keeping the natural?}
> \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>
>     }
>   }
> }
>
> If for whatever reason I wanted to omit the sharp while keeping the natural
> sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a
> loss as to how to tackle this problem, and looking through the
> documentation hasn't helped.
>
> Does anyone have an idea?

\version "2.19.80"\language "english"

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


But you also can use stuff like

\once \accidentalStyle forget

I think to similar effect.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Stefano Troncaro
@Caagr98
If you could be a bit more specific about your goal (hiding all sharps? Hiding accidentals on even-indexed notes? Hiding accidentals specifically on cis?), that would make it possible to make a more specific function for your goals.

(Note that this function can only be used inline, so it won't work with edition-engraver or similar.)


You are right, I apologize for being so vague. 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.

I know I can achieve the results I want by splitting the chord into Voices, and then targetting the specific note is trivial, as follows:

\version "2.19.80"
\language "english"

\include "oll-core/package.ily"
\loadPackage edition-engraver
\addEdition test

\editionMod test 1 1/4 Voice.B \once \omit Accidental

\consistToContexts #edition-engraver Voice

\score {
  \new Staff {
    \new Voice \relative c'' { 
      \key b \minor \accidentalStyle modern
      \partial 4 <as c,>4 |
      <b b,> << { \voiceOne a } \new Voice { \voiceOne cs, } >> \oneVoice <g' d~> <fs d> 
    }
  }
}
But having to split chords like this every time there is an single element I need to tweak is something I am not happy with. Having a function do it would be both cleaner and more productive.

I hope I was clear enough this time. Please tell me if you know or have any idea on how this could be achieved.

Thank you for your help!


@David
But you also can use stuff like

\once \accidentalStyle forget

I think to similar effect.


 Thank you for the suggestion. Unfortunately, if you read my reply to Caarg98 you'll notice that I'm looking for something more flexible. That is, unless one could define a custom accidental style that allowed for the precision I need, then that could actually be a great solution! But I'm unaware of how to do something like that (if it's even possible).

2018-01-31 19:24 GMT-03:00 David Kastrup <[hidden email]>:
Stefano Troncaro <[hidden email]> writes:

> Hello again everyone!
>
> Suppose I have the following example:
>
> \version "2.19.80"\language "english"
> command = {
>   %What should go here to omit the sharp while keeping the natural?}
> \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>
>     }
>   }
> }
>
> If for whatever reason I wanted to omit the sharp while keeping the natural
> sign of the <a cs,>, obviously \once \omit Accidental won't work. I'm at a
> loss as to how to tackle this problem, and looking through the
> documentation hasn't helped.
>
> Does anyone have an idea?



But you also can use stuff like

\once \accidentalStyle forget

I think to similar effect.

--
David Kastrup



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Jan-Peter Voigt
In reply to this post by Stefano Troncaro
Hello Stéfano,

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.

I am going to implement both features. Until April I will be very busy -
disallowing me to work on it. But hopefully I can do it in May.

Jan-Peter


Am 31.01.2018 um 21:27 schrieb Stefano Troncaro:

> Hello again everyone!
>
> Suppose I have the following example:
>
> \version  "2.19.80" \language  "english" command ={ %What should go here to omit the sharp while keeping the natural? } \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>
>      } } }
>
> If for whatever reason I wanted to omit the sharp while keeping the
> natural sign of the <a cs,>, obviously \once \omit Accidental won't
> work. I'm at a loss as to how to tackle this problem, and looking
> through the documentation hasn't helped.
>
> Does anyone have an idea?
> Stéfano
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

David Kastrup
In reply to this post by Stefano Troncaro
Stefano Troncaro <[hidden email]> writes:

>> *But you also can use stuff like \once \accidentalStyle forget I think to
>> similar effect.*
>>
>
>  Thank you for the suggestion. Unfortunately, if you read my reply to
> Caarg98 you'll notice that I'm looking for something more flexible. That
> is, unless one could define a custom accidental style that allowed for the
> precision I need, then that could actually be a great solution! But I'm
> unaware of how to do something like that (if it's even possible).
>>
>>
>> But you also can use stuff like
>>
>> \once \accidentalStyle forget
>>
>> I think to similar effect.

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.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Thomas Morley-2
In reply to this post by Stefano Troncaro
2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email]>:

> 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
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Stefano Troncaro
@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 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 <[hidden email]>:
2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email]>:

> 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
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Jan-Peter Voigt
In reply to this post by Thomas Morley-2
Hello Harm, Stéfano,

I always underestimate the usability of before/after-line-breaking ...
Based on Harms code I scratched a music-function to conditionally omit
the accidental. This one can be used with the EE.
It smells a bit hacky, but it seems to work and is extendable for other
use cases.

HTH
Jan-Peter

Am 01.02.2018 um 22:49 schrieb Thomas Morley:

> 2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email]>:
>
>> 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
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

remove-accidental-cond.ly (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Thomas Morley-2
In reply to this post by Stefano Troncaro
2018-02-02 3:55 GMT+01:00 Stefano Troncaro <[hidden email]>:

> @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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

caagr98
In reply to this post by Stefano Troncaro
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 <[hidden email] <mailto:[hidden email]>>:
>
>     2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email] <mailto:[hidden email]>>:
>
>     > 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
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Jan-Peter Voigt
In reply to this post by Thomas Morley-2
Hello Harm, Stéfano,

I always underestimate the usability of before/after-line-breaking ...
Based on Harms code I scratched a music-function to conditionally omit
the accidental. This one can be used with the EE.
It smells a bit hacky, but it seems to work and is extendable for other
use cases.

HTH
Jan-Peter

Am 01.02.2018 um 22:49 schrieb Thomas Morley:

> 2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email]>:
>
>> 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
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

remove-accidental-cond.ly (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Jan-Peter Voigt
In reply to this post by Thomas Morley-2
Hello Harm, Stéfano,

I always underestimate the usability of before/after-line-breaking ...
Based on Harms code I scratched a music-function to conditionally omit
the accidental. This one can be used with the EE.
It smells a bit hacky, but it seems to work and is extendable for other
use cases.

HTH
Jan-Peter

Am 01.02.2018 um 22:49 schrieb Thomas Morley:

> 2018-02-01 16:59 GMT+01:00 Stefano Troncaro <[hidden email]>:
>
>> 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
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

remove-accidental-cond.ly (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

David Kastrup
In reply to this post by Jan-Peter Voigt
Jan-Peter Voigt <[hidden email]> writes:

> Hello Harm, Stéfano,
>
> I always underestimate the usability of before/after-line-breaking ...
> Based on Harms code I scratched a music-function to conditionally omit
> the accidental. This one can be used with the EE.
> It smells a bit hacky, but it seems to work and is extendable for
> other use cases.

I think it would make a whole lot more sense to teach the Edition
Engraver how to mark/identify and tweak single items.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Jan-Peter Voigt
Am 02.02.2018 um 17:55 schrieb David Kastrup:

> Jan-Peter Voigt <[hidden email]> writes:
>
>> Hello Harm, Stéfano,
>>
>> I always underestimate the usability of before/after-line-breaking ...
>> Based on Harms code I scratched a music-function to conditionally omit
>> the accidental. This one can be used with the EE.
>> It smells a bit hacky, but it seems to work and is extendable for
>> other use cases.
>
> I think it would make a whole lot more sense to teach the Edition
> Engraver how to mark/identify and tweak single items.
>
+1
I will do so when time allows!
The presented function was just a try to help out until I have (or
someone else) done that.


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Kieren MacMillan
In reply to this post by David Kastrup
Hi David (et al.),

> I think it would make a whole lot more sense to teach the Edition
> Engraver how to mark/identify and tweak single items.

+1

At the risk of opening a serious can-o'-worms… I would love for you (David K.) — who has the best Lilypond-fundamentals programming mind I know — to glance through the EE codebase, to see if you can see any ways to help Jan-Peter improve and/or extend it. All of the EE code is well above my pay grade, unfortunately, but a quick dak-glance might reveal some revolutionary things/thinks.

Thanks/Best,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

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

Stefano Troncaro
Thank you for your help everyone!

After a lot of stumbling around I finally managed to expand Jan-Peters' function so that it can modify more than one note in a given chord. I attached it so its available for anyone interested in using it.

On the other hand, I too think that the real solution would be to upgrade the Edition Engraver. But that code is way too complex for me to be able to help, so waiting is all I can do on that front.

2018-02-02 15:25 GMT-03:00 Kieren MacMillan <[hidden email]>:
Hi David (et al.),

> I think it would make a whole lot more sense to teach the Edition
> Engraver how to mark/identify and tweak single items.

+1

At the risk of opening a serious can-o'-worms… I would love for you (David K.) — who has the best Lilypond-fundamentals programming mind I know — to glance through the EE codebase, to see if you can see any ways to help Jan-Peter improve and/or extend it. All of the EE code is well above my pay grade, unfortunately, but a quick dak-glance might reveal some revolutionary things/thinks.

Thanks/Best,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

grobtweakchords.ly (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Thomas Morley-2
2018-02-03 3:52 GMT+01:00 Stefano Troncaro <[hidden email]>:

> After a lot of stumbling around I finally managed to expand Jan-Peters'
> function so that it can modify more than one note in a given chord. I
> attached it so its available for anyone interested in using it.

Hi Stefano,

I had a look at the function, some remarks.
(1)
We have `event-chord-pitches' to extract pitches from an event-chord.
It works for sequential-music as well.
If you go for ly:music? and extract pitches you can delete some definitions.
Ofcourse you can't go for a single target-pitch anymore. Instead you
would need to do <single-pitch> or { single-pitch }.
I don't see a problem with it, though
(2)
No point in using map and throwing the resulting list away.
Use for-each if you're only interested in the side-effect(s)

Leading to:

\version "2.19.65"

condGrobTweak =
#(define-music-function (use_octave target grob_proc)
   ((boolean? #f) ly:music? procedure?)
   (let ((pitches (event-chord-pitches target)))
     #{
       \override NoteHead.before-line-breaking =
       #(lambda (grob)
          (let* ((cause (ly:grob-property grob 'cause))
                 (pitch (ly:prob-property cause 'pitch))
                 (note (ly:pitch-notename pitch))
                 (alteration (ly:pitch-alteration pitch))
                 (octave (ly:pitch-octave pitch)))
            (for-each
              (lambda (this-pitch)
                (if (and (eqv? alteration (ly:pitch-alteration this-pitch))
                         (eqv? note (ly:pitch-notename this-pitch))
                         (or (not use_octave)
                             (eqv? octave (ly:pitch-octave this-pitch))))
                    (grob_proc grob)))
              pitches)))
     #}))

#(define (omit-accidental grob)
   (let ((accidental (ly:grob-object grob 'accidental-grob)))
     (if (ly:grob? accidental)
         (ly:grob-set-property! accidental 'stencil #f))))

{
    \once \condGrobTweak <cs> #omit-accidental
    <cs' es' gs' bs'>
}

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
12