lilypond-user
[Top][All Lists]
Advanced

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

Re: Arpeggio - bracket > curly bracket


From: Thomas Scharkowski
Subject: Re: Arpeggio - bracket > curly bracket
Date: Wed, 19 Jan 2022 14:47:32 +0100


> Am 19.01.2022 um 14:17 schrieb Jean Abou Samra <jean@abou-samra.fr>:
> 
> 
> 
> Le 19/01/2022 à 13:58, Thomas Scharkowski a écrit :
>> 
>>> Am 19.01.2022 um 13:09 schrieb Jean Abou Samra <jean@abou-samra.fr>:
>>> 
>>> Le 19/01/2022 à 09:46, Thomas Scharkowski a écrit :
>>>> Hallo,
>>>> 
>>>> I’d like to replace the arpeggioBracket by a curly bracket / brace.
>>>> Thank your for your help!
>>> 
>>> Here's a stencil callback reading the vertical start
>>> and end positions of the arpeggio and printing a bracket
>>> accordingly:
>>> 
>>> \version "2.22.1"
>>> 
>>> arpeggioBrace =
>>> \tweak stencil
>>>   #(lambda (grob)
>>>      (let* ((positions (ly:grob-property grob 'positions))
>>>             (layout (ly:grob-layout grob))
>>>             (scale (ly:output-def-lookup layout 'output-scale))
>>>             (factor (/ scale (ly:pt 1)))
>>>             (len (* factor (+ 0.5 (interval-length positions))))
>>>             (brace-markup (make-left-brace-markup len))
>>>             (brace-stencil (grob-interpret-markup grob brace-markup)))
>>>        (ly:stencil-translate-axis brace-stencil
>>>                                   (interval-center positions)
>>>                                   Y)))
>>> \arpeggio
>>> 
>>> \relative {
>>>   \clef bass
>>>   <e g b g'>\arpeggioBrace
>>> }
>>> 
>>> 
>>> Best,
>>> Jean
>>> 
>> Thank you Jean,
>> 
>> This is very nice!
>> How can I use this for connected arpeggios through voices?
> 
> 
> These are a bit special because they are not created
> from the \arpeggio events. Use \override rather than
> \tweak in this case.
> 
> \version "2.22.1"
> 
> spanArpeggioBrace =
> \once \override PianoStaff.Arpeggio.stencil =
>   #(lambda (grob)
>      (let* ((positions (ly:grob-property grob 'positions))
>             (layout (ly:grob-layout grob))
>             (scale (ly:output-def-lookup layout 'output-scale))
>             (factor (/ scale (ly:pt 1)))
>             (len (* factor (+ 0.5 (interval-length positions))))
>             (brace-markup (make-left-brace-markup len))
>             (brace-stencil (grob-interpret-markup grob brace-markup)))
>        (ly:stencil-translate-axis brace-stencil
>                                   (interval-center positions)
>                                   Y)))
> 
> \new PianoStaff \with {
>   connectArpeggios = ##t
> }
> <<
>   \new Staff \relative {
>     \spanArpeggioBrace
>     % Looks better a bit closer to the notes?
>     \once \override PianoStaff.Arpeggio.padding = 0.1
>     % A bit of padding to the left?
>     \once \override PianoStaff.Arpeggio.extra-spacing-width = #'(-1 . 0)
>     g'\arpeggio
>   }
>   \new Staff \relative {
>     \clef bass
>     <e g b>\arpeggio
>   }
> >>
> 
> Best,
> Jean

This does not work for me (I did change of course PianoStaff to Staff).

To get the „normal“ brackets I use:
\override Staff.Arpeggio.stencil = #ly:arpeggio::brew-chord-bracket

Thomas






reply via email to

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