Jump to content
  • 0
jeffythedragonslayer

General MIDI patch numbers off by one

Question

I've noticed that in Cakewalk, MIDI patch numbers are off by one compared to the General MIDI patch numbers.  Is there a technical reason for this?

For example, in Cakewalk, if I type an 8 into the patch box, I get a Celesta.  If I type 9 into the patch box, I get a Glockenspiel.  These patches are numbered 9 and 10 in the General MIDI Level 1 Instrument Patch Map:

https://www.midi.org/specifications-old/item/gm-level-1-sound-set

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 2

There are two conventions, 0-127 and 1-128.

Which one is used is determined by the GM instrument, not by CW. You need to use the correct instrument definition for what you have.

Edited by bdickens
  • Great Idea 1

Share this post


Link to post
Share on other sites
  • 1

I think it can be confusing. The patch numbers are listed as 1-128, but MIDI is Musical Instrument Digital Interface (IIRC). It's a digital bus and the program change message has two bytes, status and data. The data has the program number and the values are specified as 0-127 in a MIDI program change message. So, yeah, it's technical.

Along the same lines MIDI channels are displayed as 1-16, but in the status byte they are represented as 0-15.

Edited by rsinger

Share this post


Link to post
Share on other sites
  • 0
23 minutes ago, rsinger said:

It's a digital bus and the program change message has two bytes, status and data. The data has the program number and the values are specified as 0-127 in a MIDI program change message.

Is the high bit of the program number simply unused, reserved for future use?

Share this post


Link to post
Share on other sites
  • 0
28 minutes ago, Jeff Linahan said:

Is the high bit of the program number simply unused, reserved for future use?

The high bit in 8-bit midi is a midi command flag.  So data [the bytes that follow the command in 2-byte and 3-byte MIDI command formats] use the lower 7-bits.

Example 1: 0x90  0x4F 0x7F, where 0x90 is a note on command for midi channel 1, 0x4F is the note number [runs from 0x00 to 0x7F] and 0x7F is the velocity [0x00 to 0x7F].

Example 2: 0xCF 0x7F, where 0xCF is a program change command for midi channel 16 and 0x7F is "patch" 128 on a 1 to 128 scale, or 127 on a zero to 127 scale.

 

Edited by User 905133

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, User 905133 said:

The high bit in 8-bit midi is a midi command flag.  So data [the bytes that follow the command in2-byte and 3-byte MIDI command formats] use the lower 7-bits.

Not sure what you mean by "midi command flag."  I found this copy of the standard (page 10) appears to mandate that the high bit of a program change message be unset.

https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf

I'm not sure how much equipment will go haywire if you set that bit; I wonder if it could someday be used to allocate another 128 MIDI instruments like 7-bit ASCII was extended.

Share this post


Link to post
Share on other sites
  • 1
1 hour ago, Jeff Linahan said:

Is the high bit of the program number simply unused, reserved for future use?

The short answer: No.  The high bit in the program number being 0 is intentionally used to identify the number as data. 

The long answer:

1 hour ago, Jeff Linahan said:

Not sure what you mean by "midi command flag."  I found this copy of the standard (page 10) appears to mandate that the high bit of a program change message be unset.

When you asked "Is the high bit of the program number simply unused, reserved for future use?" I assumed you understood the structure of midi commands [midi status bytes and midi data].  Evidently I assumed too much.  Sec while I look at the link.

Quote

1100nnnn 0ppppppp

Program Change.

This message sent when the patch number changes. (ppppppp) is the new program number.

1100 in binary  = 0xC

nnnn is the channel number (0x00 to 0x0F) corresponding to human numbers 1 to 16 

1100nnnn represents 0xCn, aka the Program Change Command in MIDI  0ppppppp represents the Program Change Value.

---------------------------------

This is a two-byte MIDI command.  The first byte is the status byte.  Since the highest bit is set  [1100 nnnn] it says, "Hey, this is a midi command." Since the first half [nybble] is 1100 [0xC], it says, "Hey, this midi command is supposed to do a program change."  nnnn says, "Hey, do this patch change on MIDI channel nnnn [1-16, where nnnn goes from 0000 to 1111].

The second byte is the MIDI data. Since the highest bit is clear [0ppp pppp], it says, "Hey, I'm MIDI data [not a MIDI Command]." Since MIDI data is 7 bits long, it goes from 0000 1111 to 0111 1111 (or, 0x00 to 0x7F; or 0 to 127)

In the status byte, the highest bit is set.  That tells any program/routine that is processing midi, that it is a midi command as opposed to midi data.  

1 hour ago, Jeff Linahan said:

I'm not sure how much equipment will go haywire if you set that bit; I wonder if it could someday be used to allocate another 128 MIDI instruments like 7-bit ASCII was extended.

If you are using software that handles MIDI for you, you shouldn't have to worry about trying to set the highest bit in the data byte.  If you are writing your own code, it would make a difference.

Bank Select / Bank Switching (where implemented) is included in the MIDI Spec so gear and users can switch banks of 128 programs/patches/presets.  Pages 12-13 of the document you found show the Continuous Controller MIDI data bytes for selecting banks.  Control Change commands are 3-bytes: status, CC number, data value.

 

Edited by User 905133
multiple edits: typo fixes, additional explanations

Share this post


Link to post
Share on other sites
  • 0

Aside from an academic interest, I don't think any of this matters. Its all supposed to be transparent to the user.

  • Like 1
  • Meh 1

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, bdickens said:

Aside from an academic interest, I don't think any of this matters. Its all supposed to be transparent to the user.

YUP!!!!!!

1 hour ago, User 905133 said:

If you are using software that handles MIDI for you, you shouldn't have to worry about trying to set the highest bit in the data byte.  If you are writing your own code, it would make a difference.

But the OP seemed to be interested in the deep structure of MIDI:

1 hour ago, Jeff Linahan said:

Is the high bit of the program number simply unused, reserved for future use?

1 hour ago, Jeff Linahan said:

https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf

I'm not sure how much equipment will go haywire if you set that bit; I wonder if it could someday be used to allocate another 128 MIDI instruments like 7-bit ASCII was extended.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...