lilypond-user
[Top][All Lists]
Advanced

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

Re: music function playing well with context


From: Alberto Simões
Subject: Re: music function playing well with context
Date: Wed, 8 Feb 2023 19:01:44 +0000



On Wed, Feb 8, 2023 at 7:00 PM Alberto Simões <albertovski@gmail.com> wrote:


On Wed, Feb 8, 2023 at 6:57 PM Alberto Simões <albertovski@gmail.com> wrote:


On Wed, Feb 8, 2023 at 6:50 PM Jean Abou Samra <jean@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!
 

I get a
  Unbound variable: when
may it be the lilypond version? running 2.22 here.
Thanks

I could have Googled first.
Replacing 'when' with 'cond' works perfectly!

Thank you

reply via email to

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