> > No MWE for now but will provide if needed.
> Can you think of a case where it wouldn't be needed?
Silly me :-)
\version "2.25.8"
tempoChange =
#(define-music-function (interval endscale thenscale music)
(ly:duration? scale? (scale? 1) ly:music?)
"Make a gradual tempo change over @var{music}, essentially changing
speed after
every duration of @var{interval}, approaching a factor of speed of
@var{endscale}
compared to the start. Afterwards, tempo is switched to @var{thenscale} of the
original speed (default 1). If @var{thenscale} is 0, the speed reached at the
end is just maintained and can be overriden with an explicit @samp{\\tempo}
command if required."
(define (scaletempo oldscale newscale)
(make-apply-context
(lambda (ctx)
(set! (ly:context-property ctx 'tempoWholesPerMinute)
(ly:moment-mul (ly:context-property ctx 'tempoWholesPerMinute)
(ly:make-moment (/ newscale oldscale)))))))
(let* ((muslen (ly:moment-main (ly:music-length music)))
(intlen (ly:moment-main (ly:duration-length interval)))
(steps (/ muslen intlen))
(endfactor (scale->factor endscale))
(thenfactor (scale->factor thenscale)))
(make-simultaneous-music
(list music
(context-spec-music
(make-sequential-music
(let loop ((rsteplst (iota (1+ steps) endfactor (/ (- 1
endfactor) steps)))
(res (if (positive? thenfactor)
(list (scaletempo endfactor thenfactor))
(list))))
(if (null? (cdr rsteplst))
res
(loop (cdr rsteplst)
(cons* (scaletempo (cadr rsteplst) (car rsteplst))
(make-skip-music (ly:make-duration 0 0 intlen))
res)))))
'Score)))))
music = {
c'8 d' e' f' g' a' |
b' c'' b' a' g' f' |
}
structure = {
\time 6/8
\tempo 4. = 100
\tempoChange 8 64/128 0 {
s2. |
}
}
\score {
\new Voice << \music \structure >>
\layout {}
\midi {}
}
But, as you could expect, it works flawlessly (Thus the need for a MnWE).
Scaling down this sketchy-arachnid code (full symphonic+chorus) of
mine will take some time though, but, I _will_ survive.
--
Pierre-Luc Gauthier