From: mrk@gvgspd.gvg.tek.com (Michael R. Kesti)
Newsgroups: rec.music.synth,comp.music
Subject: Numbers (Was: Problem with SysEx dumps...)
Date: 24 Nov 92 01:13:20 GMT
Distribution: usa
Organization: Grass Valley Group, Grass Valley, CA
NNTP-Posting-Host: gvgspd.gvg.tek.com

In article <1992Nov23.133450.1@adcalc.fnal.gov> kissel@adcalc.fnal.gov writes:

>In article <3178@bsu-cs.bsu.edu>,
                           jaysen@bsu-cs.bsu.edu (Jason A. Brotherton) writes:

>>    F0 40 00 02 00 04 00 00 F7
>>    |  |  |  |  |  |  |  |  |- End of transfer
>>    |  |  |  |  |  |  |  |---- Sub Command #2 for Data Dump All, Internal
>>    |  |  |  |  |  |  |------- Sub Command #1 for Data Dump All, Internal
>>    |  |  |  |  |  |---------- K4 Id #
>>    |  |  |  |  |------------- Synthesizer Group
>>    |  |  |  |---------------- Function Group # for Data Dump All
>>    |  |  |------------------- Channel #  (why is this not 1????)
>>    |  |---------------------- K4 Id #
>>    |------------------------- SysEx Message
>> 

>                       As far as the channel #'s, the Sysx data is in
>hexidecimal, so the MIDI channel #'s are 0 thru F.  - Wally

No, it has nothing to do with these numbers being expressed in hexadecimal.
Jason could have just as accurately written the message above, without
affecting the content, in the following way:

     240 64  0  2  0  4  0  0 247

Had he written it this way, he would have been using decimal numbers, rather
than hexadecimal, but the magnitudes of the numbers, and therefore their
meaning, would not have been changed.

The reason the value of the channel field in this message is 0, rather than
the 1 that Jason expected is that the channel information is held in the
low 4 bits of this byte, and those four bits can exist in 16 different
combinations.  They may be:

			BINARY   DECIMAL   HEXADECIMAL
			------   -------   -----------
                         0000  =    0    =      0
                         0001  =    1    =      1
                         0010  =    2    =      2
                         0011  =    3    =      3
                         0100  =    4    =      4
                         0101  =    5    =      5
                         0110  =    6    =      6
                         0111  =    7    =      7
                         1000  =    8    =      8
                         1001  =    9    =      9
                         1010  =   10    =      A
                         1011  =   11    =      B
                         1100  =   12    =      C
                         1101  =   13    =      D
                         1110  =   14    =      E
                         1111  =   15    =      F

Because of this, we should say that the 16 MIDI channels available are 0
through 15, but many people are uncomfortable with this, so the manufacturers
choose instead to number them 1 through 16.  When dealing with the message
data directly, we must remember this.

Similarly, the MIDI program change command's data field allows the use of the
low 7 bits of a byte to specify which of 128 programs are to be selected.
This time, though, some manufacturers allow the user to (correctly!) use 0
through 127, while others use 1 through 128, causing even more confusion!

Here comes the part that often gets people upset.  The reason that people are
uncomfortable with using 0 through 15 to number MIDI channels is that our
primary school teachers taught us to count "1, 2, 3, 4, 5, 6, 7, 8, 9, 0",
rather than "0, 1, 2, 3, 4, 5, 6, 7, 8, 9", and failed to teach us the
difference between quantity and ordinal position.

Think about it!

-- 
============================================================================
Michael Kesti  Grass Valley Group, Inc. | "And like, one and one don't make
    mrk@gvgspd.GVG.TEK.COM              |  two, one and one make one."
    !tektronix!gvgpsa!gvgspd!mrk        |         - The Who, Bargain