Professional Documents
Culture Documents
Message
Receiving
Device
Required action
Status
Reply
Complex networks are possible, as long as each device is reachable by any other device.
DAC
ADC
at new fs
LPF
Re-sampled
Signal
Interpolation
Decimating
LPF
Re-sampled
Signal
It is often useful to view MIDI bytes in binary or hexadecimal form, so the table above lists
both alternate notations for the numbers in the decimal range. In binary notation, the number
0 -- 127 all start with a zero in the top bit of the MIDI byte. Commands bytes likewise start with
a 1 bit in the highest position in the byte.
Data bytes are used to transmit things such as the note number, attack velocity, piano pedal
positions, volume, pitch bend, and instrument numbers. Command bytes are the first byte of
MIDI messages which are then followed by a fixed number of MIDI data bytes. For example,
the MIDI message to turn on the note Middle C would be:
128 60 100
Notice that the first number is in the command byte range of 128-255. This must mean that it
is a command -- which it is. Command byte 128 means turn on a note. This command
requires two data bytes immediately following it. The first data byte indicates which note key
to turn on, and the second data byte indicates how loud to play the note. In this case, the key
number is 60, which is the key number for the pitch middle C (C4). The second data byte is
called the attack velocity. A value of 100 for the attach velocity would be maximum if it were
127, or minimum if it were 1.
MIDI Message Types
MIDI commands can be further decomposed into a command type nibble (four bytes) and a
channel number nibble. In the case of the MIDI note-on message given above, here is the
binary form of the command byte 128: 10000000. Split this number into four byte segments:
1000,0000. The first nibble is 1000 which incidates the command type -- note-on command.
The second nibble is 0000 which indicates the MIDI channel number the note is playing on. In
this case 0000 indicates the first MIDI channel, which is also called MIDI chanel one. It is
usually most convenient to view MIDI command bytes in hexadecimal format. A hexadecimal
digit is equal to a single nibble which is four digits of a binary number. Here is the MIDI
command byte 128 displayed in hexadecimal and binary forms:
command nibble
channel nibble
hex
8
0
binary
1000
0000
A MIDI channel is used to play multiple instruments at the same time. Each instrument
playing simultaneously would occupy a separate channel on the synthesizer. The instrument
playing on a channel can be changed.
Here is a table of conversions between binary, hexadecimal and decimal forms of numbers.
This table is useful to keep track of the different ways of viewing numbers in MIDI bytes:
Binary
Hex
Dec
Binary
Hex
Dec
Binary
Hex
Dec
Binary
Hex
Dec
0000
0100
1000
1100
12
0001
0101
1001
1101
13
0010
0110
1010
10
1110
14
0011
0111
1011
11
1111
15
MIDI command nibbles must start with a 1 in binary format, therefore there are three binary
digits left over for specifying a command. This means that there are eight possible MIDI
command types. These commands are listed in the table below:
command
nibble
8
9
A
B
C
D
E
F
command
name
note-off
note-on
aftertouch
control-change
patch-change
channel-pressure
pitch-bend
system-message
data
bytes
2
2
2
2
1
1
2
0 or
variable
data
meaning
key #; release velocity
key #; attack velocity
key #; key pressure
controller #; controller data
Instrumnet #
channel pressure
lsb; msb
none or sysex
OSC Syntax
All OSC data is composed of the following fundamental data types:
1. int32: 32-bit big-endian two's complement integer
2. OSC-timetag: 64-bit big-endian fixed-point time tag, semantics defined below
3. float32: 32-bit big-endian IEEE 754 floating point number
4. OSC-string: A sequence of non-null ASCII characters followed by a null, followed by 03 additional null characters to make the total number of bits a multiple of 32. (OSCstring examples) In this document, example OSC-strings will be written without the null
characters, surrounded by double quotes.
5. OSC-blob: An int32 size count, followed by that many 8-bit bytes of arbitrary binary
data, followed by 0-3 additional zero bytes to make the total number of bits a multiple
of 32.
OSC Packets
The unit of transmission of OSC is an OSC Packet. Any application that sends OSC Packets
is an OSC Client; any application that receives OSC Packets is an OSC Server. An OSC
packet consists of its contents, a contiguous block of binary data, and its size, the number of
8-bit bytes that comprise the contents. The size of an OSC packet is always a multiple of 4.
The underlying network that delivers an OSC packet is responsible for delivering both the
contents and the size to the OSC application. An OSC packet can be naturally represented by
a datagram by a network protocol such as UDP. In a stream-based protocol such as TCP, the
stream should begin with an int32 giving the size of the first packet, followed by the contents
of the first packet, followed by the size of the second packet, etc.
The contents of an OSC packet must be either an OSC Message or an OSC Bundle. The
first byte of the packet's contents unambiguously distinguishes between these two
alternatives.
OSC Messages
An OSC message consists of an OSC Address Pattern followed by an OSC Type Tag String
followed by zero or more OSC Arguments.
OSC Address Patterns
An OSC Address Pattern is an OSC-string beginning with the character '/' (forward slash).
OSC Type Tag String
An OSC Type Tag String is an OSC-string beginning with the character ',' (comma) followed
by a sequence of characters corresponding exactly to the sequence of OSC Arguments in the
given message. Each character after the comma is called an OSC Type Tag and represents
the type of the corresponding OSC Argument. (The requirement for OSC Type Tag Strings to
start with a comma makes it easier for the recipient of an OSC Message to determine whether
that OSC Message is lacking an OSC Type Tag String.)
OSC Type Tags:
1. i: int32
2. f: float32
3. s: OSC-string
4. b: OSC-blob