MIDI output - are the instruments properly mapped ?

• Jun 2, 2021 - 21:19

dear all,
I exported a score to midi format, and then using midi2abc I generated the abc format.
There I noticed that all instruments are given the corresponding value of the patch number from the MIDI standard, minus 1.
Choir: should be patch 53 however in the abc code is %%MIDI program 52
Flute: should be patch 74 however in the abc code is %%MIDI program 73
Clarinet: should be patch 72 however in the abc code is %%MIDI program 71
Tenor Sax: should be patch 67 however in the abc code is %%MIDI program 66
Acoustic gran piano: should be patch 1 however in the abc code is %%MIDI program 0

Please can someone explain me why are they all "-1" ?


Comments

Is it breaking on MIDI export or on ABC import? Or on that midi2abc conversion?
Only the MIDI export is something MuseScore can influence

MIDI has bytes for most data, and the topmost bit is used to signal things, so most things in MIDI are 0‥127 internally. However, most things in the documentation of MIDI, and hence in most applications, use +1 (so 1‥128) instead because most nōn-programmer people think 1-based, not 0-based.

Low-level software like midicsv/csvmidi and, probably, midi2abc, display the values as they are in the MIDI bytes, whereas high-level software tends to add 1.

In reply to by mirabilos

Thankyou mirabilos for your fast reply.
According to the MIDI specification

"The message is sent as a registered parameter number controller message, followed by either a data
entry, data increment, or data decrement controller message, e.g. (with running status shown):

Bn 64 03 65 00 06 tt (data entry)
Bn 64 03 65 00 60 7F (data increment)
Bn 64 03 65 00 61 7F (data decrement)
n = basic channel number
tt = Tuning Program number (1-128) "

The values of "tt" can only be 0-127 because "tt" is a hexidecimal number, with a 1 Byte size limit.
Therefore, it can only store values 0..127 and not "128".

According to MMA's comment in https://www.midi.org/midi/forum/3810-midi-tuning-program-change-and-ban…
"The spec is not referring to the value of "tt", the spec is referring to what "tt" is used for, which is to select Program and Bank numbers, where the first number is "1", and the last number is "128"."

An interesting case of a standard that uses a "0" to actually mean "1":-)

Anyhow, thank you for the support and always fun to learn different way of thinking !

Do you still have an unanswered question? Please log in first to post your question.