Mechanical Music Digest  Archives
You Are Not Logged In Login/Get New Account
Please Log In. Accounts are free!
Logged In users are granted additional features including a more current version of the Archives and a simplified process for submitting articles.
Home Archives Calendar Gallery Store Links Info
MMD > Archives > January 2005 > 2005.01.06 > 07Prev  Next


MIDI Explained in Piano Roll Terms
By Tony Decap

Looking at a piano roll in action has fascinated many people over the
years.  Being able to connect the movement of the holes (what you
see) to the music produced (what you hear) may have been one of the
key elements for many to get involved in mechanical music.

The loss of the visual aspect in a MIDI setup versus a piano roll is
for many a bridge too far -- and, one must admit, it is a loss.  But
the loss of the visual aspect is not intended, it's only a side-effect
resulting from the miniaturization.

And this miniaturization has advantages. If a piano-roll was used to
store a 250 kb picture from your digital camera (perfectly possible),
you would end up with a paper roll containing 2 million holes (250 kb
or 250,000 bytes of 8 bits each = 2,000,000 holes) -- not really
practical.  If a picture could be formed with 100 holes, you could have
imagined digital cameras with small paper rolls inside.

I found that many people without a technical background do not really
understand how MIDI actually works.  For some people it may be interesting
to read the following explanation in which I try to use the piano roll
as means to visualize how the MIDI system works, and stay on the
surface and use as few technical terms as I can.

There are two important elements in MIDI systems that you must keep
separate.  The first element is how MIDI is stored and played, and the
second is how MIDI data is transported.

  How MIDI is stored/played.

In a piano roll you have note-on (hole beginning) and note-off (hole
stopping).  Because we want more information then just note on/off,
there is a different system used.  In MIDI we not only use note-on/off:

- a note (hole) can also be something else, like a pedal command.
For this reason we call it not a note, but a MIDI-event.

- a MIDI-event can be on one of 16 channels (so you can serve 16
different instruments).

- a MIDI-event may need some extra information like the force that
a note is using (called velocity).

To accommodate all this, we use 3 x 8 holes in a horizontal position
next to each other that passes over the trackerbar at the same time
(1 means a hole, 0 means no hole), like

1111-1111 11111111 11111111 (all holes)
0000-0000 00000000 00000000 (no holes)

With a combination of these holes, you can make a number.  With 2 holes
you can make 22 or 2x2 or 4 numbers

00 = 0
10 = 1
01 = 2
11 = 3

With 3 holes you can make 23 or 2x2x2 or 8 numbers

With 4 holes you can make 2x2x2x2 or 16 numbers, and so on up to 255
numbers with 8 holes.

The first 4 holes are the STATUS (1 to 16).  This tells the MIDI-event
what it is going to be used for, for example a note-on (#9) or
controller (#10)

The second 4 holes are the CHANNEL (1 to 16).  This explains on which
channel this event is intended.

Of the second 8 holes, only the last 7 (0 to 127) are used.  This is
called DATA1.

Of the third 8 holes, only the last 7 (0 to 127) are used.  This is
called DATA2.

Why do they call it DATA1 and DATA2?  Well, as it can be used for
different purposes, depending the used STATUS, we need to give it a
general name, basically meaning nothing until the STATUS tells us what
the event will be.

If the STATUS says that it is a Note-on event, then DATA1 will be the
note played on the instrument (C, C#, D or whatever), and DATA2 will be
the force that is used to strike the note (velocity).

If the STATUS says that it is a CONTROL event, then DATA1 will be the
control used on the instrument (Sustain-pedal, Soft-pedal, volume etc),
and DATA2 will be the state of the controlled item (Sustain pedal
ON(127) or OFF(0), volume 0 to 127 etc)

To play a Note-on #30 on CHANNEL1 with a force of 100 you need to make
the following horizontal hole-combination:

1001-0000 00011110 01100100

1001 = 9, or STATUS Note-On
0000 = 0, or CHANNEL 1
00011110 = 30, or Note #30
01100100 = 100, or force 100 (on a scale of 0 to 127).

The moment these holes pass over the trackerbar, note 30 is played with
force 100.

  How MIDI is transported.

To simplify things when connecting instruments together, we use only
one wire in MIDI.  This means that all data has to be sent one after
the other.  So our horizontal example

1001-0000 00011110 01100100

is converted to a vertical line, putting one behind the other, like

^ (paper of piano roll moving upwards)
1
0
0
1
0
0
0
0

0
0
0
1
1
1
1
0

0
1
1
0
0
1
0
0

It takes about 1 millisecond (1/1000 of a second) for the 24 holes
[of one MIDI event] to pass over the trackerbar and/or through the
MIDI-wire.  In comparison with data rates used today, this is very
slow.  But for MIDI, it works in most cases.

The rate that the holes pass trough the MIDI wire (in piano roll terms
the paper feed rate) is called BAUD-RATE.  The problem with the serial
port of all computer devices (like for example the ittyMidi Player) is
that the BAUD-RATE used in MIDI (31,250 holes per second) is not
supported by the serial port of these devices.  In piano roll terms this
means that the paper moves at a different speed.  You can get close,
but not exact.

If you want it done by the book, you need a hardware converter which
re-cuts the piano roll so that the music plays not too slow nor too
fast, but in perfect time, so to speak.

Season greetings,

Tony Decap
Herentals, Belgium


(Message sent Thu 6 Jan 2005, 20:44:54 GMT, from time zone GMT+0100.)

Key Words in Subject:  Explained, MIDI, Piano, Roll, Terms

Home    Archives    Calendar    Gallery    Store    Links    Info   


Enter text below to search the MMD Website with Google



CONTACT FORM: Click HERE to write to the editor, or to post a message about Mechanical Musical Instruments to the MMD

Unless otherwise noted, all opinions are those of the individual authors and may not represent those of the editors. Compilation copyright 1995-2024 by Jody Kravitz.

Please read our Republication Policy before copying information from or creating links to this web site.

Click HERE to contact the webmaster regarding problems with the website.

Please support publication of the MMD by donating online

Please Support Publication of the MMD with your Generous Donation

Pay via PayPal

No PayPal account required

                                     
Translate This Page