musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.21k stars 2.65k forks source link

Mapping MIDI button executes command twice - on both press and release #17549

Open brettrp opened 1 year ago

brettrp commented 1 year ago

Issue type

Other type of issue

Bug description

Assigning a MIDI button to command executes the command twice: once on press and once on release. This means:

Steps to reproduce

  1. Attach a MIDI keyboard (I used an MAUDIO Oxygen 49)
  2. Go to Preferences -> MIDI mappings
  3. Choose Note Input, Assign MIDI Mapping, and then click a button on the MIDI keyboard
  4. Go back to the score. Press the newly assigned button. Instead of toggling into Note Input mode, Musescore switches into Note Input mode when the button is pressed, and out again when it's released.

Screenshots/Screen recordings

see comment

MuseScore Version

OS: macOS 13.3, Arch.: x86_64, MuseScore version (64-bit): 4.0.2-230651546, revision: github-musescore-musescore-dbe7c6d

Regression

I don't know

Operating system

macOS 13.3.1, Apple M1 Max MacBook Pro

Additional context

No response

brettrp commented 1 year ago

Additional information:

Using MIDI Monitor, I can see that the buttons are sending

I think this is pretty normal default behaviour for a MIDI button.

It is possible to change the button to behave as a toggle (e.g. send 127 on the first press, 0 on the second press). However, this still leaves the issue of actions like Undo and Tie. These probably shouldn't be executing on the 0 (up/off) message.

tsumare commented 1 year ago

My Akai MPK Mini III keyboard has a similar problem.

When I press down on a pad, it sends [185, 21, 127]. When I release the pad it sends [185, 21, 0].

The result of this is as this issue describes. If I bind CC 21 to "Play", MuseScore will play my music only when I am holding it down, as it registers the release message (level 0) as another press.

MuseScore 3 behaves correctly when it receives the same sequence of events. I suspect that it simply ignores CC messages with level 0. This behavior would seem to be appropriate in MuseScore 4 as well. Certainly as an option, if not the default.

I am glad to see #15219 fixed, as it was a major reason I was unable to upgrade to MuseScore 4.0. Unfortunately, due to this issue, MIDI controller bindings are still relatively unusable.

DmitryArefiev commented 1 year ago

Can reproduce with my Arturia KeyLab 66 as well (4.2 master, Win10)

Doesn't occur in MS3

https://github.com/musescore/MuseScore/assets/90187801/6549ac1e-9cbd-4260-ac50-6f9c7253c1cf

mikefoxnobel commented 10 months ago

Can reproduce with my Novation LaunchKey 37.

OS: Windows 10 Version 2009 or later, Arch.: x86_64, MuseScore version (64-bit): 4.1.1-232071203, revision: github-musescore-musescore-e4d1ddf

gogo94210 commented 3 months ago

bumping this again, reproducible with a novation launchkey 49 that does indeed send a midi message with strength 0 when releasing a key, that musescore interprets as "release the button". For some reason this behaviour does not apply when selecting a note length in editing mode (I have CC 51 to 56 mapped to choice of length).

This leads to me having to hold the button for things like playing, entering editing mode, etc.

As @tsumare said, it works as intented in the latest musescore 3 version and you don't need to hold the button.

OS: Windows 10 Version 2009 or later, Arch.: x86_64, MuseScore Studio version (64-bit): 4.3.2-241630831, revision: github-musescore-musescore-22b46f2

wizofaus commented 3 months ago

Affecting me too, Windows 11, Line6 MobileKeys49.

run-time commented 1 month ago

consecutive down/up commands • 127 • 0 • from the same midi button (1 second or less) should count as a single button hit for MuseScore midi mappings.