Tutorial for how to brute-force a continuous tempo change (ritardando, accelerando) for automatic playback
Suppose you want to slow down from 180 bpm to 80 bpm over 4 measures. Musescore doesn't provide any way to make that happen smoothly—your only option is to add specific tempi at places during the slowdown. Say, 180 bpm for the first measure, 150 for the 2nd, 125 for the 3rd, and 100 for the 4th, or something like that. How can we improve on this, creating playback indistinguishable from a continuous tempo change, using just this single tool?
Well, step zero is to figure out what we mean by a continuous tempo change—what is the optimal process we are attempting to replicate? It seems clear to me that the best way is an exponential change: If we are at 180 bpm at the beginning of the 4 measures and 80 bpm at the end, then we should instantaneously be at 120 bpm after 2 measures, because that would make the slowdown the same for the first two measures as the second two measures (since 180:120 = 120:80). We can imagine dividing up the slowdown into smaller and smaller and smaller segments and determining the tempo at each instant so that it's constantly slowing down at the same rate. (This is a similar mathematical model as continuously compounding interest)
Since we can only change the tempo at the beginning of notes, the calculation that needs to be made is to figure out what single tempo should be assigned to each note so that it takes up the same amount of time that it would if the tempo were changing continuously over the duration of the note. I've done the math to figure out a formula to give you this tempo.
You will need to know the following parameters:
T_0: the original tempo in beats per minute
T_f: the final tempo in beats per minute
L: the length of the tempo change, in measures
and then for the specific note you're calculating the tempo for:
m: the number of measures between the beginning of the tempo change and the beginning of this note
n: the length of the note, expressed as the fraction of the measure it takes up (quarter note in 4/4 would give n=0.25)
The formula for the tempo you should assign for the note is
T = T_0 * ln[(T_f/T_0)^(n/L)] * (T_f/T_0)^(m/l) * (T_f/T_0)^(n/L)/((T_f/T_0)^(n/L)-1)
go here to see the equation in a readable format: https://imgur.com/G5SJXsn
For example, if I want to slow down from 180 bpm to 80 bpm over 4 bars, I would make
T_0 = 180
T_f = 80
L = 4
and then I would assign a tempo to each note in the 4 bars using the formula. If I had a quarter note on beat 2 of the 3rd measure of the slowdown, that would make m=2.25, n=0.25. Plugging in to the formula, the tempo I should assign to that note is 111.20 beats per minute.
I'm aware that this becomes very tedious for tempo changes that take place over many notes, since a calculation needs to be made for every note to make it perfect.
Theoretically, I could imagine this formula being the base of a continuous-tempo-change feature (user could create a continuous tempo change between any two tempo markings), where it calculates and assigns the required tempi to every note automatically instead of the user having to do it manually. But I don't have the programming skills to try to implement it myself.
Comments
The tempochanges plugin does this automatically for you. See https://musescore.org/en/project/tempochanges
In reply to The tempochanges plugin does… by mike320
haha I guess it's good that I enjoyed doing the math, considering it was completely redundant!
In reply to haha I guess it's good that… by pjkeller5595
I think that plugin uses a linear change though, not an exponential.
In reply to The tempochanges plugin does… by mike320
Only linear in that plugin for now..
I've had a PR open for some of those non-linear changes; time to update the plugin in the coming weeks!
In reply to Only linear in that plugin… by jeetee
And finally gotten around to this (at least for MS3). Apparently a lot of weeks were "coming"...