Add absolute notes?

• Jul 8, 2021 - 09:49

It's cool that Musescore has a built-in heuristic that figures out the most likely note a user wants to add when they presses a key on the keyboard. For users who want to directly enter notes absolutely there are two options: use a piano keyboard via MIDI or use the ‘Piano Keyboard’ feature. But the latter only uses the same heuristic that assigns the 7 computer keys (c,d,e,f,g,a,b) to notes.

Is there a way to enter notes by keyboard directly? I wrote an external script (using AutoHotkey) that uses the first two rows of the computer keyboard (1,2,3,...,q,w,e,...) to allow entering an undecime directly, with keys SC00F and SC01B (which on a US kbd are used for Tab and ‘]’) to go down or up an octave. The way I currently implemented it is by reverse-engineering the built-in heuristic and sending the corresponding shortcuts c,d,e,f,g,a,b, ↑, ↓ , Ctrl+↑, Ctrl+↓. That has the disadvantage that the black keys and intervals > tritone require two consecutive entries, resulting in two notes being played. Alternatively, I could have the script move the mouse to the appropriate key on the ‘Piano Keyboard’ display, but that's still a roundabout way to enter what in the program is just one byte of information.

So, is there a way to directly tell Musescore to add a given note, such as by providing simply its MIDI number?


Comments

I'm not sure what you mean about heuristics here. Do you mean, choosing which octave, if you type a letter name? Indeed, that's an unsolvable limitation inherent in using letter names (only) for pitch. With a MIDI or piano keyboard, you can specify the octave directly, but that trades it for a different and equally unsolvable problem - now there is no way to specify the spelling of accidentals. MIDI makes no differentiation between C# and Db, etc.

So I'm not sure what you mean here.

In reply to by Marc Sabatella

Thanks, Jojo and Marc, for your replies.

By ‘heuristics’ I mean not just the choice of octave, but also that of accidentals – I mean, when you enter a ‘b’, it can result in a ‘b’ or a ‘b♭’, depending on context. (I know, strictly speaking, the term ‘heuristics’ doesn't apply to the latter, since there are clear, time-honored conventions for that, and it didn't take reverse engineering to figure them out. But they, too, require that I undo a mechanism carefully built into Musescore.)

Yes, the virtual kbd doesn't use that heuristics. But it still requires a far more complicated communication than the mere transmission of a byte-sized number. Not a problem; just a detour I was hoping to avoid.

Marc, you're making a good point about enharmonic accidentals. To be honest, I hadn't thought about that. I'm not sure I would call it unsolvable, though. Yes, no program can know perfectly how to write a given keyboard note; it will have to apply some heuristics for that case, too. But that's a problem that, at least in principle, even occurs with plain c,d,e,f,g,a,b, which might also be written b♯, c𝄪, f♭, and so on. It's not really a problem in practice because Musescore's use of the up|down keys provides an intuitive way to fix the issue. There will be some more of these cases when entering keys via an absolute keyboard (be it MIDI or 123QWERTY), but just as that hasn't been a problem for MIDI input, it shouldn't be one for 123QWERTY input.

In reply to by Sebaudia

It's unsolvable in that ultimately a note is not one byte of info, it's two - pitch and spelling - no so no scheme based on pitch names or on a standard chromatic keyboard layout can accomplish both at once. But it's true one could devise a scheme based something like a 17-key (or more) layout could allow you to use separate commands to add C# versus Db. I could totally see a plugin doing that. I'd recommend that over trying to do this in AutoHotKey.

In reply to by Marc Sabatella

Thanks, Marc, for the explanation. I think you misunderstood my intention. It sounds like you're getting in the direction of microtonality, for which indeed various keyboards with more than 12 keys per 8va have been devised, and which Musescore already supports with a plethora of special accidentals. I'm not worried about that. I don't want to do any more than someone who enters notes with a MIDI instrument, only I want to do that with a normal computer keyboard instead.

In reply to by Sebaudia

No, I'm not talking abut microtones - although of course that's why 17-note keyboards exist. I'm just talking about having separate buttons to press to yield C# versus Db. If you don't care about that - you're fine with needing to correct every time that just like MIDI users do - then this too should be easily doable via a plugin.

In reply to by Marc Sabatella

Oh, yes, a plugin would probably be the best solution. Would that offer a more straightforward way of entering notes? I have no experience with that for Musescore yet, is there an introduction somewhere? I had already thought about learning how to do that for Practice Mode on Laptop; which would probably be a more worthwhile endeavor.

In the meantime I did implement a proof of concept for the note entry via the virtual keyboard; in principle it's working pretty well. The virtual keyboard also has the advantage that I could use it to overlay the corresponding (computer) keys on it, which could highlight the activated octave (or undecime). I presume that's not easily done with a plugin, or is it?

In reply to by Sebaudia

If you're unwilling to make use of the [flat/sharp/natural] toggle shortcuts prior to inserting [A-G] on a computer keyboard and would rather have a 12-tone keyboard accessible via QWERTY/Dvorak/whatever, one method would be to (instead of using something like AutoHotKey) use the plugin that allows for multiple actions to be triggered by one shortcut, but, as mentioned as relates to the enharmonic problem, this would require everything to be sharp or flat unless you were using 24+ keys for differentiation which seems like it would be impractical.

If that seems appropriate, one option would be to try the Action Chain plugin found here: https://musescore.org/en/project/action-chain-shortcut
since you can chain for instance [Toggle sharp] + [Insert A] and apply that to whatever you want, and then make a set for 12 or however many you want. Good luck.

In reply to by worldwideweary

Nice! This bring up two paths that we haven't discusssed:

[flat/sharp/natural] toggle shortcuts: It wasn't unwillingness, but ignorance: Early on, when I was new to Musescore, I had settled on using the up|down keys, because there were no keyboard shortcuts for the accidentals buttons. But now that I'm aware of the Musescore Preferences → Shortcuts list, I can just set some shortcuts there. I found ‘Note input: ♭’ and ‘Note input (non-toggle): ♭’ (and the same pair for other accidentals), one of which may solve the issue for accidentals. Is there a similar function for octaves?

Action Chain: That sounds like a neat solution. Is there any documentation for what functions the names in the list execute? (As is all too common on GitHub, the README.md contains no information adressed to an actual reader.) Some of the commands have names that might indicate relevance, such as ‘pitch-up-octave’, but I suspect them to be the same functions I used in my first attempt, and that they will yield the same responses; I see none that appears to refer to the virtual kbd or any other way to add absolute notes.

In reply to by Jojo-Schmitz

Yes, but that's just like Up|Down: It only acts after the key has been entered and played. Since
worldwideweary pointed me to the [flat/sharp/natural] toggle shortcuts, which result in no wrong note being played, my question was whether there is something that works the same way for octaves.

In reply to by Jojo-Schmitz

Aside: It would be a cool addition to have a visual mechanism displaying the current octave the next note entry would be in (if it could be a preference setting). It would allow for a kind of pre-note-entry octave toggling. I doubt anyone will implement such a visualizer any time soon though.

In reply to by worldwideweary

@sebaudia, there are programs that will let users make use of a computer keyboard as a midi device, but not sure how that would work well or not while retaining partial functionality for normal entry. Might want to search the web and experiment if those action chains and toggles don't do what you are wanting.

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