\tweak Accidental stencil within chord

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

\tweak Accidental stencil within chord

dtsmarin
Is it possible to tweak the stencil for an accidental within a chord?

Something similar in functionality with:

\tweak Stem.color #red
\tweak Beam.color #green c8 e
<c e \tweak Accidental.font-size #-3 ges>4





--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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

Re: \tweak Accidental stencil within chord

David Kastrup
dtsmarin <[hidden email]> writes:

> Is it possible to tweak the stencil for an accidental within a chord?
>
> Something similar in functionality with:

> \tweak Stem.color #red
> \tweak Beam.color #green c8 e
> <c e \tweak Accidental.font-size #-3 ges>4

Uh, what is wrong with exactly that?

--
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: \tweak Accidental stencil within chord

dtsmarin
This was an example to show what I'm after.
I need to *change* the stencil (e.g. flat to be sharp ) not the colour etc.
I know how to change stencil for a single accidental with \override but
\tweak Accidental.stencil doesn't work.

The closest I've got is this:
#(define rhomb-acc
  (lambda (grob)
    (let* ((stencil (ly:accidental-interface::print grob))
           (new-stil
             (grob-interpret-markup grob
               (markup
                    #:hspace 1
                    #:musicglyph "accidentals.flat"
                    #:hspace -2
                    #:transparent        
                    #:stencil  
                       stencil))))
    new-stil)))

But i'm hiding the sharp, I would like to override it.




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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

Re: \tweak Accidental stencil within chord

David Kastrup
dtsmarin <[hidden email]> writes:

> This was an example to show what I'm after.
> I need to *change* the stencil (e.g. flat to be sharp ) not the colour etc.
> I know how to change stencil for a single accidental with \override but
> \tweak Accidental.stencil doesn't work.

Minimal example exhibiting the problem?

--
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: \tweak Accidental stencil within chord

dtsmarin
Oops! Wrong minimal example!


#(define enh-acc
  (lambda (grob)
    (let* ((stencil (ly:accidental-interface::print grob))
           (new-stil
             (grob-interpret-markup grob
               (markup
                    #:hspace 1
                    #:musicglyph "accidentals.flat"
                    #:hspace -2
                    #:transparent        
                    #:stencil  
                       stencil))))
    new-stil)))



\relative c' {
 
  <d \tweak Accidental. stencil #enh-acc eis>1
  <e dis>2
  <eis d>2

}





--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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

Re: \tweak Accidental stencil within chord

David Kastrup
dtsmarin <[hidden email]> writes:

> Oops! Wrong minimal example!
>
>
> #(define enh-acc
>   (lambda (grob)
>     (let* ((stencil (ly:accidental-interface::print grob))
>            (new-stil
>              (grob-interpret-markup grob
>                (markup
>                     #:hspace 1
>                     #:musicglyph "accidentals.flat"
>                     #:hspace -2
>                     #:transparent        
>                     #:stencil  
>                        stencil))))
>     new-stil)))
>
>
>
> \relative c' {
>  
>   <d \tweak Accidental. stencil #enh-acc eis>1
>   <e dis>2
>   <eis d>2
>
> }

Sigh.  An example of what you would want to work.  Not an example of
what is needed to make this work.

--
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: \tweak Accidental stencil within chord

David Kastrup
David Kastrup <[hidden email]> writes:

> dtsmarin <[hidden email]> writes:
>
>> Oops! Wrong minimal example!
>>
>>
>> #(define enh-acc
>>   (lambda (grob)
>>     (let* ((stencil (ly:accidental-interface::print grob))
>>            (new-stil
>>              (grob-interpret-markup grob
>>                (markup
>>                     #:hspace 1
>>                     #:musicglyph "accidentals.flat"
>>                     #:hspace -2
>>                     #:transparent        
>>                     #:stencil  
>>                        stencil))))
>>     new-stil)))
>>
>>
>>
>> \relative c' {
>>  
>>   <d \tweak Accidental. stencil #enh-acc eis>1
>>   <e dis>2
>>   <eis d>2
>>
>> }
>
> Sigh.  An example of what you would want to work.  Not an example of
> what is needed to make this work.

And by the way: what is your actual use case that requires falsifying
accidentals instead of just using the accidental you want in the first
place?

--
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: \tweak Accidental stencil within chord

Aaron Hill
In reply to this post by dtsmarin
On 2019-05-01 11:17 am, dtsmarin wrote:
> This was an example to show what I'm after.
> I need to *change* the stencil (e.g. flat to be sharp ) not the colour
> etc.
> I know how to change stencil for a single accidental with \override but
> \tweak Accidental.stencil doesn't work.

Hmm... \tweaking a stencil should most definitely work.

Here are two examples affecting specific Accidentals within chords.  The
first replaces the stencil in question, ignoring the original stencil.  
The second uses grob-transformer to obtain the original value without
having to know how it was produced.

%%%%
\version "2.19.82"

#(define (foo grob)
   (grob-interpret-markup grob
     (markup #:with-color (x11-color 'purple)
             #:circle #:vcenter #:fontsize 2 #:bold "#")))

baz = #(grob-transformer 'stencil (lambda (grob orig)
   (grob-interpret-markup grob
     (markup #:with-color blue
             #:rotate 15 #:box #:stencil orig))))

\fixed c' {
   <d fis a \tweak Accidental.stencil #foo cis'>4
   <\tweak Accidental.stencil #baz ees g bes d'>4
}
%%%%


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

tweak-stencil.cropped.png (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: \tweak Accidental stencil within chord

dtsmarin
In reply to this post by David Kastrup
I thought my code didn't work but it looks like it does. Sorry for the
unnecessary replies.
Use case:
Chromatic enharmonic tied notes where normally Lilypond wouldn't work
correctly. (Ties don't show up if you don't use this hack).
The problem is that my half-solution ruins the spacing.

#(define enhf-acc
  (lambda (grob)
    (let* ((stencil (ly:accidental-interface::print grob))
           (new-stil
             (grob-interpret-markup grob
               (markup
                    #:hspace 1
                    #:musicglyph "accidentals.flat"
                    #:hspace -2
                    #:transparent        
                    #:stencil  
                       stencil))))
    new-stil)))
 
 #(define enhs-acc
  (lambda (grob)
    (let* ((stencil (ly:accidental-interface::print grob))
           (new-stil
             (grob-interpret-markup grob
               (markup
                    #:hspace 1
                    #:musicglyph "accidentals.sharp"
                    #:hspace -2
                    #:transparent        
                    #:stencil  
                       stencil))))
    new-stil)))
{
<dis'~ e'~ f'~ ges'>1
  \set Staff.middleCPosition = #-5
<bis c' \tweak Accidental. stencil #enhf-acc
dis'! e'!>

}



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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

Re: \tweak Accidental stencil within chord

David Kastrup
dtsmarin <[hidden email]> writes:

> I thought my code didn't work but it looks like it does. Sorry for the
> unnecessary replies.
> Use case:
> Chromatic enharmonic tied notes where normally Lilypond wouldn't work
> correctly. (Ties don't show up if you don't use this hack).

They don't?

\version "2.19.16"

{
  <dis'~ e'~ f'~ ges'>1
  <bis c' es'! e'! eis'!>
}



It's really an uphill struggle to figure out what your problem actually
is.

--
David Kastrup

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

dtsmar.preview.png (7K) Download Attachment