Can't paste lyrics into tuplet

• Mar 27, 2015 - 15:50
Type
Functional
Severity
S4 - Minor
Status
closed
Regression
No
Workaround
No
Project

A nice feature of MuseScore 2 is the ability to select some lyrics from one staff, copy the selection, and then paste it to another set of notes (on the same or different staf) by selecting the first note of the desired paste location and then doing a paste operation. This works in general but does NOT work if the first note of the paste location is in a triplet. I get an error message, "Cannot paste into tuplet". (There is no problem if the triplet is not the first note of the paste location). Furthermore if I attempt to do the same thing with a tuplet other than triplet (e.g. a duplet or pentuplet), the paste operation fails but does not even produce the error message.


Comments

I can confirm the first issue - I get the dialog on pasting if the first pasted note is a triplet. But I also get it for a quintuplet. Are you on the latest build? If so, can you post the specific score where you are getting a failure with no dialog, and precise steps to reproduce that problem?

I was using the MuseScore official release. I've now repeated the experiment with the most recent nightly for mac (2015-03-27-1017-a249aea.dmg), and with that I get the same result as you, I get the error message "can't paste into tuplet" for seemingly any tuplet. I guess that's a bit of an improvement over not getting any message.

I've noticed that the problem however is not limited to lyrics. It also applies to notes. If I copy any sequence of notes (including, possibly, tuplets) and click on any note anywhere in a score except a tuplet, I can paste that sequence of notes starting at that position. But I can't do it if the note I click on to start the paste is part of a tuplet; I get the same error message "cannot paste into a tuplet".

This restriction is peculiar -- there seems to be no problem pasting into a tuplet so long as the paste doesn't START in the tuplet. In fact MuseScore may well proceed with something incorrect in that case: For example, paste a sequence [quarter note - eighth note] into a sequence [quarter note - triplet of eighth notes]. The result seems to be a quarter note followed by an eighth followed by the third of the original triplets -- leaving out 1/6 of a beat. See the attached pdf file, where I pasted the two notes of the top staff into the middle staff, and the result is what is shown in the bottom staff.

Attachment Size
tripletpaste.pdf 30.52 KB

The intent of the restriction is simple - it is to prevent the corruption that would inevitably results from pasting, say, a half note into the middle of an eighth note triplet, or from attempting to copy just the first three notes of a quintuplet. However, detecting *exactly* the cases that are destinated to fail is harder than it seems, so the code errs on the side of safety. or at least tries to. Apparently you've managed to find one case we still don't handle correctly. Can you file a separate bug report on that, with precise steps to reproduce?

Meanwhile, the restriction on pasting into tuplets probably need not apply to lyrics, so even though the restriction in general is by design, it probably could be improved when copying lyrics or other individual elements.

A problem with the adopted approach RE pasting into triplets is that it arbitrarily rejects pasting some material into a note in the tuplet, but not a longer sequence that ends with the identical copied material and the identical paste target as subsets. So I would think that any musically illegal operation that has been excluded by the "can't paste into tuplets" rule can still be made to happen. Yes I will file a separate bug report, which will include repeating the previous two sentences.

Meanwhile I hope the restriction will be relaxed for lyrics at least. I can imagine quite a few use scenarios where one would like to be able to paste lyrics into triplets. Example, polyphonic choral music, where one or more voices have a phrase starting with a triplet, and the voices share common lyrics, possibly staggered, but rigorously one syllable per note. One would like to be able to enter lyrics for one voice, copy, and paste into the other voices. As things stand now I would have to first enter the lyrics for the voice that starts with the triplet, then copy/paste into the other voices. And if one of those other voices ALSO starts with a triplet, I'm out of luck.

In thinking further I don't see why the restriction should be there at all. Looking at your examples, there is a legitimate (though not pretty) thing to do in each case. For pasting a half note into, say, the second note of an eighth note triplet, the result should be an eighth + quarter note triplet consisting of the original first eighth note plus a quarter note at the pitch of the copied half note, with the latter tied to a (non-triplet) quarter note at the pitch of the copied half note, tied to a triplet-ized eighth note. (If what was in the last position was a quarter note, this triplet-ized eighth note would be under a triplet bracket with a quarter note at the same pitch as the pre-paste quarter note; if what was in that position was an eighth note, then the triplet-ized eighth note would be under a half-beat triplet with the remaining portion of the pre-paste eighth note, which would now be a triplet 16th note.) Quite generally, the image of the paste extends to a well-defined and notatable portion of a note in the pre-paste music. It seems that MuseScore should be able to "do the math", and hence replace notes that are fully subsumed by the paste with the pasted material, and a final note that is partly subsumed by the paste with the end of the pasted material plus the appropriate fraction of the original note. Same principle applies to your part-of-a-quintuplet example.

OK, you may be right that it is always (or at least usually) *possible*. But possible isn't the same as easy to implement :-). 1.3 and previous releases were *full* of corruptions like the one you discovered here. It is far easier to disallow the operation than to figure out how to correctly handle all the cases that arise. But if you are handy with C++, feel free to give it a shot!

OK, challenge accepted! I have been intending, for over a year, to start making some contributions (other than bug reports) to MuseScore, but other things have gotten in the way. I'm up to my ears for the next month, but If someone hasn't tackled this by May I'll see if I can learn my way around well enough to contribute something. But my basic concern is that the present restriction really doesn't solve anything, since any mischief one could do by starting to paste in a triplet could equally well occur as part of a longer paste starting before the triplet.

Great, we look forward to your contributions! Let me know if I can help.

But FWIW, it *shouldn't* be the case that problems could occur in a longer paste starting before the tuplet. The contents of the destination are are effectively deletes before the paste, so as long as the paste does not start or end within a tuplet, there *should* be no problems. The restriction really does solve quite a number of corruption problems that would otherwise occur (do a search of the issue tracker for "tuplet" and see how many of these corruptions there were as recently as the beta 2 and even the RC, that were fixed before the release by simply adding more checks!

It seems to me that for any bad situation you precluded involving a paste that starts in the middle of a tuplet and extends beyond the end of the tuplet, there is (to borrow a word from serial music) the retrograde situation -- a mirror image paste that starts before the tuplet and ends in the middle of it with exactly the same problem. Right now you don't disallow any such paste.

Maybe the easiest fix that would allow most "legal" situations is, rather than to exclude any paste that starts anywhere within a tuplet, is to check to see if a paste starts or ends in the middle of a tuplet and just disallow those. In particular allow pastes that start on the beginning of a tuplet OR before the tuplet so long as they extend to at least the tuplet's end. I appreciate that there is a potential problem of a paste that would end in the middle of the last note of a tuplet -- e.g. pasting 4 notes of a quintuplet into a triplet, starting with the first note of the triplet -- so the check has to be that the paste extends fully to, or beyond, the end of the target tuplet. (That's a potential problem with the current coding as well.)

I think you are correct that we are currently failing to detect the case of a paste whose *destination* ends within a tuplet, hence the bug you discovered. We do detect the case where the *source* ends within a tuplet, and that check does indeed only disallow pasting from the middle of the tuplet - a paste that starts on the first note of tuplet or ends on last note is fine. That code is working pretty well now as far as I know; those were where the bugs I fixed recently were. But the *destination* check is apparently nowhere near as good.

FWIW, disallowing pastes *into* tuplets should be less of a concern in practice - if you are planning on pasting over that section anyhow, you could simple delete the destination content first. So being a bit overly cautious isn't so problematic - except in as much as it also deletes the lyric pasting, which shouldn't actually need to care about this at all since it isn't rhythm-based but rather sequence-of-notes-based. I suspect it currently does because the same code handles chord symbols, which are rhythm-based.

Status PR created fixed

Fixed in branch master, commit 5f079ced2c

_fix #52906, fix #279990, fix #288019: relax restrictions on pasting to tuplets

1) Pasting symbol lists (lyrics, dynamics, chord symbols etc.) to
tuplets work correctly so we don't need to impose any restrictions
here.

2) Pasting a staff range to the first chord/rest of a tuplet correctly
replaces the tuplet with the clipboard content. We need to restrict
pasting a range only if trying to paste to the middle of a tuplet._

Fix version
3.3.3