MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI-OX >> Questions and Discussion >> getting hex number in data1 & data2
(Message started by: blacklions on Jun 3rd, 2017, 8:57am)

Title: getting hex number in data1 & data2
Post by blacklions on Jun 3rd, 2017, 8:57am
my understanding data1 & data should show numbers from 0 -127.  I'm getting numbers like data1=48 & data 2=6D or data1=4C and data2=71.  Don't know what the letters mean. Can't find a description in the help file.  Any help would be appreciated.

Thx in advance

Title: Re: getting hex number in data1 & data2
Post by Breath on Jun 3rd, 2017, 9:11pm
When dealing with digital computers it is often better to use a number system related to the number 2 instead of the normal one which is related to the number 10
In decimal the column is related to 10
0 to 9
10 to 99
100 to 999
etc
as you add an extra column to the number you go up by a factor of 10

So binary each column is related to 2
0=0
1=1
10=2
11=3
100=4

In Hexadecimal(Hex), which is based on 16, we use all the Arabic numbers 0 to 9 and the letters A B C D E F so each column is related to 16

Confusing I know, but for midi it is very useful

Midi was designed for digital computers so it uses Hex.
There are 16 channels which is perfect for Hex
There are 7 type of Midi messages that have the Channel in it
80 = Note Off
90 = Note On
A0 = Polyphonic Key pressure
B0 = Continuous Controller
C0 = Program Change
D0 = Aftertouch
E0 = Pitch Bend
Just add the channel  ( 0 to F)

The 'Fsomething' messages are all special and don't have a channel (so there are 16 types of these Midi messages F0 to FF)
For example
F0 = Start of System Exclusive
F7 = End of System Exclusive
FF is system reset

So except for the 'Fsomething' messages we combine the message type and the channel in to an easily readable two column number

Note On is 144 or 90 in hex (only two columns to display)
So
90 is note on for channel 0 although we really think of it as the first channel, channel 1
91 is note on for channel 1 - channel 2 really, just add 1 to the hex
92 is note on for channel 3
93 is note on for channel 4
...
99 is note on for channel 10
9A is note on for channel 11
9B is note on for channel 12
9C is note on for channel 13
9D is note on for channel 14
9E is note on for channel 15
9F is note on for the last channel , channel 16

Very confusing when you start, but really easy to work things out when you get use to it
152 is note on for channel 9. Much easier in Hex  (152 = 98 hex or 9 for Note On and 8 for channel and add one)

The data bytes, as you said, are 0 to 127 (or 00 to 7F in hex)

Happily MidiOx can flip between Hex and Decimal very easily.
Just right click on the Monitor (input or output) and select "Display Decimal"
To switch back to Hex do the same thing but it will say "Display Hex"


All the best
Royce



MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.