MIDI Clarification

Kecked

Member
Just want to see if I understand MIDI
You start with note on which is Decimal 144 followed by the value of the note (0-127) then pause until the note is released and issue note off or decimal 128. So middle C would be

HEX 0x90,0x3c",0x80 or
DEC 144,60,128 or
BIN 1001 0000,0110 0000,1000 0000

Basic code something like this as a generic
HSEROUT(144,note_value)
Pause(length_of_note)
HSEROUT(128)


HSERsetup would be N31250_8 for an 8mhz processor

Did I get this right?
 

hippy

Technical Support
Staff member
Not quite. When a key is pressed you send ...

Note On ( $9x, x = channel-1 )
Key Number ( 0-127, middle C = 60 )
On Velocity ( 1-127, default 64 )

You then pause, and when the key is released either send the same but with an On Velocity of zero, or -

Note Off ( $8x, x = channel-1 )
Key Number ( 0-127, middle C = 60 )
Off Velocity ( 0-127, default 64 )

Using Running Status can avoid sending command bytes every time but it's not quite as simple as that.

So to play a middle C ... Note On / Note On for Off ...

HSEROUT 0,( $90, 60, 64 )
Pause
HSEROUT 0,( $90, 60, 00 )

Or ... Note On / Note Off ...

HSEROUT 0,( $90, 60, 64 )
Pause
HSEROUT 0,( $80, 60, 64 )
 

Kecked

Member
Thanks. I assume I set the channel and mode with the same type of commands just before the loop that will read the adc for note values. Thanks for the reply I think this gets me going. I like the velocity idea as I can then add note decays.

For the use of anyone else reading this. I found that the note numbers run from 0-127 and 0 is C0 so middle C is=60 which is C5. Which makes sense since 127/12 is 10.58 and that is just about 10 12 note octaves and 5 is the middle of that range. Just thought I's add that since I had looked it up.

Here are all the notes and commands for standard midi in one place for you as well. Now will it blend...............

http://www.midimountain.com/midi/midi_note_numbers.html
http://www.midimountain.com/midi/midi_control_mode.html
http://www.midimountain.com/midi/midi_status.htm
 
Last edited:
Top