Tempo Changes plugin improvement
I've created a version of the Tempo Change plugin that gives some new power, so to speak (the changes are very small). The extant plugin provides a linear staging of the tempo difference, let's call that x, which varies from 0 to 1 over the interval (then multiplied by the tempo difference).
My change allows any real power of x. I find that 2.5 gives an effect quite more pleasing than the current 1.0. Don't laugh until you've tried it (you can make such a change without the UI in one line after studying the code). You might want different values at different times (I have a dialog slot), or start the deceleration at different points back (in conjunction with finding the best exponent).
Sample of 2.5 (at both double-bars in the first (I) and last (V) canons): https://musescore.com/bsg/scores/5571862 .
Then answer as to whether or not this is useful.
Comments
And...you added it to: https://musescore.org/en/plugins ?
In reply to And...you added it to: https… by Shoichi
I wanna hear some discussion first. This is an obscure thing, baton ballistics.
In reply to I wanna hear some discussion… by [DELETED] 1831606
Then we wait hopefully, thank you.
In reply to Then we wait hopefully,… by Shoichi
Inserting these two lines
var x = (cursor.tick - sel.start) / durationTicks;
var newTempo = (x**2.5) * tempoRange + startTempo;
in place of
var newTempo = ((cursor.tick - sel.start) / durationTicks * tempoRange) + startTempo;
in TempoChanges.qml are all you need (2.5 or whatever) to experiment with it yourself. The original line is misparenthesized (but not buggy) anyway.
Essay question: is this a change that the current maintainer should integrate, or a conceptually new bizarre feature? I.e., is it so bizarre and hard to understand that it would lessen rather than enhance the value of the current plugin?
I really need guidance on this (new "nonlinear tempo change plugin" or change existent plugin source (how would one do that?)). Is there a place/API where a plugin can store/restore parameters (e.g., I would far prefer quarter=60 rather than 120 as a default start-tempo).
In reply to I really need guidance on… by [DELETED] 1831606
Check the batch export plugin on how to (re)store settings (I've implemented that so long ago that I don't remember myself ;-))
In reply to Check the batch export… by Jojo-Schmitz
I did -- is there any documentation on this settings system?
In reply to I did -- is there any… by [DELETED] 1831606
There sure is, but don't ask me where... IIRC on the qt website somewhere.
Edit: a quick Google brough up https://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html
Let's see if I can include my work as an attachment (a form of cheating, but this might help evaluate it). Ah, it liked it! So download away and have fun....
It is worth noting that was unable (by request) to make this work in MuseScore 2 because the version of QtScript/Javascript used there does not support the ** (exponentiation) operator, nor the function "exp" (but "log" is there), nor does the QtMath package seem accessible. That's actually a pretty severe set of flaws, but MS 2 can't really be an issue. Much more pressing is the problem of why I can't load the "standard" Tempo Change plugin in to MS 3.1!
In reply to It is worth noting that was… by [DELETED] 1831606
Hi, do you have a github account? If so, I'd welcome your changes to be integrated together with the pending PR from billhails.
Note that for the maths part, no Qt stuff should be required, but the default JavaScript maths should suffice (in this case
Math.pow(base, exponent)
should work)In reply to Hi, do you have a github… by jeetee
Hi, we should talk about this. The MS3 version uses "**", and works perfectly. Should we worry about MS2? Let me try Math.pow for my MS2 version. I do not have a GitHub account, and am not ready to get one. What is the PR from billhalls? (The note graphics other than quarter note are broken. Is that it?)
You think a fill-in box labelled "Exponent" is not too confusing for users who can't imagine what it is? I assume the default should be 1.0 (e.g., act as now). You should just pick up the changes I posted here, and change the default from 2.5 to 1 and ignore my changes to the description/header.
How shall we document this? A graph like this included should be included.
In reply to Hi, we should talk about… by [DELETED] 1831606
POW! Works like a charm. In general, I don't know where the boundaries between javascript, qml, and MS' deployment of qml lie, and pointers to documentation of any of these would be welcome.
In reply to Hi, we should talk about… by [DELETED] 1831606
His changes also add exponential as an input, with a slider that lets you set the midpoint of the curve.
It can be found at https://github.com/jeetee/MuseScore_TempoChanges/pull/11
I've plotted your exponent of 2.5 (curve 7) against his implementation, and you can notice you're quite close into the 75% curve (curve 3): https://www.desmos.com/calculator/lymxbfdizn
I'm currently working on changing the plugin layout to display that curve as a graph, with the slider underneath it. I'm wondering whether adding other curve types (quadratic?) would make sense as well.
In reply to His changes also add… by jeetee
Oh, if his stuff subsumes my stuff, then forget about my two lines. I'm going to try his; I assume there is a qml in his pr someplace....
In reply to Oh, if his stuff subsumes my… by [DELETED] 1831606
I don't understand those curves at all. I know no significance to the ratio of logarithms. What significance do you assign to p and q in log p/log q as an exponent?
In reply to I don't understand those… by [DELETED] 1831606
From the comment in his patch:
In reply to From the comment in his… by jeetee
So in that final formula, substitute x with the percentage of when the midpoint of the curve should be
In reply to From the comment in his… by jeetee
Yeah, I had just found it. This is superlative (although I think the 75% limit is bad -- unreasonable settings will produce unreasonable results, not harm men, women, and children). He's gone the whole way, and I wish I had known about this. Ignore my weak approximation to this masterpiece, and let's get this working under MS3. Documentation is still tricky. What has to be done to make this work in 3, just import-file version #changes?
In reply to Yeah, I had just found it… by [DELETED] 1831606
It also needs "remember my settings from last time". Does he fix the badly-displayed note symbols?
In reply to It also needs "remember my… by [DELETED] 1831606
@jeetee, Quadratic is just "exponent = 2" (in my formalism), .5*log(.5), i.e., 70.7% (sqrt(1/2)) within the slider in his. I tried e**x (scaled), which is *not* handled in either formalism, and it fell between 1.0 and 1.5 in a way that didn't seem to add any power (as it were).
I tried Bill's plugin. The effect is wonderful, but the implementation is deficient insofar as there is no numeric indication of the value you set in the slider, so you cannot tell it to someone else, or reproduce or conceptualize it on a subsequent use (save/restore value is another direction for improvement). It clearly needs a visual % field reflecting the slider, or even markings on it. Does billhall have an account on this site where I can contact him?
In reply to I tried Bill's plugin. The… by [DELETED] 1831606
https://musescore.org/en/user/1599906
In reply to https://musescore.org/en… by Jojo-Schmitz
He's missing a contact button. I wonder if he gets an e-mail if you type @billhails
In reply to He's missing a contact… by mike320
I PM'ed him; he seems recently active. Let's see where it goes. I suggested numeric feedback and expanding the range as I said.
In reply to I tried Bill's plugin. The… by [DELETED] 1831606
All I ask is a little patience whilst integrating this.
Working on the graphing part (currently linking slider with spinbox in both directions) slider is set from 1-99% in steps of 0.1:
In reply to All I ask is a little… by jeetee
that strange word once again, customers of a doctor, spelled wrongly ;-)
In reply to that strange word once again… by Jojo-Schmitz
GREAT (@jeetee)! I'll buy one! Carry on!
In reply to GREAT (@jeetee)! I'll buy… by [DELETED] 1831606
Here is a beautiful short score I just created with two nonlinear ritardandi al potenzà due e mezzo (marked with paramters) that demonstrates how easy and terrific the effect. https://musescore.com/bsg/scores/5578813 .
In reply to All I ask is a little… by jeetee
Should it not be system text?
In reply to Should it not be system text? by ♪𝔔𝔲𝔞𝔳𝔢𝔯 ℭ𝔯𝔞𝔣𝔱𝔢𝔯♪
In reply to What? huh? What be system… by [DELETED] 1831606
the rit. should be system text, but plugins don't allow system text.
Reporting this on Jeetee's orginal plugin was the first time I ever visited the forums.
In reply to the rit. should be system… by mike320
Why can't they make system text? Tempo changes are system text.
In reply to Why can't they make system… by ♪𝔔𝔲𝔞𝔳𝔢𝔯 ℭ𝔯𝔞𝔣𝔱𝔢𝔯♪
Because the plugin framework currently doesn't allow for that.
@BSG... I just came across this post.
You wrote:
I find that 2.5 gives an effect quite more pleasing than the current 1.0.
So, for a 2.5 ritardando, you arrive at half the initial BPM value later (in time) than for a 1.0 ritardando. Yes?
Using your graph screenshot (as I, too, don't understand those other curves):
I hope the axes are labelled correctly.
Regards.
P.S. (I also realize that jeetee and billhails are working on this.)
In reply to @BSG... I just came across… by Jm6stringer
That's exactly right! You must understand my graph if you so labelled it. The billhails plugin, now in jeetee's version in progress, lets you move the half-way point along that middle axis you drew. Measuring time from 0 to 1, it gives you that*100 (i.e., percent). My 2.5 is his 75%, as is very clear from your enhancement of my drawing! I assume you listened to my new little score that uses 2.5 ritardandi.
In reply to That's exactly right! You… by [DELETED] 1831606
I don't think of it as "where it places the halfway point", but, equivalently, "does more change get bunched up at the beginning, the end, or not at all"?
In reply to I don't think of it as … by [DELETED] 1831606
I just wanted to be crystal clear about this function, and so I enhanced and labelled your graph.
Jeetee's use of the midpoint as the adjustable parameter (in his illustration) seems simple enough (if a user has a clear understanding of its function - whether pondering the BPM midpoint or, by logical extension, where the BPM change gets 'bunched up' ).
It truly will be an elegant and sophisticated playback feature.
Regards.
In reply to I just wanted to be crystal… by Jm6stringer
Your enhancement of my graph is crystal-clear. As I've said a couple of times already, documenting this so that its ease of use surpasses its seeming obscurity, in an age when no one even reads documentation, is going to be a challenge. It really involves the third derivative of position, i.e., how the acceleration/deceleration behaves.
In reply to Your enhancement of my graph… by [DELETED] 1831606
An interesting fact is that that graph is still extremely relevant to understanding the effect of jeetee's plugin, although labelling the curves with their generating exponent would no longer be useful (except to those with math backgrounds wanting to understand its means).
In reply to An interesting fact is that… by [DELETED] 1831606
An interesting fact is that that graph is still extremely relevant to understanding the effect of jeetee's plugin...
Indeed, as presently, only the graph's curve #1 - that is, the strict linear change of BPM over time - is used by MuseScore.
(BTW: Your nonlinear ritardandi al potenzà due e mezzo has quite an effect.)
In reply to An interesting fact is that… by Jm6stringer
Molte grazie.
Sneak preview attached.
Still have to integrate settings into this, but it's a really busy week for me..
In reply to Sneak preview attached. … by jeetee
Here are my observations on the preview:
Note-value dropdown shows squares with question marks (still),
Notes barely visible in dark mode, but I don’t know what you can do about that.
At first I thought the graph wasn't there, but it's just very dark (purple) in dark mode - s/b white etc.
Does qml even know it's in dark mode?
Spinner increments are 1.0, not 0.1 as you said.
“Linear” vs “Exponential” is not quite right; the opposite of “linear” is “custom”, “custom power’? Maybe you should add “Quadratic” (expt=2, = 70.7% (sqrt(.5)), as well, so it is clear what is being adjusted/customized.
If the dropdown is “linear”, the slider and spinner should say “50%”, no?
In reply to Here are my observations on… by [DELETED] 1831606
Note-value dropdown shows squares with question marks (still)
Nothing was done on that front. It seems to be a Qt/Mac only issue: See also https://musescore.org/en/node/283404#comment-912984
Dark mode
Currently the plugin isn't aware yet, but I'll add that. Then perform some explicit styling on the dropdown and change the line color of the graph to something brighter when in Dark mode.
Spinner increments are 1.0, not 0.1 as you said.
Noted, will fix that
“Exponential” is not quite right
Correct, not sure which term would be better. Technically it's a special case of "Monomial" allowing non-integer exponents, but I doubt this means anything to a musician.
Perhaps "Linear/Curved" suffices?
If the dropdown is “linear”, the slider and spinner should say “50%”, no?
It could; currently both get disabled when you select Linear; but for the slider that's stylistic apparently totally unnoticeable.. The reason for possibly not doing so is to keep and (re)store the % easier when you switch back to "Curved" mode.
In reply to Note-value dropdown shows… by jeetee
If "monomial" means nothing to a musician, so does "exponential". Shaped, custom, controlled, nonlinear ("linear" is there already). i understand the problem with .5; maybe the slider should be hidden when in "linear"? Let's keep thinking about the name. Note that in dark mode, the color of the "note" should change, too.
Maybe the broken menu with the notes should have words ("dotted quarter"), too, until fixed. Not otherwise usable on the mac unless you try them all.
In reply to If "monomial" means nothing… by [DELETED] 1831606
"Accelerating" (although that could mean "stringendo", while, in fact, it's the deceleration rate which is accelerating").? "Accel/Decel"? The somewhat mysterious "algebraic"? "Power-law"?
In reply to Sneak preview attached. … by jeetee
Why isn't it possible to figure out what the starting tempo is from the score?
In reply to Why isn't it possible to… by [DELETED] 1831606
It should be.
I've logged it as https://github.com/jeetee/MuseScore_TempoChanges/issues/12 so it won't be forgotten.
In reply to It should be. I've logged it… by jeetee
Thank you for these response - eagerly looking forward.
Here's a somewhat related question. I'm a career programmer with very substantial skills, but I find programming in the extension environment onerous -- no breakpoints/eval, no search in editor, no clear documentation of the language (js/qml/ms boundaries) -- do you have any tips or tool recommendation?
In reply to Thank you for these response… by [DELETED] 1831606
Finally got around to including this small convenience in the current update as well. Both start and end tempo are being considered and prefilled if found. The ensures that opening and rerunning the plugin on the same selection will maintain start and end tempo. Thus allowing easier testing of different curves for the transition.
In reply to Finally got around to… by jeetee
What do you mean by "if found"? Does it figure out the regnant tempo at the beginning? Please elucidate.
In reply to What do you mean by "if… by [DELETED] 1831606
For start tempo, the plugin assumes
1/4 = 120
hardcoded (which is the current hardcoded default in MS2 & 3 if no marker is present). It looks backwards from the start of the selection to locate the most recent tempo marker; if one is found, its value overwrites the assumption of 120bpm and that new value is put as the placeholder.Similar for end tempo, the plugin hardcodes a default of
1/4 = 60
, but also searches for a marker starting at the end of the selection. If such a marker is found, its value is used instead.In reply to For start tempo, the plugin… by jeetee
Fabulous! Couldn't ask for more! Thanks!
In reply to Fabulous! Couldn't ask for… by [DELETED] 1831606
This or something like it belongs in the documentation (both).
In reply to This or something like it… by [DELETED] 1831606
Plugin page updated
In reply to Plugin page updated by jeetee
Does it use the correct units (i.e., if not quarter-note), or at least force the unit to quarter-note for a start.
In reply to Does it use the correct… by [DELETED] 1831606
It should match the beat selected in the dropdown (which by default is the quarter note).
Detecting the used beat marking is still on the future to-dream list ;-)
In reply to It should match the beat… by jeetee
So is the formula, "Invoke it, if you don't like the unit it has chosen, choose the right unit, close it, and re-invoke?" or is there anything simpler? Perhaps GUI change of note unit should prompt re-evaluation of the context?.
In reply to So is the formula, "Invoke… by [DELETED] 1831606
That's indeed the current workaround then.
I've raised both issues as https://github.com/jeetee/MuseScore_TempoChanges/issues/21 and https://github.com/jeetee/MuseScore_TempoChanges/issues/22
The goal is to not keep you waiting for another year for a minor update doing those ;-)
In reply to That's indeed the current… by jeetee
In reply to yup. 2. yup. 3. yup. by [DELETED] 1831606
Done
In reply to Done by jeetee
It doesn't cure the plague or bring peace to the Middle East, but this is pretty damned fantastic. It does work as claimed. Many thanks for your quick response!
In reply to It doesn't cure the plague… by [DELETED] 1831606
Doc should say, "hit APPLY or the ENTER key."
In reply to Doc should say, "hit APPLY… by [DELETED] 1831606
Better now?
In reply to Better now? by jeetee
Yeah.
Change " tempo of MuseScore (1/4 = 120) is suggested." to " tempo of MuseScore (1/4 = 120) is used."
"Is suggested" sounds like you're suggesting to the reader/user for action he or she should take.
In reply to Yeah. Change " tempo of… by [DELETED] 1831606
Or perhaps "is used by default" or simply "defaults to".
I went with suggested as it is the fields placeholder value that is adjusted at that moment, thus a suggestion. But perhaps a user doesn't care about the technical triviality of such a difference..
Attached is a 10-line python program I have and have found useful to convert back and forth between half-%'s and exponents (the single argument is a number, which, if > 10 is the former, else the latter) (rename from ,txt).
In reply to Attached is a 10-line python… by [DELETED] 1831606
What is the status of this work? I'm very happy using your "sneak preview", but it'd be cool if others had it, too; it seems so close to "done"... save/restore settings would be great, but it could live without it. I'd be happy to help contribute to the documentation.
In reply to What is the status of this… by [DELETED] 1831606
Sorry for the radio silence.
Currently dealing with the recordings of a choir concert from last Saturday. I expect to pick this up again over the weekend and will release "as is" by the 9th of June if I can't polish it before then.
In reply to Sorry for the radio silence… by jeetee
OK, then, thanks. How are you going to document it (i.e., motivating the need and explaining the model for the "General Theory of TempoChange")?
In reply to Sorry for the radio silence… by jeetee
C'est aujourd'hui le neuf Juin, as we used to say in French class ....
In reply to C'est aujourd'hui le neuf… by [DELETED] 1831606
The day is not yet over ;-)
In reply to C'est aujourd'hui le neuf… by [DELETED] 1831606
Ah well.. who listens to the French anyway ;-)
Kidding aside, v3.1.0 has been officially released now. Updated the plugin page here on MuseScore with some new screenshots as well.
With regards to theming: whilst the plugin could access the MuseScore theme style property, it is unable to further access the value within the property at this point within the plugin framework.
Instead I've chosen to manually (and fixed) style the graph to something that probably looks best in place in the dark theme, but doesn't screw with you in the light theme either. Similarly, I've forced the slider style as well, which did allow me to better distinguish it's enabled/disabled state.
For the beat duration dropdown, I've forced the text color to black, to make it at least readable in the dark skin as well.
The plugin should now also remember it's linear/curve preference as well as the midpoint value associated with the curved option.
It has not yet been ported to v2.x
In reply to Ah well.. who listens to the… by jeetee
This is pretty terrific. I'll try it out and evangelize it, as they say. While the description is good, I think it should at least have something of an attempt at a technical explanation. First draft: The tempi are accelerated or decelerated according to a power curve of variable exponent; when the slider is at 50%, the exponent is 1.0, i.e., the tempo change is linear. This is similar to algorithms employed in other score editors.
In reply to This is pretty terrific. I… by [DELETED] 1831606
Definitely nicely visible in dark mode, works as advertised. Would have liked the start/end to be saved/restored , but this is terrific. Many thanks!
Released a v2 compatible version.
Updated https://musescore.org/en/project/tempochanges with a link to an interactive explanation on the maths, inspired by the graphs and explanations provided by you guys :)
In reply to Released a v2 compatible… by jeetee
Just magnificent, could not be better, thanks!
In reply to Just magnificent, could not… by [DELETED] 1831606
Small doc page issue -- the number which is juggled (whose log or power is taken) ranges from 0 to 1.0 -- the "slider value" is 0 to 100.
In reply to Small issue -- the number… by [DELETED] 1831606
Math technicality, slider value goes from 1-99%, so 0.01 to 0.99 value :-p
In reply to Math technicality, slider… by jeetee
Mathematicians use fractions, not %. It should say '''100% (i.e., 1.0)" somewhere to make this explicit. One can raise fractions to powers, but not "percents".
In reply to Mathematicians use fractions… by [DELETED] 1831606
A percentage is a fraction though, that's kind of the definition of "per cent"
In reply to A percentage is a fraction… by jeetee
Yes, I know: I hold degrees in engineering from reputable universities, which is also why I prefer putative mathematical expositions to be exact. The "slider reading" is a number between 0 and 100. Raising it to a power is not well-defined, norI would I listen to anyone who said "the logarithm of fifty percent".
In reply to A percentage is a fraction… by jeetee
Thoroughly enjoying the banter here in the forum... :-)
From:
https://musescore.org/en/node/289292#comment-920425
...documenting this [model for the "General Theory of TempoChange"] so that its ease of use surpasses its seeming obscurity, in an age when no one even reads documentation, is going to be a challenge.
A sad, but true, assessment :-(
From:
http://jeetee.github.io/MuseScore_TempoChanges/
"In curved mode, the plugin allows you... to set the halfway point of the transistion. That way you can decide whether the biggest part of the tempo change happens sooner or later."
So... "ordinary" lingo to the rescue.
;-)
In reply to Enjoying the banter here in… by Jm6stringer
I tip my hat to jeetee's excellent common-language translation. It is quite wonderful.
In reply to Released a v2 compatible… by jeetee
I really enjoy this improvement, beautiful effect ! Chapeau bas et merci.
French translation updated in your repository:
https://github.com/jeetee/MuseScore_TempoChanges/pull/15
In reply to I really enjoy this… by JLWaltener
Thank you!
Merged and released.