|
From: | Ernie Braganza |
Subject: | Re: Parenthensize a horizontal group? |
Date: | Wed, 25 Aug 2021 10:36:34 -0400 |
On 2021-06-30 9:07 pm, Aaron Hill wrote:
> On 2021-06-30 9:00 pm, Mark Probert wrote:
>> Hi.
>>
>> I've looked through docs and snippets and can't seem to find a way to
>> place parens around a horizontal group of notes (an "optional"
>> indicator for leadsheets). I've tried
>>
>> \parenthesize { a8 bes }
>>
>> but nope. Is there a simple way? I want to do something like:
>>
>> \mark "(" a8 bes \mark ")"
>>
>> and have the parens aligned on the center of the staff.
>
> Does LSR 902 [1] help?
>
> [1]: https://lsr.di.unimi.it/LSR/Item?id=902
>
Or perhaps this which might be easier to use if this sort of thing
occurs often:
%%%%
\version "2.22.0"
parenthesizeMusic =
#(define-music-function (music) (ly:music?)
(define ((stencils which) grob)
(let* ((stens (parentheses-item::calc-parenthesis-stencils grob))
(sten (which stens)))
(if (eq? which first) (list sten point-stencil) (list point-stencil
sten))))
(define (add-tweak event tweak)
(ly:music-set-property! event 'tweaks
(cons tweak (ly:music-property event 'tweaks '()))))
(let ((evs (extract-typed-music music 'rhythmic-event)))
(ly:music-set-property! (first evs) 'parenthesize #t)
(add-tweak (first evs) `((ParenthesesItem . stencils) . ,(stencils
first)))
(ly:music-set-property! (last evs) 'parenthesize #t)
(add-tweak (last evs) `((ParenthesesItem . stencils) . ,(stencils
second))))
music)
{
\override ParenthesesItem.font-size = 5
\override ParenthesesItem.extra-offset =
#(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob))))
\parenthesizeMusic { <c' c''> d' e' f' g' }
}
%%%%
-- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |