Description
Is your feature request related to a problem? Please describe.
MEI allows the encoding of MIDI instrumentation preferences for individual staves using <instrDef>
, with a controlled-vocabulary textual label as @midi.instrname
or as a MIDI instrument number using @midi.instrnum
. However, in interactive applications it is easy to imagine situations where a user might want to be able to choose instrumentation for playback without wanting or being able to modify the encoding.
Describe the solution you'd like
My proposal is to introduce a new Verovio option, e.g. midiInstrumentation
. The option should accept either a single value or list of values:
- Single value: use this value for all staves
- List of values: use the list index to match each provided value to the corresponding staff, using empty values to fall back to default on individual staves, falling back to default on any staves where there are no values (i.e. if the provided list is shorter than the number of staves), and ignoring any values beyond the number of staves.
Use the provided value should be read as injecting a new <instrDef>
in the appropriate place, replacing any previously encoded ones, prior to rendering to MIDI.
Fall back to default should be read as making use of any existing encoded <instrDef>
information, or otherwise relying on system defaults (i.e., proceed without an encoded <instrDef>
).
Of course, the client application could already perform this injection on behalf of the user prior to handing the MEI to Verovio for MIDI-rendering, but providing this facility vie Verovio itself would prevent each application from having to reinvent the wheel.
Additional context
In my limited testing it appears that @midi.instrname
is not currently respected by Verovio. Ideally this would be fixed as part of this work, allowing the new option to accept either @midi.instrnum
or @midi.instrname
. If this presents an obstacle or if there is a reason to not support instrument names, the new option could be limited to supporting only instrument numbers instead.