MIDI remote control: MIDI channel

• Jan 2, 2017 - 22:38

I have a master keyboard (AKAI Pro MPK 249) which has additional buttons such as trigger pads. I have routed the main keyboard to MIDI channel 0 and the trigger pads to MIDI channel 1 (by using the settings in the keyboard's firmware). In MuseScore (version 2.0.3 revision 3c7a69d) I have recorded MIDI remote control events for the trigger pads, however these commands are also executed for keys on the main keyboard, so it seems that MuseScore fails to distinguish between both MIDI channels. Is it correct that MuseScore ignores the channel? Will there be support for different MIDI channels in the future? I suppose the bindings are saved somewhere in MuseScore.ini. Under which keywords can I find them? I want to delete specific commands.


Comments

Yes, I believe MuseScore ignores the channel. However you should be able to use the trigger pads without using another channel if the trigger pads send a controller and not a noteOn event.

There is no plan to support different channels for the remote (but feel free to take a look and contribute). You can delete the mapping from Preferences > Note input. If you insist, they are indeed in the ini file, under the "remoteX" keys.

In reply to by [DELETED] 5

I see, thank you. In the Preferences > Note input dialog I can delete all mappings with the Delete button, and after that re-set those I want to keep.
When I have some spare time, I might have a look at the implementation of the remote control. Can you please point me to the corresponding function(s) in the sources?

In reply to by Andreas S.

I'm not a musescore developer but this interested me, as I thought I'd try the MIDI remote, but I'm sorely disappointed. I have multiple keyboards and also a Novation LaunchPad. All send note-on (not controller) messages but on different channels. This would be an obvious way - enter notes on the bottom keyboard, use special keys on the top keyboard.
It looks like a VERY simple fix although of course it needs to be done well for the developers to accept.
The MIDI remote handling looks like it is all in https://github.com/musescore/MuseScore/blob/master/mscore/musescore.cpp , look for references to processMidiRemote() function.

The function MuseScore::midiNoteReceived(channel,pitch,velo) calls processMidiRemote( ..,pitch,velo). Notice that it passes the note value but does not pass the channel.
So amend processMidiRemote to have an extra parameter ( type, CHANNEL, data,value ). That's a doddle, seems like an oversight it is not there already.

Then ... how would this be expressed in preferences? I can see two ways
1. Have a "MIDI Remote Channel" which can be set to ALL (default) or 1..16.
or 2. MIDI channel is stored against each control (Play/Pause/Quarter note/Rest/Undo etc)

For 1. The advantage of this is that if you change the channel of your remote keyboard, then all you need to do is change the channel in the preferences dialog and all the shortcuts continue to work on the new channel. This would solve my use case completely.

I haven't looked at what is involved in adding a preference for "MIDI Remote Channel",but there will be heaps of examples. Assume the preference is called PREF_MIDI_REMOTE_CHANNEL with valid values 0 (all),1,2,...16

then amend processMidiRemote(..) to add the code

    int nRemoteChannel = preferences.getInt(PREF_MIDI_REMOTE_CHANNEL);
    if(  ! (nRemoteChannel == 0 || nRemoteChannel == channel ) { return false; }

This would solve my use case completely.

For 2. I suspect it is a bit more complicated. Some people may wish a channel to be configured per remote operation, so that for example note durations come from the top octave of a MIDI keyboard, but the Start/Stop/Pause/Rewind are on a device like a LaunchPad.

For this. the MidiRemote structure (in globals.h) already has a channel parameter, so processMidiRemote() could simply test that , ie
    if (preferences.midiRemote(i).type == type && preferences.midiRemote(i).data == data) ...
becomes

    if (preferences.midiRemote(i).type == type && preferences.midiRemote(i).data == data
       && (preferences.midiRemote(i).channel==0 or preferences.midiRemote(i).channel == channel ) ) ...

However by the looks, there need to be change in preferences.cpp to ensure the channel loads/saves in preferences.ini; and in the recording, ie
    preferences.updateMidiRemote(_midiRecordId, MIDI_REMOTE_TYPE_NOTEON, pitch);
becomes
    preferences.updateMidiRemote(_midiRecordId, channel, MIDI_REMOTE_TYPE_NOTEON, pitch);

Now I suppose I should learn how to patch and compile it. <sigh> Sadly that is far more work for me.

In reply to by [DELETED] 5

Thanks. I just might although as you surely know, going from the source on github to being able to submit a tested patch is going to be a long journey. Fell at the first hurdle (well second, already have VS2017) because the QT installer is currently broken so not this weekend!

In reply to by waltern

Just thought overnight, could implement both options if the preference for "MIDI Remote channel" has another option: "As recorded" in addition to 1-16 and Any/All.
More of a problem is that there are additional functions that would be required for me to completely set aside the mouse and keyboard for note entry. Everyone is going to have their favourites, but the first that comes to mind is the enharmonic switcher (key shortcut J). That might be doable as a one-off to scratch a personal itch, but beyond that I think what is really needed is a way mapping MIDI notes to ANY function in the same way as keyboard shortcuts, which would be way cool but considerably bigger territory.

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