Skip to content

Number Systems and Binary Concepts

Digital systems such as MIDI, computers, and microcontrollers represent all data using numbers. To understand how bytes, bits, MSB/LSB, and signed values work, it is important to understand the number systems used to represent those numbers.

Decimal Number System (Base 10)

The decimal system is the one humans use every day. Uses digits: 0–9 Each position represents a power of 10 Example:

345 = 3×100 + 4×10 + 5×1

Decimal is convenient for humans, but inefficient for electronic systems.

Binary Number System (Base 2)

Computers and digital protocols use binary, which has only two digits:

  • 0 (off)
  • 1 (on)

Each position represents a power of 2.

Example:

1011 (binary)
= 1×8 + 0×4 + 1×2 + 1×1
= 11 (decimal)

Binary maps directly to electronic circuits.

Bits and Bytes

  • Bit: a single binary digit (0 or 1)
  • Byte: 8 bits grouped together

Example byte:

01100001

A byte can represent values from:

  • 0 to 255 (unsigned)

MIDI uses 7-bit data values inside 8-bit bytes.

Hexadecimal Number System (Base 16)

Hexadecimal (hex) is a compact way to write binary numbers. Digits used:

0–9, A–F

Where:

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Each hex digit represents 4 binary bits.

Binary ↔ Hex Relationship

Example:

Binary:      10101100
Grouped:     1010 1100
Hex:         A    C

So:

10101100 (binary) = 0xAC (hex)

This is why hex is widely used in MIDI documentation.

Decimal, Hex, and Binary Side by Side

DecimalHexBinary
00x0000000000
100x0A00001010
640x4001000000
1270x7F01111111
1280x8010000000
2550xFF11111111

Why MIDI Uses 7-bit Values

MIDI data bytes must be in the range:

00000000 – 01111111

This ensures the highest bit is always 0, distinguishing data bytes from status bytes.

Most Significant Bit (MSB) and Least Significant Bit (LSB)

In a binary number:

  • MSB is the leftmost bit
  • LSB is the rightmost bit

Example:

Binary:  10110010
          ↑      ↑
         MSB    LSB

The MSB represents the largest value.

MSB and LSB in Multi-Byte Values

For values larger than 7 bits (like 14-bit MIDI values), data is split:

14-bit value:
[ MSB (7 bits) ][ LSB (7 bits) ]

Example:

Value = 8192
MSB = 64
LSB = 0

What Is a Nibble?

A nibble is 4 bits.

Examples:

  • One hex digit = one nibble
  • One byte = two nibbles
Byte:    10101100
Nibbles: 1010 1100

Nibble terminology is often used when discussing hex and bit masking.

Signed vs Unsigned Numbers

Unsigned Numbers Unsigned numbers represent only positive values. Example (8-bit):

0 – 255

Used for:

  • MIDI notes
  • velocities
  • CC values

Signed Numbers

Signed numbers represent both positive and negative values.

This is necessary for:

  • pitch bend direction
  • offsets
  • relative movement

Sign Bit

In signed representations:

the MSB is often used as the sign bit

  • 0 → positive
  • 1 → negative

But this alone is not enough — this is where two’s complement comes in.

Two’s Complement Representation

Two’s complement is the standard way computers represent signed numbers. Key Properties

For an 8-bit number:

  • Range: -128 to +127
  • Zero is represented normally
  • Negative numbers wrap around

Positive Example:

+5
Binary: 00000101

Negative Example;

To represent -5:

  • Write 5 in binary
  • Invert all bits
  • Add 1
5  = 00000101
~5 = 11111010
+1 = 11111011   → -5

Why Two’s Complement Is Used

  • Only one zero exists
  • Arithmetic works naturally
  • Hardware is simpler
  • This is why nearly all modern systems use it.

Pitch Bend and Signed Values

Pitch bend uses a signed 14-bit value, but is transmitted as unsigned bytes.

  • Center value: 8192
  • Below center → bend down
  • Above center → bend up

The receiving device interprets this as signed internally.

Summary

Decimal, binary, and hexadecimal are different ways to represent the same numbers. Binary is used by computers, hexadecimal provides a readable shortcut, and decimal is used for human interaction. Concepts such as MSB, LSB, and nibbles describe the structure of binary data, while signed representations like two’s complement allow negative values. These concepts are fundamental to understanding MIDI messages, high-resolution values, and digital protocols.

Made with 🩶 in the EU · © 2019–2026 Electra One