Is note offtime limited?
I have a guitar "let ring" plugin which extends the length of notes by adjusting the MIDI offtime. However, there seems to be an internal MS limit on the value of this offtime set at 2000. I found this by narrowing my "RingTime" value down and any values above 2000 are simply ignored. I have not put in any code to limit this value so could you confirm that this is indeed some sort of internal limit?
Comments
~~Might be a limitation in the UI file~~
OK, forget about this, it is your plugin, nit a UI file from MuseScore
You can't set offTime from a plugin, but you can setLen and that one indeed is clipped to 2:
https://github.com/musescore/MuseScore/blob/c9f8a138529c15bf9d096e53a4a…
In reply to You can't set offTime from a… by jeetee
Yes, it's actually the length, not the offtime. What's the reason for this particular limit? Could it be set in the MS.ini file rather than hard-coded?
In reply to You can set TimeOff from a… by yonah_ag
I have no idea.. the limit seems to be imposed on the pluginAPI only.
Similar onTime is limited to [-2000, 2000]
But no such limit exists directly in libmscore itself.
In reply to I have no idea.. the limit… by jeetee
Of course you can set offtime from a plugin (via manipulating the length); that is the basis of the articulation plugin. Yes, it is clipped to 2000 to prevent chaos from typos (or buggy plugins).
In reply to Of course you can set… by [DELETED] 1831606
[.]
In reply to You can set TimeOff from a… by yonah_ag
This was implemented in PR #5224, which is fairly recent (July 2019). You could ask DLLarson about the reason for the limit.
In reply to This was implemented in PR … by Spire42
It is exactly what I said. I suggested it. It is to limit the ability of a buggy plugin or user input to corrupt the application,
In reply to It is exactly what I said. I… by [DELETED] 1831606
Fair enough. It would be more flexible if it was set as an initialisation constant rather than hard-coded, with the default set to 2000. This would enable debugged plugins a bit more scope. I can use a workaround to get higher values but it's a bit clunky.
In reply to Fair enough. It would be… by yonah_ag
Then again (from the POV of notation software) if you have to double the note duration without affection notation, there's likely something wrong with the notation...
Why not change that instead?
After all, all you'll end up with is MuseScore playback not matching what a real player will play when it read the sheet music; isn't it?
In reply to Then again (from the POV of… by jeetee
I originally went down this route, (a couple of years back), but it led to a lot of tied notes or guitar tabs in 4 voices – which causes issues with stems. After taking onboard advice from the forums I now tab in just 2 voices which makes scoring easier at the expense of playback.
I would use the "Let Ring" option from the "Lines" palette but that option has faults, is slow to apply and intrusive on the display – hence my own plugin, which actually gets the playback closer to a real player.
For example a quaver played by a real player will naturally sustain beyond its written length unless stopped by another fret or a change in chord etc. A quaver in MS will decay pretty quickly after its written length.
Some of the background to this:
https://musescore.org/en/node/286670
In reply to I originally went down this… by yonah_ag
Thanks for clarifying the use case. You might've guessed I'm not really a guitar player :D
I for one see no harm in lessening the plugin API restrictions on that setting.
In reply to Thanks for clarifying the… by jeetee
I agree. But what should the new limits be?
Maybe [-10000, 10000] for
onTime
and [0, 10000] foroffTime
?Or maybe [-10000, 10000] for both
onTime
andoffTime
, with the additional restriction thatonTime
<=offTime
?In reply to I agree. But what should the… by Spire42
How about putting the limits in the MS ini file, (with the default at 2000), rather than it being hard-coded? This default could be changed by editing the ini file manually or via preferences.
In a 4/4 score a value of 4000 makes sense, i.e. a notated crotchet can playback for the whole measure.
For a quaver a value of 8000 would achieve the same. I haven't seen the need to extend semi-quavers this much so maybe there's no need to go to 16,000.
So I would suggest 8,000.
In reply to How about putting the limits… by yonah_ag
Not all music is in 4/4. This strongly suggests that some better mechanism is needed.
In reply to Not all music is in 4/4. … by [DELETED] 1831606
It was just an example to show my reasoning. I also use it in 3/4 and 6/8 but I think that the mechanism is still valid, just need to define reasonable limits.
In reply to It was just an example to… by yonah_ag
Sure, but long measures (8/4, 8/2) are not uncommon, esp in older music. Sixteenth-notes in them?
In reply to Sure, but long measures (8/4… by [DELETED] 1831606
Point taken, but hopefully there would not be much requirement for a 1/16 note to ring for the whole bar. This effect only makes sense for instruments which can sustain beyond their notated value, like guitars.
Is there perhaps a limit which is defined by the MIDI specification?
In reply to I agree. But what should the… by Spire42
What is the use of a negative off-time other than trying to crash the midi code?
In reply to What is the use of a… by [DELETED] 1831606
Author a second track with the notes as you want them to be heard (as I sometimes do when there is very complex ornamentation).
In reply to Author a second track with… by [DELETED] 1831606
Yes, that's another possible solution but feels a bit overkill for a simple guitar ring. I'm using my plugin for speedy and clean application of rings @ 2000.
3000, 4000 and 8000 can be applied via a regex, (of 1003, 1004, 1008), on the music XML file.
My scores are really simple, especially compared to some of yours.
In reply to What is the use of a… by [DELETED] 1831606
How is
offTime
defined? Is it specified relative to the nominal start of the note, or is it relative to the effective start of the note (i.e., the nominal start of the note plus the specifiedonTime
offset)?I was assuming it was the former, in which case it would make sense to have, say, an
onTime
of -1000 and anoffTime
of -800. (This would result in a note that starts playing 1000 units before the nominal start of the note and plays for a duration of 200 units.)But if it's the latter, it would indeed be meaningless to have a negative
offTime
value.In reply to How is offTime defined? Is… by Spire42
The plugin code has:
var events = the_note.playEvents;
var pe0 = events[0];
onTime.text = pe0.ontime + "";
offTime.text = (pe0.ontime + pe0.len) + "";
These are displayed in read-only fields, (blue), and the RingTime field has the user input for the new value of Offtime. From my own scores the Ontime is always zero and Offtime > 0 but this is not enough info to answer your question so maybe someone with more MS knowledge can clarify.
In reply to How is offTime defined? Is… by Spire42
Internally one can't set offTime; you can set onTime(int) and setLen(int) for which the latter should be limited to be strictly positive imo.
In reply to Internally one can't set… by jeetee
The Piano Roll editor speaks in terms of onTime and Length. This is wrong, IMHO. OnTime and OffTime are intuitive, and the Articulation Plugin negotiates in terms of them. The internal representation doesn't matter in the UI decision.
In reply to The Piano Roll editor speaks… by [DELETED] 1831606
True.. I was more responding to Spire's inquiry about what the internal limitations are, so the plugin API might be updated to match those.
In reply to The Piano Roll editor speaks… by [DELETED] 1831606
@BSG – Totally agree! After all, my plugin is simply a tweaked version of your Articulation plugin. Thanks for said plugin as it was most useful and I learnt a lot. I hadn't come across passing a function name as an argument before so that bit of code had me scratching my head for a bit.
The plugin does ultimately set LEN but it "thinks" in terms of OnTime and OffTime. LEN definitely should be positive only.
In reply to Totally agree! After all, my… by yonah_ag
Songs of old Lisp programmers ... (It's not the function name you're passing, but the function).
In reply to Songs of old Lisp… by [DELETED] 1831606
It's very handy.
In reply to I agree. But what should the… by Spire42
I'm not convinced the plugin API should impose limits on these values that internally don't have them.
In reply to I'm not convinced the plugin… by jeetee
Negative values?
In reply to Negative values? by [DELETED] 1831606
I can't see a use for negatives but perhaps the only upper limit should be that of the MIDI specification.
Campaign for the removal of the 2000.
BSG has repented of this limit!