Copying from within a tuplet bracket to the same or another or to a normal rest produces strange results

• Jan 26, 2012 - 09:01
Type
Functional
Severity
S4 - Minor
Status
closed
Project

There are many bugs on triplets, so please forgive me if I'm reporting a duplicate here.

Open the enclosed score. Select the 1/8 triplet. Cut. Select a rest, any rest, and paste.

Result, a 1/4 triplet is created. If you past onto the last 1/8-triplet rest in the bar 2, bar 3 is affected.

WIndows XP, MuseScore 1.1

Attachment Size
bug 2.mscx 26.23 KB

Comments

Here is an even worse one:

Open bug3 (enclosed)

Select one 1/8 triplet. Shift click to select both notes. Cut. Then paste onto another 1/8 triplet rest. Mayhem!!

Windows XP, MuseScore 1.1

Conclusion: You can't cut/paste triplets reliably, so the only way to do it is delete and recreate, and that's very very clumsy.

Attachment Size
bug 3.mscx 26.28 KB

Mayhem indeed - the second example not only corrupted the score, but it locked up MuseScore!

I think many of us have long seen problems involving cut and paste of partial triplets (copying the full triplet doesn't seem as trouble-prone). But I don't know if anyone had ever come up with such a simple-to-reproduce case before. I've just verified I can get the same thing starting from scratch and reproducing your initial score myself, so it's not a case of there already being some hidden corruption in your sample.

I sure hope this turns out to be as helpful as it seems like it could be!

Was all this corruption caused by copying the entire 3-note triplet, or partials? I also reported in an issue some time ago on the incredible mess that copying partials will cause, and how it will affect (corrupt) all bars forward of the copy.

I was copying one note only, I guess that's what you refer to as partial.

Yes, it causes incredible mess and corruption. The two examples I posted here are the simplest that can demonstrate the problem.

Can you point us to the issue you reported, please.

No, I can't find the posting anymore. I've looked through "My Recent Posts" and searched for it but nothing.

Basically I (thought) I said that copying of a partial tuplet should either be disabled, or the entire tuplet copied, or create a tuplet structure the same as the source and paste the single note into that tuplet. One other method to prevent this is to convert it from a tuplet note to that of a normal note, so an eighth tuplet would be an eighth note, not some fractional.

This is probably one of the nastiest lingering bugs in MS. Tuplet issues certainly constitute many of the corruption posts.

In reply to schepers:

Since MuseScore has no way to move notes around in a bar, the only way to change the rhythm and put them into a different place is by cut & paste. If the destination rest has the same length as the source note, there is no reason to disable this operation.

in reply to chen lung:
The first of these posts reports the second issue I reported, just with a far more complicated score.
http://musescore.org/en/node/9297
http://musescore.org/en/node/9909

I only tired triplets, since triplets are widely used in jazz/swing/blues. IMHO they represent 99.37% of all tuplets.

I tried the nighly build R5253 and it behaves just the same as 1.1, which is rather sad, since these issue causes corruption and need for rework/recapture.

I forgot to mention that undo also behaves strangely after the triplet paste problem.

The various reports go back to the beginning of 2011, so about one year ago.
The issue is marked "critical" and causes serious corruption.
The issue is easily reproducible with one single note or two notes (and a few rests) in the entire score.

Should that not be something high on the list of issues to fix?

"Since MuseScore has no way to move notes around in a bar, the only way to change the rhythm and put them into a different place is by cut & paste. If the destination rest has the same length as the source note, there is no reason to disable this operation."

Working in the latest v1.2 (around build 5244) and in the trunk (R5256), if you copy a tuplet note (not the entire tuplet) and paste, it will paste a quarter note. It thought it used to paste a fractional and cause corruption. Maybe things have improved?

(I am surprised to just find out that the latest v1.2 can't copy an entire tuple onto a rest, nor any measure with a tuplet in it to another measure. It simply crashes... one for the issue tracker if its not already posted.)

The second issue reported her is a duplicate of #9909/#9297, the first issue isn't.
This report is easier to understand.
IMHO it doesn't matter as long as the issue is addressed and not dormant like in the last year.

There's a lot of issues, but with 2.0 coming this year, it probably will be fixed :).

What issue are you referring to that isn't a duplicate?

I can't reproduce the one in the first post (using 'bug 2' file).

Using MuseScore 1.1 and 2.0 Nightly Build (5255) - Mac 10.6.8.

Well, I reported two issues. For the first issue I submitted "bug 2" and it looks like this:
NOT FOUND: 01
NOT FOUND: 02

The second issue (which has been reported before in #9909) uses "bug 3" and looks like this:
NOT FOUND: 03
NOT FOUND: 04

Marc Sabatella reproduced the issues.

They both exist in Nightly Build R5253.

So I don't share your assessment that the bug will be fixed. As far as I can see, it's not been addressed.

Attachment Size
issue2-after.png 8.32 KB
issue2-before.png 6.53 KB
issue1-after.png 7.51 KB
issue1-before.png 7.06 KB

With all due respect.
This is NOT a duplicate.
As far as I can see, issue 1 has not been reported before.
Can it be changed back to "active" so it gets some attention one day?

You're talking about very basic functionality here: "Cut and paste". And that crashes or corrupts your document.

Title MuseScore becomes confused when copying triplets, they are copied at double the length Cut triplet is pasted with double the length
Status (old) duplicate active

(Hope the issue title is better?)

Regarding issue one, I reproduced once I believe (can't remember how), but the reason I'm having trouble is because of this: #14658: Cut or Copy on single tuplet has no effect

I now see it is different to issue two - thanks and apologies.

1) Does it affect tuplets overall, or just triplets?
2) Instead of cut, are you able to copy in your steps?
3) Could you open the attached score - cut (and/or perhaps copy) the triplet, select the following rest and paste, then upload the image of the result please?

Just because there hasn't been development towards a reported issue, doesn't necessarily mean it's being ignored ;). I know there's some basic things not here yet, but 2.0 is likely to address many of these issues - each release is getting better too.

Attachment Size
Triplet Test.mscz 1.51 KB

Tuplet problems are unlikely to get fixed for the 1.x branch.
The implementation is different in the current trunk (due to the many problems in 1.x) and fixes cannot be backported easily.
Regarding cut/copy it will not be possible to handle parts of a tuplet. On paste additional restrictions exist as it is not possible for a tuplet to cross barlines.

In reply to Werner:

Do I understand this correctly: It won't be possible to cut and paste a single note or chord which is part of a tuplet onto a rest of equal length?

No one wants them to cross barlines. It's just necessary to move them to a location with has the same duration.

I looked at it in the nightly build: Before the copy the note has 160 ticks, after the copy it's 320. So surely there is room for improvement.

In reply to Chen Lung:
1) No idea, as I said, triplets make 99.73% of all tuplets. You try it.
2) Cut/paste is just as bad as Copy/paste
3) See below.
NOT FOUND: 01

Attachment Size
tt.png 6.96 KB

jorgk3:

1) I can't really try it, as I encounter that bug (14658) ;).
3) Thanks. Did you select the rest after the first note? The pasted result doesn't appear to coincide with your report (here, it appears what was copied is pasted at half the length). Could you try with this attached score, please?

Werner:

I think it is possible to have tuplets cross a bar line, by using ties.

Attachment Size
Quaver In Triplet.mscz 1.54 KB

Chen Lung:

1) OK, just for you. I did it with quintuplets. I copied one from the first bar to somewhere in the second bar. Seems like the length of the copied note results in a 1/4 note.
NOT FOUND: 01
3) I pasted on to the second rest, not the first one. Pasting onto the first one looks like this:
NOT FOUND: 02

And with quaver triplets it looks like this:
NOT FOUND: 03

Attachment Size
quintuplets.png 6.76 KB
tt2.png 6.81 KB
tt3.png 6.82 KB
Title Cut triplet is pasted with double the length Tuplet pastes with different lengths

And lastly (I think), what about crotchets :)?

I think perhaps from either crotchet or minim onwards, the value halves when pasted.

3) Is it a crotchet or minim that was pasted?

Attachment Size
Crotchets In Tuplets.mscz 1.54 KB

3) the minim was pasted (of course)

As for the crotchets, they are fine, no surprise since everything is pasted as crotchet :-(
NOT FOUND: 01

Attachment Size
tt4.png 6.78 KB
Title Tuplet pastes with different lengths Tuplet pastes as a crotchet regardless

That's it - everything that pastes is a crotchet.

Thanks!

Title Tuplet pastes as a crotchet regardless MuseScore becomes confused when copying triplets, somtimes pasted at half length, sometimes at double, sometimes as crotchet

Sorry, not true.

In R5253 you can observe it in the debugger.
A 1/8 triplet has 160 ticks, sometimes it pastes as 320 ticks, so 2 1/8 triplets, sometimes as 480 ticks, so a crotchet.
And a chord of two notes of 160 ticks pastes as 240 ticks, so a straight 1/8.
Take a look at comment #15, there you can see the two cases. Nothing is pasted as a crotchet. It's somewhat random.

I think my initial heading "MuseScore becomes confused when copying triplets" was correct.

I think you need to specify a slightly more descriptive title yet. What you are doing is inter-tuplet operations, copying and pasting single notes from within tuplets but not the entire tuplet structure. The title seems to imply that simply copy/pasting a tuplet fails but that works OK.

I've been playing with tuplets (3, 4, 5, 6) for a bit. Any partial tuplet (single) note when copied and pasted outside of another tuplet (on any length rest), it pastes as a quarter (crochet?) note. When pasting inside of another tuplet, thats when things get very weird.

Title MuseScore becomes confused when copying triplets, somtimes pasted at half length, sometimes at double, sometimes as crotchet MuseScore becomes confused when copying from inside a tuplet bracket to inside a tuplet bracket - weird things happen

How nice, now we're discussing how to make the title more descriptive. I think we all understand what the problem is. But I'll give it another try.

Title MuseScore becomes confused when copying from inside a tuplet bracket to inside a tuplet bracket - weird things happen MuseScore becomes confused when copying triplets, somtimes pasted at half length, sometimes at double, sometimes as crotchet

I think it is unfortunate but understandable why these problems are unlikely to get fixed for 1.2, but I would agree with the suggestion that the operation simply be blocked. But even this could be done gracefully. Instance, hitting "copy" while a single note within a triplet is selected could simply autoselect the rest triplet, or clear the single note from the selection, before the "copy". Either way, there would be visible feedback to the user, and the subsequent paste would then actually have a chance of succeeding. Although I guess in cases where the copied source contains a (full) triplet, you'd also need to block attempts to paste to paste to anything but the same beat position as the source (that might be overkill, but it's simpler to describe and understand and presumably to implement).

Worst case, throw up an error dialog any time sometimes tries to do a "copy" involving a partial triplet saying the operation is not allowed, and similarly for attempting to paste a region containing a triplet to anything but the same beat position.

Title MuseScore becomes confused when copying triplets, somtimes pasted at half length, sometimes at double, sometimes as crotchet MuseScore becomes confused when copying from inside a tuplet bracket to inside a tuplet bracket - weird things happen

Yes, a proper and descriptive title is important.

No, I certainly didn't know what you were trying to do. I _never_ copy/paste inside tuplets as I know it doesn't work. Therefore I was copy/pasting whole tuplet groups, or a single tuplet note onto things outside of tuplets, not inside.

I do think Werner summed it up quite succinctly: "Regarding cut/copy it will not be possible to handle parts of a tuplet." Therefore I still think that copying a partial tuplet should be disabled.

Copying any set of notes to a different location (within reason) is essential. It's a very necessary feature and must not be disabled. Moving (by cut and paste) a "partial" triplet to a different location in the bar, for example, to where a rest of equal length is, it a normal and desirable operation required frequently to change the rhythm.

I tuplet is nothing strange, it's just a set of notes, which don't fall into the "natural" subdivision of the bar. But of course, it should be possible to move them elsewhere.

In fact, you can clearly define what should happen. Any note with face value 1/8 should be copied as 1/8 note always. If it comes from a triplet and is copied into a triplet, it maintains its original length. If it is copied into a straight section, it becomes a straight 1/8 and so on. The rules are pretty clear. You could issue a warning if the copy changes the effective duration of the note, or even disallow the operation.

Can you tell me how to change bar 1 to bar 2 without deleting the chords and entering them again.
NOT FOUND: 01

Attachment Size
tt6.png 6.43 KB

Well, I'm not Werner but his statement "Regarding cut/copy it will not be possible to handle parts of a tuplet." seems fairly clear. Unless he changes his stand on this, your arguing into the wind.

My old boss used to say: "What conceivable is achievable". I never quite agreed, but I don't see any reason at all why "it will not be possible to handle parts of a tuplet". It handles them now, only badly. It's just data structures under the hood, and any operation transforms the initial data structure into a different one. That's data processing. There is no magic to it ... and nothing is impossible.

And it's open source, so any C++ programmer could download it, build it and fix it, right? That's the idea.

[crossed post - I'm actually responding to schepers] That's my assumption as well. If Werner says the underlying architecture in 1.1 is such that fixing any of this is non-trivial, but that 2.0 has changed that architecture and will make fixes more feasible, I take him at his word. While it would obviously be desirable to the user to allow this sort of copy, if it's not going to happen, it's not going to happen, and I'm more concerned with how to avoid corruptions in 1.2 - and that would be by blocking the operation somehow.

Now, if Werner is saying that even with 2.0, that copy/paste of partial tuplets *still* won't be allowed, now that's a decision I might take issue with, but I figure it's one that there is plenty of time to revisit. Indeed, some operations probably would never be allowable, but support for the "easy" cases would still be appreciated. [and here I am in agreement with Jörg's post that crossed with mine - even no particular reason someone else shouldn't be able to fix it if they have the ability - but for 2.0, not for 1.2, I don't think, unless it really is trivial, which I rather doubt]

I'm not saying I disagree, but I'm not a C++ programmer (I only know C). Werner knows the data structures in MS best of anyone, so I won't disagree with him. I would like to see this work as well.

And no, I can't see anyway to do what you showed in your triples example.

Title MuseScore becomes confused when copying from inside a tuplet bracket to inside a tuplet bracket - weird things happen Copying from within a tuplet bracket to another produces strange results

I'm confused now.

Could someone explain it from the beginning, please?

Is this issue limited to copying from within a tuplet bracket and pasting into another? It might be more than that (e.g. copying from inside a tuplet bracket and pasting on a normal rest)?

Title Copying from within a tuplet bracket to another produces strange results Copying from within a tuplet bracket to the same or another or to a normal rest produces strange results

I'm getting bored by wasting time on the semantics of this. I think the issue is pretty clear.

I thought you understand the issue perfectly well. You even submitted test cases yourself. I'll give a brief summary:

The aim is to move notes from within a tuplet bracket to somewhere else, either inside the same tuplet, or into another or to somewhere outside a tuplet. We need this so we can change rhythm (see the picture in comment #32).

Sadly, strange things happen as shown in comment #15 and also in your test cases in comment #23:
1/8 triplets (160 ticks) pastes as 320 ticks, double the length. Or when pasting two notes, they paste as 240 ticks, so a straight 1/8 note (comment #27). In your example with minims (1/2) in a triplet (640 ticks), they get pasted as crotchets (1/4) (320 ticks). When pasting to outside a triplet, an 1/8 triplet (160 ticks) gets pasted as a straight crotchet (1/4) (480 ticks).

The list of strange things could be continued. Take your example with quavers (1/8) in #23. A single note gets pasted as a straight crotchet when copied onto an outside rest. But when you start with a chord of two notes, in MuseScore 1.1 nothing gets copied, in R5253 one of the two selected notes gets copied.

There is not much point to give any more detail. Someone needs to take a close look at how tuplets are handled in copy/cut/paste situations.

To the title "Copying from within a tuplet bracket to the same or another or to a normal rest produces strange results" now accurately reflects the problem.

There is news on this.
In the trunk the following bug was fixed: //musescore.org/en/node/3482 .
So since R5263 single notes from a triplet are now copied correctly. The person who said it can't be done wasn't right after all. ;-)

Sadly chords (more than one note) still don't copy correctly.

In R5311 Werner checked in a fix to disallow the copying of partial tuplets. This will avoid the corruption discussed in the first comments of this post.

I will post a patch for the branch 1.2 soon.

Quoting from the mailing list:

Werner:
A selection can start at the beginning of a tuplet (and not in middle or end) and end at the last element of a tuplet (or outside of a tuplet of course). To select parts of a tuplet the nesting level of nested tuplets must be considered. Additional code is needed to transform chord/rest values.

===

So in brief: for now it won't work. Keep in mind that single notes always copy correctly.

The patch in R5311 checked in by Werner is not correct. See mailing list discussion for details. Sadly it also breaks the ability to select and copy the entire tuplet, which worked before.

Here is the patch for the branch 1.2. The code is now exactly as in the trunk.
I tested it. "Partial" tuplets can't be copied, full tuplets can.

I have a suggestion to make:
I'd like to close all tuplet bugs, so this one and the following:
issue #9909: Copying single tuplet pastes as standard note and produces tied mess upon undo
issue #9297: Copying single tuplet pastes as standard note and produces tied mess upon undo
issue #14658: Cut or Copy on single tuplet has no effect

Instead we should create one new feature request: Need the ability to copy a chord from inside a tuplet to elsewhere.
Note: this works already for single notes.

If you agree, I'll proceed with processing the issues.

Attachment Size
select.cpp-branch1.2.patch 1.57 KB

The patch is commited in the branch as of r5325. I wonder if we should give feedback to the user to let him know that it can't copy a partial tuplet.

... to the user to let him know that it can't copy a partial tuplet if it's not a single note that's copied.

I think we should, but then we would have to translate the message into 43 languages, right?

The code is here (scoreview.cpp):

void ScoreView::normalCopy()
{
if (!_score->selection().canCopy()) {
printf("cannot copy selection: intersects a tuplet\n");
return;
}
...

Other messages in the system say:

No note selected: Please select a single note and retry operation
No note or rest selected: Please select a single note or rest and retry operation
Please select a single note or slur and retry operation
Please select one or more staves and retry operation

So it's quite consistent with those.

It's still broken in the trunk. In fact, in the trunk you can't even select a complete tuplet any more. See comment #49.

Status (old) fixed patch (ready to commit)

For consistency with version 1.2 we should issue the same error message when a "partial" tuplet is selected (same patch as in comment #53).

Attachment Size
scoreview.cpp_.patch 1010 bytes

Just one thing I noticed (minor, I suppose):

1. Open attached score.
2. Drag-select all notes (not rests) in the piano, but exclude the G in the treble clef.

Result: All the notes (excluding rests) are included in the square, but the G isn't highlighted.

3. 'Copy'.
4. Select the rest in the treble stave.
5. 'Paste'.

Expected result: Tuplet is not copied (because a partial tuplet is selected).
Actual result: The entire tuplet pastes, despite not selecting all of it.

Discussion: It's the square I'm focused on (after step 2), I think - what should happen there?

Using MuseScore 1.2 (Pre-release 2) - Mac 10.6.8.

Attachment Size
Partial Tuplet Selected.mscz 1.68 KB

Regarding step 2:
Since the C in the bass of the piano is the last note in the bar, the selection is extended to the end of the bar, therefore selecting the entire tuplet. So it's a feature.
While selecting:
NOT FOUND: 01
After letting go of the mouse button:
NOT FOUND: 02

Attachment Size
14648-sel1.png 3.27 KB
14648-sel2.png 3.52 KB

I think if you do the steps in #69, your warning should appear.

Only the complete tuplet would be permitted to copy, to avoid confusion.

There is nothing I can do. The selection is extended to the end of the measure, the system shows it. The tuplet is fully selected, therefore no warning.

#14658: Cut or Copy on single tuplet has no effect is a duplicate of this bug.

Partial selection of a tuplet will give a message in 1.2, for the trunk a patch is provided in comment #65 (and another one in #67 to check partial tuplets in multiple instruments/voices). The patch (patches) is (are) awaiting acceptance.

And once the patches are accepted I'm very much looking forward to closing this issue, since it has become way too long.

On the 10th and 11th of March (one month ago) two patches were submitted for the trunk in comments #65 and #67. The respective versions of these patches for the branch have already been tested and accepted long ago (2nd/11th of March, comments #59 and #68). The patches for the trunk are still awaiting acceptance.

Please apply the patches now to finally close this issue.

IMHO this has nothing to do with cut and paste (refer to the title of the issue), so I suggest to move this issue elsewhere.

This issue here has become way toooooo long, so all that's left to do here is to accept the patches (which are over one month old) and then close this issue.

Status (old) fixed patch (ready to commit)

As I explained in comment #76: There were two patches. The one from comment #65 is still waiting to be committed.