|
From: | Lukas-Fabian Moser |
Subject: | Re: Scheme: change duration of NoteEvent |
Date: | Sun, 9 Aug 2020 12:45:28 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Hi Pavel,
I want to write simple function that will be change duration of note. But I stuck on the first step: I can't "extract" (or "see") the duration property:
\version "2.20.0"
mynote = c'
\displayMusic \mynote
#(display-scheme-music
(ly:music-property mynote 'duration))
Try setting mynote = c'8 from the start.
LilyPond interprets your mynote as a naked pitch (and you obvioulsy can't extract a duration from a pitch). This can be seen by doing #(display-scheme-music mynote) which yields (ly:make-pitch 0 0), or simply by #(display mynote) which yields #<Pitch c' >.
It seems using \displayMusic hides this fact by first upgrading #mynote to a full-fledged NoteEvent; these implicit conversions happen all the time in LilyPond.
Best[Prev in Thread] | Current Thread | [Next in Thread] |