Why can't I select a measure to paste notes into if Voice 1 is off in selection filter?

• Sep 18, 2021 - 03:39

I feel like I'm missing something fundamental here - I frequently need to copy notes from v2-4 into other measures (that only have v1 notes/rests). So I use the selection filter to deselect v1, copy my source measures, then click on a measure to paste into it...but nothing happens! In fact you need to explicitly click on the first note or rest in v1 (which is not what I'm pasting over at all, that's going to stay where it is, and if anything I mightn't expect to be selectable given I've literally just specified that "voice 1" elements are not to be selected).
I don't see why there's a problem with having an "empty" range that's selected, but it seems MuseScore doesn't think that concept makes sense (the same happens if you select a measure with only v1 notes/rests in it and turn v1 off in the selection filter - the measure you just selected becomes deselected).

I will say this is certainly not the only case where MuseScore doesn't play nicely with the concept of selecting measures, even though that's surely an entirely intuitive concept and is generally much easier than selecting exactly the first note/rest in it, but this one really baffles me...is it just me?


In reply to by Marc Sabatella

I would have thought it would have required extra code to prevent range selection working just because it happened to contain no notes/rests.
I can sort of understand that there might be assumptions in the code that if you have a range selection there's at least one element present, but it won't even let you select a measure containing other elements that could be selected if Voice 1 is turned off. Unless all elements other than notes/rests are assumed to belong to voice 1??

In reply to by Dylan Nicholson1

So it turns out that, as suspected, there's an extra piece of code to explicitly change a selection to type "NONE" if it contains no elements. That much is easy to fix, allowing you to select measures even if the selection filter means that no elements are selected.
But it turns that's not quite enough on its own - as the "paste" logic assumes there's at least one "ChordRest" in the selection, and uses that to determine the segment and staff to paste at.
That's easy to fix too - it can query these directly from the selection (startSegment() and staffStart()), and this works as expected from the tests I made.
I'll keep testing but it does seem this a bit of a no-brainer of a change to make, it doesn't seem to be breaking anything else.
It's still true that shortcuts like Ctrl+Shift+ (select to beginning/end of bar etc.) don't work "as expected", and at some point they'd be worth investigating too,

BTW how do you access the selection filter using the keyboard? Certainly one thing that would be super useful is to be able to turn off "voice 1" in the selection filter with a single shortcut sequence - but I'd be happy there was a shortcut sequence to set the keyboard focus to the "All" option in the selection filter, then use down arrow/space or whatever to toggle "voice 1" (or any option in the list).

In reply to by Dylan Nicholson1

Hmm I just noticed one behaviour that's quite unexpected - if you have a measure selected with no elements (due to the selection filter), and start note entry, it doesn't start in the measure you have selected. Again, not hard to fix, but just as an example of the sorts of other adjustments that might be needed.
Is there any way a measure could end up with no voice 1 note/rests in it?

In reply to by Dylan Nicholson1

In fact you can see this problem with the current version already, as it IS possible to have, say, a measure where the only thing in it is a voice 2 hairpin (or other line, or dynamic, see below). In this case you can select the measure (with "voice 1" off in the selection filter), but if you try to paste into it you get an error "No destination to paste", which is fairly obviously untrue. And likewise, selecting it doesn't change the "note entry" position.
I will say MuseScore seems to make it quite difficult to create lines in voices other than v1, it seems you have to create notes in v2 first, then add the lines while they're selected, then delete the notes (doesn't work for slurs btw, which strangely get deleted once all the notes/rests in the same measure are deleted). And I haven't figured out how to add v2 text elements at all (meaning if you have, for instance, Fl. 1 in voice 1 and Fl. 2 in voice 2, I can't see how to have instructions that are only for Fl 1. and ones that are only for Fl 2.) - except dynamics (another odd case where "dynamics" seem to be the only type of text element exhibiting the behaviour I'd expect for all text elements!).

In reply to by Dylan Nicholson1

There are issues with lines in voices other than 1 indeed, the code that determines the actual start'end point seems to favor voice 1 unnecessarily. See for example #308119: Cannot drop pedal and other lines onto element in voice other than 1, which is not directly relevant to the case at hand but kind of shows how voices are not handled as consistently as they should in terms of line handling. It's considerably better now than a few years ago, though.

I'm curious what your use case is, here, though. Seems like you are trying to accomplish something pretty specific but it isn't clear what. Chances are decent there is a more straightforward method, though.

Not sure why you'd find it strange that slurs go away when there are no notes/rests, slurs by their very nature require them.

Also I'm not understanding what you mean about text in voice 2 - it's trivial to add, just select the note in voice 2 where you want to attach it then click the palette. if you mean the playback effect, most text of course has none, but for things like pizz/arco etc, you can select by voice in the staff text properties. Tempo of course would be pretty meaningless to change by voice. Dynamics and instrument changes would be good to support someday, those (well dynamics anyhow) are common requests.

In reply to by Marc Sabatella

Slurs only disappear once all the notes/rests for that voice in a measure are deleted - as long as there's one, the slur can exist (even if it's not attached to anything).

For me, adding, e.g. 'pizz' to a note in voice 2 definitely acts like it's actually adding the text to voice 1, judging by the colour it's shown in and the fact that voice 1 icon is highlighted in the toolbar when you select it and the fact when copying & pasting it only copies if voice 1 is turned on in the filter. Dynamics don't act like this.

As for what I'm trying to achieve, I explained my initial use case of wanting to select a measure as a target to paste into. And yes I know you can do it by selecting a note/rest in it instead, but that not only requires much finer control but jars with the obvious mental model of wanting to paste into something that's empty - the notes/rests in voice 1 aren't going to be affected by the paste operation at all, so why select them?

In reply to by Dylan Nicholson1

BTW you can very easily edit the mscx file to put Staff Text elements into voice 2, so I'm a bit perplexed why I can't seem to do it via the UI. I can see though in ChordRest::drop for the following types of text element:
TEMPO_TEXT, DYNAMIC, FRET_DIAGRAM, TREMOLOBAR, SYMBOL it does set the "track" (voice) of the dropped element to that of the target note, but for other text elements it specifically sets them to voice 1 (via e->setTrack(trackZeroVoice(track())))), so this was obviously a deliberate decision.
I will say having tempo text in voice 2 seems a little odd...

In reply to by Dylan Nicholson1

Sounds like a bug if you've found a case where unattached slurs remain - thought we fixed all those cases years ago. I don't doubt you, but I can't see a way to reproduce in a minute or so of trying.

Any text you add to a note in voice 2 might get that voice assigned to it, and that includes dynamics - but that seems to depend on how you add it (palette click vs drag&drop vs copy/paste vs shortcut). Again, it's mostly irrelevant semantically, as playback and other effects generally encompass all voices on the staff, but it would indeed be nice to clean this up.

As for use case, selecting a measure to paste into is clear enough, and yes, I agree, it would be nice to be able to do the selection without needing to re-enable voice 1. Although to be sure, you'll need to re-enable voice 1 soon enough if you want to do much of anything else. But I was wondering more about the use cases involve texts or lines that you seemed to be focusing on in later posts.

In reply to by Marc Sabatella

Dragging text elements from the palette onto a voice 2 is no different, nor is copy/paste. They always get assigned to voice 1, as per the code.

Initially I just wanted to have a measure that had elements other than notes/rests in it belonging to voice 2 to see if it behaved the way it looked like it would from the code. But it's not hard to give examples of why you'd want exactly this, e.g. if you're creating a full score either one part per voice that you intend to extract separate parts from. BTW, I thought I could use "implode" to enable this (whereby you start out on two staves then decide to compress into one), but it doesn't work either - in fact text elements (including dynamics) don't even get transferred during an implode.

In reply to by Dylan Nicholson1

Not sure what you're doing differently, but for me, if I select a note in voice 2 add staff text via Ctrl+T, it is added to voice 2, as shown by the highlight color. Other methods produce different results. And indeed, I agree it makes more sense for the selected voice to be honored when it comes to voices-to-parts.

In reply to by Dylan Nicholson1

Right, that's the extra code that would be required - the code to make it actually work :-)

The selection filter is toggled via F6, and then its controls should be part of the normal - looooooong - tab order through the UI. MU4 supposedly improves this by allowing a single key (I think it's F6, as it happens) to move quickly between subwindows.

Dylan Nicholson1 wrote:
" I frequently need to copy notes from v2-4 into other measures (that only have v1 notes/rests). So I use the selection filter to deselect v1, copy my source measures, then click on a measure to paste into it...but nothing happens! In fact you need to explicitly click on the first note or rest in v1 "

The behaviour which you have identified probably revolves around the need to identify the start point (which beat) for any paste operation, rather than a specific need to paste into Voice 1. I followed the steps which you described (Voice 1 deselected with F6), but then pasted the selected Voice 2 notes into a whole-measure Voice 2 rest.

I am guessing that a code modification might be made which assumes "beat 1" as the start point for a paste operation, if there is no note or rest available because of a setting of the Selection Filter. Or might that be a dangerous assumption?

In reply to by Dylan Nicholson1

My point was that a copy-and-paste action does not always start on the first beat: there may be an initial rest which is not included in the pasted portion. So the assumption that beat 1 is always the paste point is unsafe: ideally the paste point should be the clicked-on (selected) target.

Do you still have an unanswered question? Please log in first to post your question.