MIDI Commands

Sorry to bump an old topic, but I am having similar issues with mapping MIDI key commands. I mentioned some of them in the “Tricks for more efficient note-entry” thread, but maybe it’s better to address this on a more specific thread. Essentially, there are inconsistencies surrounding multiple-key MIDI commands; e.g., I have the piano’s lowest G set to respell a note down, while if I press G+B together it sets the rhythmic grid to quarters. They both work until I restart Dorico; then the respelling function is no longer working (even though it’s still shown in the Key Commands preferences).

Edit: the weirdest thing is that at least one of these things kept working while others stopped, for no reason that I could determine.

Thanks for any ideas!

Perhaps you could look at the JSON file in your user application data folder and verify that the command in question does definitely show two MIDI notes listed in there. I’ve had a quick look at the code that handles the loading of these commands and certainly on the face of it the support is there for multiple notes to be used.

Thanks for checking, Daniel. The JSON file does indeed show two notes listed (and three notes for my rhythmic grid commands, which work fine). It’s more an issue of individual-note MIDI commands working at first and then no longer once I relaunch Dorico.

For instance, just now I again set low G and Ab to respell notes lower and higher, respectively. They both work until I quit and relaunch, and now only the Ab works. I think it has something to do with the fact the the G is also used to set grid values, but only when paired with other keys. (Those grid commands still work.)

There is further weirdness happening surrounding this issue as well. I went into the key command preferences to check that the MIDI notes were still listed, and indeed they were, even though the G one wasn’t working. I tried to get it to work again by deleting and re-entering the MIDI command. It still wasn’t working, so I opened key command preferences again, only to discover that all of a sudden no MIDI or QWERTY keys at all are shown for those commands. (Although they still function with the exception of that G.)

A further development: upon opening Dorico today, I immediately got a succession of “An error occurred” boxes popping up, and now the “respell” qwerty commands no longer work, and are absent from the preferences.

Can you attach your keycommands_en.json file here? You will need to zip it first.

Sure, thanks for looking into itkeycommands_en.json.zip|attachment (1.4 KB)

keycommands_en.json.zip (1.4 KB)
I think something went wrong with the file upload — trying again here.

I can reproduce a similar issue. When Rhythmic Grid Resolution:Half note is set to MIDI note number 21(piano’s lowest A) and Rhythmic Grid Resolution:Dotted half note is set to MIDI number 21 +22, depending the order in which commands are written in JSON, Rhythmic Grid Resolution:Half note MIDI command does not work.

If the JSON is written as below, both MIDI commands will work correctly.
keycommands_en.json.zip (771 Bytes)

				"context" : "kWriteMode",
				"shortcuts" : [
					
					{
						"NoteInput.SetGridResolution?RhythmicGridResolutionValue=kMinim" : [ "MIDI:NOTEON21" ]
					},
					
					{
						"NoteInput.SetGridResolution?RhythmicGridResolutionValue=kDottedMinim" : [ "MIDI:NOTEON21, NOTEON22" ]
					}
				]

However, if they are written in reverse order, as below, then Rhythmic Grid Resolution:Half note MIDI command does not work.
keycommands_en.json.zip (771 Bytes)

				"context" : "kWriteMode",
				"shortcuts" : [
					
					{
						"NoteInput.SetGridResolution?RhythmicGridResolutionValue=kDottedMinim" : [ "MIDI:NOTEON21, NOTEON22" ]
					},
					
					{
						"NoteInput.SetGridResolution?RhythmicGridResolutionValue=kMinim" : [ "MIDI:NOTEON21" ]
					}
				]

Isn’t this a bug?

1 Like

Wow, great catch, thanks for figuring out what was happening!

It’s good to know that this order will work. It seems logical then that any triple-note commands should go at the end after the double-note ones (I will get around to testing this soon).

However, the problem that you mentioned that Respell Using Note Name Below MIDI command does not work may be due to another cause. In fact, I haven’t found a way around this problem yet.

Sorry to take a while to get back to this issue. I can confirm that the order in which the MIDI key commands are listed in the keycommands_en.json file is currently significant, and that it shouldn’t be. We will fix this in the next version of Dorico. Sorry for the inconvenience in the meantime.

2 Likes

Great, looking forward to Dorico 4!

In fact it turns out that I was mistaken: after discussion with Paul, who implemented this feature, this is working as intended. It’s not obvious from the user interface (and is almost certainly not currently documented as such either, though I’ve not checked – I will ask Lillie to check in due course), but the intention is actually a little different.

The idea is that you can indeed use chords as shortcuts, but you would not use one of the notes in those chords as a single shortcut on its own.

Imagine that you wanted to define triggers for, say, changing window mode, and also for transport operations, and you want to define them as separate sets. Each shortcut can then use two keys, for example. You could think of C1 as the key that identifies the “change window mode” set of shortcuts, so you would hold C1 and then hit e.g. D1 for Setup mode, E1 for Write mode, F1 for Engrave mode, and so on. Similarly, you could think of D1 as the key that identifies the transport shortcuts, so you would hold D1 and then hit E1 to start playback, F1 to stop playback, G1 to rewind to the start of the flow, or whatever.

So C1+D1, C1+E1, C1+F1 would all be shortcuts, as would D1+E1, D1+F1, D1+G1. Therefore when you play any of those individual keys, Dorico is waiting for you to play another key along with it, so it can work out which command you mean.

As such, you should not define any individual note that is part of a chord trigger as an individual trigger.

I hope I have expressed that sufficiently clearly.

1 Like

Hi Daniel,
Thanks so much for looking into this.
I am still rather confused, as some of the supposedly conflicting commands do work! For example, C1 sets an eighth note, while C1+G1 sets the grid to eighth notes. These are both working. But other ones don’t.

I would suggest you follow my (really Paul’s) advice: don’t use the same key both as a single key on its own and as a “chord” trigger.

I understand, and appreciate your detailed explanation. If I may make a feature request, it would be great to have both single and multi-note commands implemented to work consistently without getting in each other’s way. IMHO the tactility and shape of a piano keyboard provides a great way to execute commands by feel, without having to look at it much, and without having to switch back and forth too much between piano and QWERTY. The coding behind any of this is beyond me, but maybe there’s a way for Dorico to be able to see that if I’m not playing two notes simultaneously as a unit, then I don’t intend there to be a second note (especially since it already can do it sometimes).

Paul’s original intention was that you could play the two notes offset from each other, e.g. hold down C1 because you want to switch mode, then depress E1 because you want to switch to Write mode (or whatever).

Thanks for explanations Daniel, but I am not convinced by your explanation. Because Dorico doesn’t seem to wait for the next key after one key is pressed for MIDI commands. If we press one key and then the other (e.g. hold down C1, then depress E1, as you say), Dorico will not recognize it as a MIDI command. Only when two keys are pressed at the same time (e.g. hit C1 key and E1 key simultaneously) does Dorico recognise it as a MIDI command.

Just want to say that I’ve got all my intended key commands (including single and combo notes) working now, with one exception: for some reason, whenever I open Dorico, my key for respelling down doesn’t work even though it’s listed in the key commands; each time I open Dorico, I have to delete and re-enter that command, and then it works fine. It’s on G1, which is the only key that I’ve assigned three functions to (it has two additional functions in combo with other keys). Since it works as it should but I have to re-assign it every time I open Dorico, surely this is a glitch?

By the way, if anyone is interested, here is the layout I figured out.
It really speeds things up, especially the tuplets!