Le 16/10/2022 à 21:20, Benjamin Tordoff a écrit :
Hi all,
My understanding is that "\repeat tremolo 4 {c16}" and "c4:16" should be
equivalent, the latter just being a (welcome) shortcut for the former. In the PDF output (without
expanding repeats) they look identical however in the midi playback (with repeats expanded) the
former plays as four semi-quavers but the latter as a single crotchet. This seems wrong.
% This should produce 8 semi-quavers:
\version "2.23.10"
\score {
\unfoldRepeats {
\repeat tremolo 4 {c'16}
c'4:16
}
\midi {}
}
Is this a bug, or am I doing something wrong here?
Yes, this is a known issue,
https://gitlab.com/lilypond/lilypond/-/issues/6145
Here's a workaround you could use:
\version "2.23.14"
fixTremolos =
#(define-music-function (music) (ly:music?)
(music-map
(lambda (m)
(let ((event (any (lambda (a)
(and (music-is-of-type? a 'tremolo-event)
a))
(ly:music-property m 'articulations))))
(if event
(let* ((total-tremolo-duration (ly:music-property m 'duration))
(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)
one-tremolo-note-duration)
(set! (ly:music-property m 'articulations)
(delete! event (ly:music-property m 'articulations)))
(make-music 'TremoloRepeatedMusic
'repeat-count tremolo-note-count
'element m))
m)))
music))
unfoldRepeats = \unfoldRepeats #'() \fixTremolos \etc
%%%
music = { c'2:16 \repeat tremolo 8 c'16 }
\new Score <<
\new Staff \music
\new Staff \unfoldRepeats \music
>>
Best,
Jean