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.36k stars 2.67k forks source link

Midi Implementation Specification, Midi output tests, and any bug fixes that come as a result. #25306

Open chrisroode opened 1 month ago

chrisroode commented 1 month ago

Your idea

I was looking at 'Fix multiple MIDI out issues #24944' and discovered some other strange behavior with at least the grand piano instrument. When given pitches on the extreme ranges of the instrument, the midi pitch output defaults to 0x6C. For example, pitches on the staff that should output MIDI pitches 0x00 - 0x0B instead output 0x6C.

Having discovered this, I created a repository for test MuseScore files that are designed to act as a benchmark for the midi output of museScore.

Problem to be solved

Prior art

I ran into this problem with Finale while writing my own JSX effect for Reaper to interpret MIDI output for my own compositions. When asking Finale for help on discerning what midi should be output, I received no help and had to resort to trial and error. The problem was never solved before finale was sunset.

Additional context

One of my personal requirements for composition software down the road is a better way to automate the score to midi. I write drumline music, and I have essentially worked out formulas for interpreting dynamics into velocity, but I need to know for sure what is output by MuseScore to have a good chance at making my own scripts succeed. In the past, I have found myself having to write the piece multiple times (once for notation and once for audio) to assemble everything for publication. There should be no need to do that.

Checklist

rpatters1 commented 1 month ago

Ultimately, I wonder if the proper solution would not be to incorporate the benchmarks into the automated test suites. That would mean rather than a separate repo of benchmark files, they would be part of this repo. (Unless you are imagining a benchmark for all programs?)

cbjeukendrup commented 1 month ago

When given pitches on the extreme ranges of the instrument, the midi pitch output defaults to 0x6C. For example, pitches on the staff that should output MIDI pitches 0x00 - 0x0B instead output 0x6C.

I think this is covered by https://github.com/musescore/MuseScore/issues/16657.

cbjeukendrup commented 1 month ago

But about the rest of this feature request: do I understand right that this is a request for precise documentation of the current behaviour? I'm afraid we won't be able to release such documentation anytime soon, on the one hand because it is a lot of work to write and we don't really have the manpower to do that at the moment, and on the other hand because the produced output is still subject to change.

I should also note that there is currently no relation between "live" MIDI output (which kind of works, but is not really supported at the moment) and MIDI export. The "live" MIDI output is namely currently implemented as a side effect of the sound font playback synth, because that uses something similar to MIDI events; and MIDI export uses legacy code from MS3, that is not aware of MS4's new playback engine. So MIDI output and export are still very much under construction.

chrisroode commented 1 month ago

cbjeukendrup! Thanks for filling me in. This problem interests me a lot, and knowing it's under construction is a great, because I think I might be able to help. Of course, I don't want to start sticking a faucet where a toilet should go, so is there a roadmap of where the MS4 playback engine is located in the source, and where the MS3 code is too?

I found the Fluid Sequencer files, which have the magic numbers causing the output range. It would be good to know if this is new or legacy code, so I could review it and get an idea of what is getting reworked, and what is here to stay.

After I have some time to gather my thoughts, I would love to assemble a proposal, but also understand and respect all of the work that is currently going on.