Unfolding tremolo repeats: Difference between revisions
m added categories |
mNo edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
Currently, <code><var>note</var>:<var>duration</var></code>, which is more or less a shortcut for <code>\repeat tremolo</code>, is not unfolded by <code>\unfoldRepeats</code> (this is tracked in {{Issue|6145}}). The function given in this snippet provides a workaround. | |||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
fixTremolos = | fixTremolos = | ||
| Line 10: | Line 11: | ||
(ly:music-property m 'articulations)))) | (ly:music-property m 'articulations)))) | ||
(if event | (if event | ||
(let* ((total-tremolo-duration (ly:music-property m 'duration)) | (let* ((total-tremolo-duration (ly:music-property m | ||
(tremolo-type (ly:music-property event 'tremolo-type)) | 'duration)) | ||
(one-tremolo-note-duration (ly:make-duration (ly:intlog2 tremolo-type))) | (tremolo-type (ly:music-property event | ||
'tremolo-type)) | |||
(one-tremolo-note-duration | |||
(ly:make-duration (ly:intlog2 tremolo-type))) | |||
(tremolo-note-count | |||
(/ tremolo-type (expt 2 (ly:duration-log | |||
total-tremolo-duration))))) | |||
(set! (ly:music-property m 'duration) | (set! (ly:music-property m 'duration) | ||
one-tremolo-note-duration) | one-tremolo-note-duration) | ||
| Line 29: | Line 35: | ||
{ | { | ||
\music | |||
\unfoldRepeats \music | \unfoldRepeats \music | ||
} | } | ||
</lilypond> | </lilypond> | ||
[[Category:Repeats]] | [[Category:Repeats]] | ||
[[Category: | [[Category:Workaround]] | ||
[[Category:Included in the official documentation]] | |||
[[Category:Snippet]] | |||