On Wed, Feb 8, 2023 at 6:50 PM Jean Abou Samra <j...@abou-samra.fr> wrote:

> On 08/02/2023 19:45, Alberto Simões wrote:
>
> > I just noticed this does not support chords: \myT <c e> f
> > While I can do that manually (just a couple of cases) it would be nice
> to learn how to handle these cases.
> > Would it be possible?
>
>
> Chords are distinguished by having the music class 'event-chord,
> and the duration is on the contained notes rather than the
> chord itself.
>
>
> \version "2.24.0"
>
> #(define (set-note-or-chord-duration! note-or-chord duration)
>    (if (music-is-of-type? note-or-chord 'event-chord)
>        (for-each (lambda (ev)
>                    (when (music-is-of-type? ev 'rhythmic-event)
>                      (ly:music-set-property! ev 'duration duration)))
>                  (ly:music-property note-or-chord 'elements))
>        (ly:music-set-property! note-or-chord 'duration duration)))
>

I know why I do not like lisp :-)
but while not being able to write it myself, I can understand it!
Thank you!


>
> myT =
> #(define-music-function (pa pb) (ly:music? ly:music?)
>    (set-note-or-chord-duration! pa #{ 4 #})
>    (set-note-or-chord-duration! pb #{ 8 #})
>     #{ \tuplet 3/2 { #pa #pb } #})
>
> {
>   \myT c( gis a4_.)
>   \myT c_. d^^ e4
>   \myT <c e>\p f
> }
>
>
>
> Best,
> Jean
>
>

Reply via email to