[Top][All Lists]

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

Re: Modify a NoteEvent to RestEvent

From: paolo prete
Subject: Re: Modify a NoteEvent to RestEvent
Date: Sun, 11 Mar 2018 11:18:46 +0100

2018-03-11 8:26 GMT+01:00 David Kastrup <address@hidden>:
paolo prete <address@hidden> writes:

> Hello.
> Do you know how to modify a NoteEvent so that it becomes a RestEvent, or
> (vice-versa) in Scheme?

You can't.

Why do you say that I can't, if changing the 'name property did the job (look at the snippet below)?
Do you mean that this is sort of a  hack?


foo = #(define-music-function (parser location music1) (ly:music? )
          (lambda (x)
                (if (music-is-of-type? x 'rest-event)
                    (ly:music-set-property! x 'name  'NoteEvent)
                    (ly:music-set-property! x 'pitch (ly:make-pitch 0 3))
                    (ly:music-set-property! x 'name 'RestEvent)
                    (ly:music-set-property! x 'pitch '())
          (ly:music-property music1 'elements) 
#{ $music1 #}))

{ \displayMusic \foo { f'4 r } }


reply via email to

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