2018-03-11 8:26 GMT+01:00 David Kastrup <d...@gnu.org>:

> paolo prete <paoloprete...@gmail.com> 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?
Thanks

%%%%%%%%%%%%%%

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


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

%%%%%%%%%%%%%%%%%%
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to