implement proper preset fallback when using instruments on banks > 0

• Mar 2, 2018 - 15:46
Reported version
S4 - Minor

According to the General MIDI standard, if a user tries to access a preset on a bank > 0, and that preset doesn't actually exist, the sound should fall back to the same preset number on bank 0.

Here's an example that affects MuseScore:
1. User has selected "Slow Violin" (bank 8, preset 40) for a staff.
2. User changes to a different SoundFont that doesn't include an instrument on bank 8, preset 40.
Result: The user now hears the instrument at bank 0, preset 0, which is "Grand Piano".
Expected result: The user should now hear the instrument at bank 0, preset 40, which is "Violin".

This will become especially problematic as the new MuseScore SoundFont is developed, as there will be numerous presets for many orchestral instruments, such as:
Bank 0, Preset 48: Section Strings
Bank 10, Preset 48: Section Violins 1
Bank 11, Preset 48: Section Violins 2
Bank 12, Preset 48: Section Violas
Bank 13, Preset 48: Section Celli
Bank 14, Preset 48: Section Basses

These additional instruments will be available in MuseScore on PC and the web player, but a simpler SoundFont will ship with the mobile version that won't include all the extra instrument sounds. We need to make sure that when somebody has selected "Section Violins" that it will play back using the "Section Strings" sound when "Section Violins" is not available. We can't have all these instruments turning into pianos.


This is now fixed in both master and 2.2. Tests are welcome. The mobile apps or the MIDI web player are probably using an entirely different logic.