Enter note entry mode when a note pad button is clicked

• Mar 19, 2019 - 21:45
Reported version
S5 - Suggestion

This came up in this video.

It was suggested that when a note pad button is clicked, we should enter note entry mode. This is a fairly simple fix, and I agree with it and have implemented a PR.


I'm not sure how I feel about this change.

I use the fact that pressing a duration does not enter into note input mode at times to correct my errors. I think what is expected is not necessarily that pressing the duration starts note entry mode, but if for example you press 3 a you get a 16th note A rather than a 1/4 note A like you currently do when note input mode is turned off. IMO, the default duration should be changed if you press a duration and pressing a note name still starts note entry mode.

I discussed this at length with Marc. The behaviour implemented by the PR is this:

If a note, chords or rest is selected when one of the note duration buttons is pressed, the duration is changed. Note entry mode is not entered.

If anything else or nothing is selected, note entry mode is entered when a note duration button is pressed. This makes sense to me, because of this: there are two things these buttons can do, change a chordrest's duration, or change the duration of notes entered in note entry mode. If a chord rest isn't selected and you click on one of these buttons, the only thing you could ever want to do is change the duration of the notes entered in note entry mode. So, if we automatically enter note entry mode in this case, we save users the extra step of pressing N or clicking on note entry button, which also makes note entry more intuitive for new users.

I think this would be a very beneficial change. I hope it makes sense and can be merged now :)

If anything else or nothing is selected, note entry mode is entered when a note duration button is pressed.

First question, If nothing is selected where are you going to enter a note? The same convoluted, meaningless rules now used when you press N with nothing selected? It has never put the note entry cursor in the correct spot when I have accidentally done this.

The rest of the explanation is confused. I don't think you said it right. One place you say only the duration is changed, in another you say note entry mode is started under the same conditions.

The DWIW is that if you press a duration followed by a note, you get a note of that duration if you are in note entry mode or not. Pressing a duration should not start note entry mode. Turning on note entry would be another case of, lets do the same thing a different way and take away a feature in the process.

Good point about where note input mode gets enabled if nothing is selected. There is absolutely no way MuseScore can possibly know where you want it to be, so there is no possible way to define what the "correct spot" is. No mater what we pick, it will be what you had in mind sometimes, but often not. We try to pick something logical (it's actually not conoluted or meaningless at all), but it's a crapshoot as to whether it matches what you had min mind of course.

So, pressing a duration button with literally nothing selected seems like it's still not going to do anything useful - you'll be in note input mode, sure, but not necessarily where you want to be. I don't see this as harmful since pressing a duration button in this context does absolutely nothing useful as it is, but can't see this particular aspect of the change being useful in itself, either.

More interesting, though, is the idea of selecting a measure then pressing a duration key. The PR as I understand it will put you in note input mode on that measure, with the duration selected. This seems moderately nice to me, eliminates at least one common newbie error (selecting duration before pressing N rather than after, with a measure selected).

Status PR created active

Interesting point Marc. Selecting a measure and clicking on it actually starts note entry in the last segment of the measure in my current implementation. I'm going to change it so that it puts you at the start of the selection if you have one when you change duration, unless that selection consists of solely selected chord(s).

Having said that, I've found that it's actually very difficult to get a solution that works in a natural and intuitive way. There are too many special cases, so it gets difficult to have consistent DWIM behaviour. I actually find myself agreeing with Mike now. So, I have two options: reducing this to just entering note entry mode when nothing is selected and a duration button is clicked (which wouldn't be useful), or just closing the PR altogether and letting someone else find a better way of implementing something along these lines. I'm going to go for the latter :)

Please, anyone, see what you can come up with.

Don't get me wrong, it's really interesting to think along these lines. But, sometimes what seems obvious at first turns out to be less so (and vice versa :-)

In reply to by TheOtherJThistle

If a full measure is selected (blue rectangle), inputting a note-duration (with the mouse or keyboard) can activate the note entry mode. *1
When the input mode is activated, the input pointer (thin blue cursor) must be positioned at the beginning of the measure. This is important when input from the keyboard *2

*1 Because the user clicks once on the target measure before entering the note(s).
*2 When the input mode is active, user can put the note anywhere with the mouse.

Having read this discussion, I believe there is one important point that was not considered here. The point is (if I am correct with it), the only case a user can ever expect duration buttons to trigger note input mode is when operating with mouse. When operating only with mouse, one does not really need to see a note input cursor which makes the very question of choosing a place for it slightly irrelevant. Or, if some reasonable place still needs to be chosen, it should be placed somewhere in the visible area reflecting the fact that the user operates purely with graphical interface.

So here is the summary of what can be done according to that:
1. Note input mode activates only by pressing note duration buttons, not by activating the corresponding shortcuts (of course, only in case there is no selection and other cases we consider it appropriate).
2. Concerning the note input cursor, three options available:
- No cursor at all until the first note is added
- Cursor is placed according to the current rules but the viewport does not jump to it
- Cursor is placed somewhere in the visible area

In reply to by dmitrio95

  1. would be terrible for keyboard users. Pressing a duration changes the selected note or rest. I use this a lot and do not want note input mode to turn itself on when I do this. I usually press the right arrow to select the next note or rest to do something with that, very often to fix the wrong rest pattern in an x/8 measure. I don't want to have to press escape every time I change a duration.

What would be nice would be if MuseScore remembered the duration key you pressed while not in note input mode then entered the note so you get a note of the correct duration if you press a note key (a-g) which does and should automatically turn on note input mode. Currently you usually get a quarter note. There seems to be one case where you will get something else I think, but I can't remember how to do that.

  1. Are you really suggesting that the quasi random location that MuseScore chooses to turn on the Note input cursor not be shown if the user missed clicking the start point or accidentally hit N instead of M? The user would have no idea they are in note input mode if it's off the screen.

I propose exactly that nothing changes for those who use keyboard to edit a score. If you operate with mouse, press a note duration button and nothing (maybe with some exceptions) is selected then MuseScore activates note input mode, with one of the listed options concerning the cursor behavior.

I'm curious how MuseScore knows if you're going to use the mouse or keyboard. You can currently switch back and forth all you want. Press the 3 for a 16th note click the staff to insert the note click the 8th note icon press G to enter the note and so on.

If I am understanding correctly, no one is proposing changing the behavior if something is selected. In those cases, then the duration buttons and shortcuts will both do exactly what they do now - change duration of the selected note, no mode change. Only in the case of nothing selected is there a proposed change. Since the duration commands currently do absolutely nothing in these cases, changing this behavior seems like it should not cause problems. But I do share the concern about not showing the input cursor. I think it's misleading and problematic, and making it so this only happens if the duration command is triggered by mouse or keyboard doesn't really change this. If we're going to change mode, there needs to be a clear visible indication that this has happened.

Currently, if you make the mistake of entering note input mode without selecting something, the cursor is always (?) placed int eh visible area already. At least, that's the theory. Generally, it's the measure at the top left corner of the current view, so hardly random at all. Might be some corner cases where this algorithm doesn't work correctly, if so, let's identify those cases and fix them, but otherwise, keep the current behavior with respect to the cursor.

If the cursor is placed at visible area when nothing is selected, maybe the randomness in placing cursor comes from the cases when something still has already been selected. I such cases the algorithm seems to prefer the selected element over the visible ones which may be unexpected sometimes. But if those cases indeed cause problems now, they can potentially cause even more problems if we enable note input triggering for the note duration buttons: currently if one clicks a note duration button when some note is selected outside the viewport the selected note just silently changes its duration, without any sign of this change being shown to a user. Maybe this behavior should also be altered if the note input activation change happens.

Agreed, I seem to recall that having come up before. Very likely the existence of a selection that is off-screen and hence was forgotten about is one source of the perception of randomness. There is another, where if you happen to have a spanner (line) selected, the code that tries to track down a good measure to use gives up and sends you to the beginning of the score. Same for anything else where we don't find a measure when looking up the chain of parents.

So, a couple of trivial changes there would help in any case, but probably become that much more important if we're going to start entering note input mode on more commands.

I think Tantacrul has an extremely valid point here, and it has stumped me on a lot of occasions when using MuseScore, honestly.

Why not simply add an option for this in Preferences, maybe?

Everything you can select is anchored to either a note or a "tick" location. Articulations, slurs, lines and all text are obvious examples of items in this category. If something besides a note is selected, then the note at the beginning should be the start point for note input. If no note is used as an anchor, then the note/rest at the tick location for the start of of the item selected should be used.

For a less obvious example, a barline is attached to some point in a measure, so the note/rest at that point where the barline is attached should be selected, either the last one in the measure on the staff where the barline exists (preferable), or the first in the next measure. Either would be acceptable as long as it's consistent. The start of the score is not acceptable.

Perhaps the most difficult to handle would be a key signature that is automatically generated at the beginning of a staff. Since all key signatures on the system show being selected on the auto generated ones, the top staff of the first measure of the system would make sense in that situation. BTW, system text items should be considered to be attached to the top staff also.

If nothing is selected, the last entered item (the thing that would be undone) should be considered as the current location.

What would be nice would be if MuseScore remembered the duration key you pressed while not in note input mode

This, in my opinion, is the crux of the issue. Currently, when entering note input mode, there are 3 separate cases that determine which duration ends up being selected.

  1. The element under the input cursor is a note. (A chord, really, but we are looking at a single note at this point.)
    Result: We select the duration of the note's chord.
  2. The element under the input cursor is a full measure rest.
    Result: We select the quarter note duration.
  3. The element under the input cursor is a rest of some other duration.
    Result: We select the duration of the rest.

So the question is: Are we doing the right thing in each of these cases? In any of these cases? Or should we leave the currently selected duration active?

The relevant code is in InputState::update(Element* e) in libmscore/input.cpp.

By the way, the case of no initial duration selected (or an invalid one) is handled elsewhere, specifically in ScoreView::startNoteEntry().

I will answer my own question. I do not believe that it is appropriate for InputState::update() to set the active duration in any case. If you select a duration and then enter note input mode, you obviously intend to enter notes or rests of the duration you chose. Of course, selecting a note or rest will set the active duration to that of the note or rest anyway, so in that case, the active duration will already be correct upon entering note input mode.

@mattmcclinch For me #2 is definitely the wrong thing. ("The element under the input cursor is a full measure rest. Result: We select the quarter note duration.") You subsequently wrote that "selecting a note or rest will set the active duration to that of the note or rest anyway," but this is not true of "measure rests." I understand the difference between a "measure rest" and a "whole rest;" the difference is not that one has a duration and the other doesn't. Hence I find the current behavior counterintuitive.

Thinking through the various ways this could be made more purely logical (not to say necessarily better), I realize that there is no customization of held note subdivisions (e.g. does a held measure of 15/8 contain a dotted-whole tied to a dotted-quarter, or is it a half tied to a dotted quarter tied to a half tied to a half?), though such customization of beaming is available. When you have a lot of sustained notes in the latter 15/8 scenario, you can spend a lot of time entering all of them (or copying and pasting, which seems like it should save time but almost never does). Perhaps the use such a feature would get is not worth the trouble it would take to create it, but it at least would be nice to have "someday."

Here is the point of what I was saying earlier: I don’t see the benefit of having the duration buttons sometimes automatically switch to note input mode and sometimes not, depending on what is or is not selected. It is easy enough to press the ’N’ key or click the note-input button in the toolbar. But what is frustrating is that if you choose a duration first, and then enter note input mode, the duration you chose will no longer remain active, unless it happens to match whatever is under the input cursor. Letting the previously selected duration remain active upon entry into note input mode would go a long way towards making the issue at hand seem like more of a non-issue.

I am inclined to agree. I do have some memory of this topic having come up and somehow a reason why not to do this came up and seemed convincing at the time. Can't remember if it was me or someone else who offered the reason, nor do I recall the reason, and maybe my memory is totally off on this anyhow. But anyhow it should be interesting to implement it, try it out, and see how it feels in practice.

A complication now, of course, is that if you select a measure, then hit your desired duration, then press "N", the behavior immediately upon selecting the duration is rather different than it long has been - now it changes the duration of the measure rest. That much isn't necessarily a problem in itself, but it loses the selection in the process - that part would also need to be fixed.

@Marc Sabatella, I think I see what you are getting at, but I don't see how it complicates what I am suggesting. True, if there is no selection, then the input cursor will not necessarily be positioned where the user expects, but that is the case even now. As for implementing this, it is a simple matter of removing the 3 calls to setDuration() in InputState::update(). This is an easy thing to try yourself to see if you like it.

Actually, I consider this aspect of it a regression versus 3.0.5. In all (?) earlier versions, the following sequence:

1) select empty measure
2) press duration key
3) press N

Resulted in note input starting in the correct measure, if not the expected duration. As of 3.1, it puts you in the wrong measure, because of the loss of selection on pressing the duration key.

That has never been a recommended sequence, so I don't know that I would classify that as a regression. With my proposed change, that still would not be a recommended sequence, but at least it would result in note input starting with the expected duration, if not the correct measure.

Sure, it's not recommend, but people do it, and you're proposing a change to make this work better - except it won't actually work better if we don't fix the selection issue, the bottom line will be it continues to work worse. not worse with your change than without, but worse 3.1 versus 3.0.5. I'd much rather find myself in the right measure with the wrong duration (a one-click workaround) than in the wrong measure with the right duration.