OpenNBS / OpenNoteBlockStudio

An open-source Minecraft music maker.
https://noteblock.studio
MIT License
746 stars 51 forks source link

Missing Instruments when importing from MIDI #400

Closed miclol closed 1 year ago

miclol commented 1 year ago

Describe the bug Instruments seem to be omitted by NBS when imported via MIDI.

To Reproduce Steps to reproduce the behavior:

  1. Extract the Midi File from here: ttlo.zip
  2. Import it to the latest version of NBS
  3. Check the Tracks and Instruments Tabs before importing the Midi
  4. Notice that the Square Synthesizer Instrument is never addressed in the instruments tab but is in the tracks tab even though there are notes in the track that should not be omitted.
  5. Even after you import the file the instrument is still missing.

Expected behavior The Square Synthesizer Instrument to be in the imported result.

Screenshots

image image
Bentroen commented 1 year ago

Thank you for the detailed report!

NBS currently doesn't support multiple tracks mapped to a single channel – the instrument list is always based on the number of channels present in the file, so there's no proper support for stuff like mid-track instrument changes. I believe this is the issue at play here – it correctly identifies the track but it's not imported as a separate instrument.

Do #179 and #194 describe the change you're proposing?

miclol commented 1 year ago

Yes, it seems like the problem comes from Musescore creating unused channels in the MIDI files and overriding them with new instruments when it eventually runs out of MIDI channels to use. So even though the instrument count is lower than 16, it replaced the instrument in the same channel anyway.

Bentroen commented 1 year ago

Duplicate of #179