Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exchange voices command is available with a single or list selection but does nothing #23330

Closed
wizofaus opened this issue Jun 21, 2024 · 16 comments

Comments

@wizofaus
Copy link
Contributor

wizofaus commented Jun 21, 2024

Issue type

UX/Interaction bug (incorrect behaviour)

Bug description

If you select one or more notes in a list selection (using ctrl+click etc.), the various "exchange voices" commands from Tools|Voices are all enabled but do nothing.
Either the command should be disabled, a message should appear explaining why it can't be used, or they should work as expected (ideally the latter!).

Steps to reproduce

  1. Create a score with a single note in voice 1 and a single note in voice 2
  2. Select them both using ctrl+click (list selection, not range)
  3. Choose "Tools|Voices|Exchange Voice 1&2"
  4. Result: nothing happens
    Expected: either 3. should not be possible because command is disabled, or an appropriate error message shown, or better, it should work.

Screenshots/Screen recordings

No response

MuseScore Version

4.3.1

Regression

I don't know

Operating system

Windows 11

Additional context

Apparently it's even weirder - if you select a range that's not a full measure then the command works, but affects notes you haven't selected elsewhere in the measure. It may make sense to fix it so it can work on any range but still be disabled for single/list selection. Otherwise I would think it should given a warning message if the current selection is anything other than 1 or more complete measures.

@wizofaus
Copy link
Contributor Author

Happy to fix either way, though the "actually work" option would take somewhat longer than the others. There's no message currently for "Please select a range" (or similar), so would require translation etc.

@irwir
Copy link

irwir commented Jun 22, 2024

There should have been Steps 5:
...
5. Reading the handbook.

Apparently, the function name is dubious.
Exchange voices in MuseScore requires that one of the voices in the pair was empty.
Disabling menu items for large selection might be too costly.

The reasons for certain design decisions are unclear.
Preferable would be straitforward implementation as in Swap voices function of Sibelius.

@wizofaus
Copy link
Contributor Author

Not sure what reading the handbook has to do with expected behaviour. No command should ever be available and active but do nothing with no information about why nothing happened
And, no I use it all the time on passages with notes in both voices, it's not true that one must be empty at all. If it says that in the Handbook then it's evidence that reading the handbook is more often than not a waste of time. The source code is the only source of truth!

@irwir
Copy link

irwir commented Jun 22, 2024

The handbook is still recommended; quoting:

These commands work only on full measures (or multiple measures), not on individual notes.

So it was my misreading of your description (plus some false memories).

As for your suggestion, Tools - Voices item could be disabled if selection is not full/multiple measures.

@wizofaus
Copy link
Contributor Author

Then the handbook is still wrong because it works fine if you select a range that's not a full measure too (though I haven't done extensive testing to see if it handles all scenarios).

@MarcSabatella
Copy link
Contributor

MarcSabatella commented Jun 22, 2024

If a partial measure is selected, the command still operates on the full measure. That’s how it handles all scenarios. It’s easy with full measures, often next to impossible otherwise.

So, the handbook is accurate that it only operates on full measures. it just leaves out the detail that it automatically expands to the full measure if you mistakenly select a partial measure.

@wizofaus
Copy link
Contributor Author

I'd say that's a separate bug then, though I'd fix at the same time

@MarcSabatella
Copy link
Contributor

It’s not a bug, it’s by design as the consensus choice (as of some years ago) from among the several possible ways of handling partial measures. Certainly, though, alternative designs for the handling of partial measures could potentially be proposed, discussed, agreed upon, implemented, and documented.

@wizofaus
Copy link
Contributor Author

My proposal:
if you have a selection is that is NOT a range of 1 or more whole ranges then:
a) if doing exchange A-B, first take all the selected notes in voice A and do the equivalent of "Ctrl+Alt+n" to assign to voice 5 (normally not accessible, but useful as a temporary holding voice)
b) take all notes selected in voice B and do the equivalent of Ctrl+Alt+ to assign them to voice A
c) take all notes in voice 5 and do the equivalent of Ctrl+Alt+B to assign them to voice B

Otherwise, use existing algorithm.

@MarcSabatella
Copy link
Contributor

As discussed in Discord, it's just not that simple. If the voices don't start or end at the same time position, there is no guarantee that you'll be able to do the moves, and you'll end up either doing nothing for some of the notes, or stuck in places where some note has nowhere to go.

Here was one example I noted:

image

Just one of many many possible cases to consider. Your algorithm above will leave the third selected "C" nowhere to go, except maybe back where it started (try it using voice 3 as the temp voice and see). Or you can modify the rhythm to chop the start/end notes up and only move the portions they have in common, but there is no reason to suppose a user would actually expect that either.

I'm not saying it's hard to do something, but almost anything you choose is going to be surprising and almost impossible to document. And not obviously better than the current solution.

So as I said, alternative designs for the handling of partial measures could potentially be proposed, discussed, agreed upon, implemented, and documented, but acknowledging the complexity of the problem I(from a user understanding perspective - not from a code perspective) is definitely part of that.

@wizofaus
Copy link
Contributor Author

wizofaus commented Jun 22, 2024

Ok so that brings up another piece of (to me) very unexpected behaviour, that probably deserves a separate bug report, but currently if you do select a note in, say, voice 2 and there's also a note at the same place already in voice 1, then using "Ctrl+Alt+1" or clicking on "voice 1" button in the toolbar does nothing at all with no explanation. I'd prefer to fix that first (again, it's simple in principle - it should delete material to make room for the note, same as changing a note duration etc.).
But if there's some reason not to fix that, then sure, exchange voices should give a message if a) the selection is anything other than a range of 1 or more complete measures and b) it's impossible to assign some of the notes to another voice based on the current limitations of that command.
On the other hand I don't have an issue with the fact that in some cases, if you have a selection that isn't entire measures, performing "exchange 1-2" twice may or may not return you to what it was before (because material has been deleted etc.).

@MarcSabatella
Copy link
Contributor

This too is by design, the consensus choice as to the best way of handling such cases. Again, it’s possible to propose, discuss, agree upon, implement, and document a new design.

@irwir
Copy link

irwir commented Jun 22, 2024

Your algorithm above will leave the third selected "C" nowhere to go, except maybe back where it started

As a fun fact, some OCR/PDF converters actually managed to create voices longer than time signature defines.
MuseScore complained on every file open and save.

@wizofaus
Copy link
Contributor Author

wizofaus commented Jun 22, 2024

Also, I took your example from above, changed the time signature to 3/8, used exchange voices on the 3 selected notes, then changed back to 4/4:

image

Not that it proves anything, but does demonstrate that the current solution is not necessarily ideal.

(The extra F at the end was something I'd added accidentally before changing time signature)

@irwir
Copy link

irwir commented Jun 23, 2024

Also, I took your example from above, changed the time signature to 3/8, used exchange voices on the 3 selected notes, then changed back to 4/4:

IInitial selection with two quarters in lower voice you converted to quater and eighth.
This is bad cheating.

@wizofaus
Copy link
Contributor Author

Exactly, you shouldn't have to resort to that to try to get a useful result. Not that I ever would try to use exchange voices on such a selection. But it's definitely a command that would be useful to use on selections that aren't entire measures. I'm happy to put up a PR so you can play around with it, will probably have to wait till tomorrow or the next day though.

@musescore musescore locked and limited conversation to collaborators Jun 28, 2024
@bkunda bkunda converted this issue into discussion #23395 Jun 28, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

4 participants