# LV2 MIDI

A normalised definition of raw MIDI.

ID | http://lv2plug.in/ns/ext/midi
Version | 1.10
Discuss | devel@lists.lv2plug.in (subscribe)

- Index
- API

This specification defines a data type for a MIDI message, MidiEvent, which is normalised for fast and convenient real-time processing. MIDI is the Musical Instrument Digital Interface, a ubiquitous binary standard for controlling digital music devices.

For plugins that process MIDI (or other situations where MIDI is sent via a generic transport) the main type defined here, MidiEvent, can be mapped to an integer and used as the type of an LV2 Atom or Event.

This specification also defines a complete vocabulary for the MIDI standard, except for standard controller numbers. These descriptions are detailed enough to express any MIDI message as properties.

## Index

Classes | Properties
--- | ---
Chunk HexByte MidiEvent SystemMessage SystemCommon QuarterFrame SongPosition SongSelect TuneRequest SystemExclusive SystemRealtime ActiveSense Clock Continue Reset Start Stop VoiceMessage Aftertouch Bender ChannelPressure Controller NoteOff NoteOn ProgramChange | benderValue binding byteNumber channel chunk controllerNumber controllerValue noteNumber pressure programNumber property songNumber songPosition status statusMask velocity

## Classes

### ActiveSense

Class

Label | Active Sense
Subclass of | SystemRealtime
status | fe

MIDI active sense message.

### Aftertouch

Class

Label | Aftertouch
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | noteNumber
chunk |
byteNumber | 1
property | pressure
statusMask | a0

MIDI aftertouch message.

### Bender

Class

Label | Bender
Subclass of | VoiceMessage
chunk |
byteNumber | 0
byteNumber | 1
property | benderValue
statusMask | e0

MIDI bender message.

### ChannelPressure

Class

Label | Channel Pressure
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | pressure
statusMask | d0

MIDI channel pressure message.

### Chunk

Class

Label | Chunk
In domain of | byteNumber
| property
In range of | chunk

A sequence of contiguous bytes in a MIDI message.

### Clock

Class

Label | Clock
Subclass of | SystemRealtime
status | f8

MIDI clock message.

### Continue

Class

Label | Continue
Subclass of | SystemRealtime
status | fb

MIDI continue message.

### Controller

Class

Label | Controller
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | controllerNumber
chunk |
byteNumber | 1
property | controllerValue
statusMask | b0

MIDI controller change message.

### HexByte

Class

Label | Hex Byte
In range of | status
| statusMask
| velocity
owl:onDatatype | xsd:hexBinary

A hexadecimal byte, which has a value <= FF.

### MidiEvent

Class

Label | MIDI Message
Subclass of | atom:Atom
| ev:Event
Superclass of | SystemMessage
| VoiceMessage
In range of | binding
owl:onDatatype | xsd:hexBinary

A single raw MIDI message.

A single raw MIDI message (a sequence of bytes).

This is equivalent to a standard MIDI messages, except with the following restrictions to simplify handling:

- Running status is not allowed, every message must have its own status byte.

- Note On messages with velocity 0 are not allowed. These messages are equivalent to Note Off in standard MIDI streams, but here only proper Note Off messages are allowed.

- "Realtime messages" (status bytes 0xF8 to 0xFF) are allowed, but may not occur inside other messages like they can in standard MIDI streams.

- All messages are complete valid MIDI messages. This means, for example, that only the first byte in each event (the status byte) may have the eighth bit set, that Note On and Note Off events are always 3 bytes long, etc.

Where messages are communicated, the writer is responsible for writing valid messages, and the reader may assume that all events are valid.

If a MidiEvent is serialised to a string, the format should be xsd:hexBinary, for example:

    [] eg:someEvent "901A01"^^midi:MidiEvent .

### NoteOff

Class

Label | Note Off
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | noteNumber
chunk |
byteNumber | 1
property | velocity
statusMask | 80

MIDI note off message.

### NoteOn

Class

Label | Note On
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | noteNumber
chunk |
byteNumber | 1
property | velocity
statusMask | 90

MIDI note on message.

### ProgramChange

Class

Label | Program Change
Subclass of | VoiceMessage
chunk |
byteNumber | 0
property | programNumber
statusMask | c0

MIDI program change message.

### QuarterFrame

Class

Label | Quarter Frame
Subclass of | SystemCommon
status | f1

MIDI quarter frame message.

### Reset

Class

Label | Reset
Subclass of | SystemRealtime
status | ff

MIDI reset message.

### SongPosition

Class

Label | Song Position
Subclass of | SystemCommon
chunk |
byteNumber | 0
byteNumber | 1
property | songPosition
status | f2

MIDI song position pointer message.

### SongSelect

Class

Label | Song Select
Subclass of | SystemCommon
status | f3

MIDI song select message.

### Start

Class

Label | Start
Subclass of | SystemRealtime
status | fa

MIDI start message.

### Stop

Class

Label | Stop
Subclass of | SystemRealtime
status | fc

MIDI stop message.

### SystemCommon

Class

Label | System Common
Subclass of | SystemMessage
Superclass of | QuarterFrame
| SongPosition
| SongSelect
| TuneRequest

MIDI system common message.

### SystemExclusive

Class

Label | System Exclusive
Subclass of | SystemMessage
status | f0

MIDI system exclusive message.

### SystemMessage

Class

Label | System Message
Subclass of | MidiEvent
Superclass of | SystemCommon
| SystemExclusive
| SystemRealtime
statusMask | f0

MIDI system message.

### SystemRealtime

Class

Label | System Realtime
Subclass of | SystemMessage
Superclass of | ActiveSense
| Clock
| Continue
| Reset
| Start
| Stop

MIDI system realtime message.

### TuneRequest

Class

Label | Tune Request
Subclass of | SystemCommon
status | f6

MIDI tune request message.

### VoiceMessage

Class

Label | Voice Message
Subclass of | MidiEvent
Superclass of | Aftertouch
| Bender
| ChannelPressure
| Controller
| NoteOff
| NoteOn
| ProgramChange
statusMask | f0

MIDI voice message.

## Properties

### benderValue

Property

Label | bender value
Range | xsd:short
Type | Datatype Property

MIDI pitch bender message (-8192 to 8192).

### binding

Property

Label | binding
Range | MidiEvent
Type | Object Property

The MIDI event to bind a parameter to.

### byteNumber

Property

Label | byte number
Domain | Chunk
Range | xsd:unsignedByte
Type | Datatype Property

The 0-based index of a byte which is part of this chunk.

### channel

Property

Label | MIDI channel
Range | xsd:unsignedByte
Type | Datatype Property

The channel number of a MIDI message.

### chunk

Property

Label | MIDI chunk
Range | Chunk
Type | Object Property

A chunk of a MIDI message.

### controllerNumber

Property

Label | MIDI controller number
Range | xsd:byte
Type | Datatype Property

The numeric ID of a controller (0 to 127).

### controllerValue

Property

Label | MIDI controller value
Range | xsd:byte
Type | Datatype Property

The value of a controller (0 to 127).

### noteNumber

Property

Label | note number
Range | xsd:byte
Type | Datatype Property

The numeric ID of a note (0 to 127).

### pressure

Property

Label | key pressure
Range | xsd:byte
Type | Datatype Property

Key pressure (0 to 127).

### programNumber

Property

Label | program number
Range | xsd:byte
Type | Datatype Property

The numeric ID of a program (0 to 127).

### property

Property

Label | property
Domain | Chunk
Range | rdf:Property
Type | Object Property

The property this chunk represents.

### songNumber

Property

Label | song number
Range | xsd:byte
Type | Datatype Property

The numeric ID of a song (0 to 127).

### songPosition

Property

Label | song position
Range | xsd:short
Type | Datatype Property

Song position in MIDI beats (16th notes) (-8192 to 8192).

### status

Property

Label | status byte
Range | HexByte
Type | Datatype Property

The exact status byte for a message of this type.

### statusMask

Property

Label | status mask
Range | HexByte
Type | Datatype Property

The status byte for a message of this type on channel 1.

This is a status byte with the lower nibble set to zero.

### velocity

Property

Label | velocity
Range | HexByte
Type | Datatype Property

The velocity of a note message (0 to 127).