/ Reference / MIDI CC

abc2midi guide .. abc cheatsheet
Fiddle Runtime .. Fiddle Resources
Extending Fiddle .. Installing Fiddle
General MIDI .. MIDI CC .. MIDI notes
Box2D API .. Tidal Cheatsheet
Banklist File .. Sample TOC File
Audio Troubleshooting


Contents: MIDI 1.0 | MIDI Polyphonic Expression

MIDI 1.0

TL;DR


Status codes

codes (hex) event Data1 Data2
128-143 (8X) Note off (ch1-16) notenum velocity
144-159 (9X) Note on (ch1-16) notenum velocity
160-175 (AX) Polyphonic Aftertouch notenum pressure
176-191 (BX) Control Change see below
192-207 (CX) Program Change prognum (nada)
208-223 (DX) Channel Aftertouch pressure (nada)
224-239 (EX) Pitch Wheel lsb msb
240 (F0) sysex vendorid more databytes 'til EOX
241 (F1) system common (undef)
242 (F2) song position
243 (F3) song select song num
244 (F4) system common (undef)
245 (F5)
246 (F6) tune request
247 (F7) EOX (end of sysex)
248 (F8) sys realtime timing clock
249 (F9) sys realtime (undefined)
250 (FA) sys realtime start
251 (FB) sys realtime continue
252 (FC) sys realtime stop
253 (FD) sys realtime (undefined)
254 (FE) sys realtime active sensing
255 (FF) meta msgs see below

ControlChange (CC)

Status bytes 176-191 means channel 1-16.

Example

Sequence Interpretation
176 0 5 Channel 1, Bank Select, Value 5 (MSB)
176 32 5 Channel 1, Bank Select, Value 5 (LSB)

MIDI 1 CC Spec

Here is code from midiDevice that converts MidiMsg to CC names and values:

// current we skipp the LSB fields
if(this.cc.id < 32 || this.cc.id > 63)
{
    this.midiMsg.data3 / 127.0 => cc.value;
    "CC"+id => this.cc.name;
}

And here is a table based on original MIDI spec names.

Name Data1 Data2
Bank Select 0 MSB
Modulation Wheel 1 MSB
Breath Control 2 MSB
Continuous Controller 3 MSB
Foot Controller 4 MSB
Portamento Time 5 MSB
Data Entry 6 MSB
Main Volume 7 MSB
Continuous Controller 8-31 8-31 MSB
Pan Position 10 MSB
Expression 11 MSB
Bank Select (LSB) 32 LSB
Modulation Wheel (LSB) 33 LSB
Breath Control (LSB) 34 LSB
Continuous Controller (LSB) 35 LSB
Foot Controller (LSB) 36 LSB
Portamento Time (LSB) 37 LSB
Data Entry (LSB) 38 LSB
Main Volume (LSB) 39 LSB
Continuous Controller 8-31 40-63 LSB
Damper Pedal (on/off) 64 0/1
Portamento (on/off) 65 0/1
Sostenuto (on/off) 66 0/1
SoftPedalOnOff 67 0/1
LegatoFootSwOnOff 68 0/1
Hold2OnOff 69 0/1
Sound Controllers #1 to #10
SoundVariation 70 MSB
FilterCutoff 71 MSB
ReleaseTime 72 MSB
AttackTime 73 MSB
FilterResonance 74 MSB
DecayTime 75 MSB
VibratoRate 76 MSB
VibratoDepth 77 MSB
VibratoDelay 78 MSB
SoundCtrler10 79 MSB
General Purpose Controllers 5 to 8
GPC5 80 MSB
GPC6 81 MSB
GPC7 82 MSB
GPC8 83 MSB
PortaControl 84 MSB
Effect Controllers
Eff1Depth 91 MSB
Eff2Depth 92 MSB
Eff3Depth 93 MSB
Eff4Depth 94 MSB
Eff5Depth 95 MSB
DataIncrement 96 MSB
DataDecrement 97 MSB
NRPNSelectLSB 98 MSB
NRPNSelectMSB 99 MSB
RPNSelectLSB 100 MSB
RPNSelectMSB 101 MSB
Other Channel Mode Messages
AllSoundsOff 120 MSB
ResetAllCtrlers 121 MSB
LocalCtrlOnOff 122 MSB
AllNotesOff 123 MSB
OmniModeOff 124 MSB
OmniModeOn 125 MSB
PolyModeOnOff 126 MSB
PolyModeOn 127 MSB
Extra
kAfterTouch 128 MSB
kPitchBend 129 MSB

Pitch Wheel Value Interpretation

PitchBend (mod-wheel CC 176/1) are usually 7 bit precision (0 to 127) while PitchWheel (not a CC, but a first-class status message) are always 14 bits (0 to 16383). Depending on the MIDI devices, this value range may correspond to bending of +/- 1 or 2 tones, but this range can be customized.

Combine lsb and msb to produce a 14-bit value.

The center value (no pitch change) is 0x2000 (8192).

It is up to the device to translate this to a specific pitch. For example, 8192 represents no change in pitch and 0 decimal is two semitones lower and if the pitch is computed exponentially, then -812 will represent a drop in the pitch of a little less than 20 cents.

Aftertouch (pressure)

160-175: xA0-xAF is polyphonic aftertouch. It applies to individual notes in the channel. data1 is the note-number and data2 is the pressure (0-127).

208-223, xD0-xDF is channel aftertouch. It applies to all notes in the channel. Pressure value is found in data1 and its range is therefore 0-127.

Example: note and control sequence Akai MPK mini

Sequence Notes
144 60 72 note on 60 velocity 72
128 60 0 note off 60 velocity 0
144 60 87
128 60 0
176 1 4 begin joystick N/S (cc chan1 (176), mod-wheel (cc1), val 4)
176 1 5
176 1 6
176 1 7
176 1 10
176 1 11
176 1 12
176 1 16
176 1 17
176 1 18
224 113 62 begin joystick E/W - Pitch Wheel, Ch1 lsb:113, msb: 62
224 85 62
224 33 62
224 73 60
224 21 60
224 93 59
224 41 59
176 1 81 begin cc knobs 1 then 2 (1 is same as joystick n/s)
176 1 82
176 1 83
176 2 69
176 2 70
176 2 71
176 2 72
176 2 73

meta

In the context of Fiddle, meta-messages can occur when "performing" an abc file.

Message Meta type Data length Contains Occurs at
Sequence number 0x00 2 bytes The number of a sequence At delta time 0
Text 0x01 variable Some text Anywhere
Copyright notice 0x02 variable A copyright notice At delta time 0 in the first track
Track name 0x03 variable A track name At delta time 0
Instrument name 0x04 variable The name of an instrument in the current track Anywhere
Lyrics 0x05 variable Lyrics, usually a syllable per quarter note Anywhere
Marker 0x06 variable The text of a marker Anywhere
Cue point 0x07 variable The text of a cue, usually to prompt for some action from the user Anywhere
Channel prefix 0x20 1 byte A channel number (following meta events will apply to this channel) Anywhere
End of track 0x2F 0 (nothing) At the end of each track
Set tempo 0x51 3 The number of microseconds per beat Anywhere, but usually in the first track
SMPTE offset 0x54 5 SMPTE time to denote playback offset from the beginning Anywhere
Time signature 0x58 4 Time signature, metronome clicks, and size of a beat in 32nd notes Anywhere
Key signature 0x59 2 A key signature: (nsharps, ismajor) Anywhere
Sequencer specific 0x7F variable Something specific to the MIDI device manufacturer Anywhere

MIDI Polyphonic Expression (MPE)

what is mpe?

When a device is transmitting MIDI according to MPE, it will use a range of channels:

One channel (usually Channel 1) is used for global messages – data such as preset changes and pedal positions are transmitted on this channel to apply to all notes equally. The global channel is set by the "MPE Zone." When the MPE Zone is the Lower Zone, Channel 1 is used for global messages. When the MPE Zone is Upper Zone is, Channel 16 is used for global messages.

The remaining channels (usually Channels 2–16) are used to transmit notes and expressive data – including note-on velocity, pitch bend, channel pressure (aftertouch), CC74 (brightness), and note-off (release) velocity – on a note-per-channel basis. The expressive data will only apply to the note which is on the same channel.

Tidbits from the MPE Spec

This specification is designed for MIDI controllers that allow the performer to vary the pitch and timbre of individual notes while playing polyphonically.

MIDI Pitch Bend and Control Change messages are Channel Messages, meaning they affect all notes assigned to that Channel. To apply Channel Messages to individual notes, an MPE controller assigns each note its own Channel.

Pitch Bend is, by default, set to a range of ±48 semitones for per-note bend and ±2 semitones for Master bend. Either range may be changed to a number of semitones between 0 and ±96 using RPN 0.

Simple circular assignment of new notes to Member Channels of a Zone will not usually provide satisfactory results. In the simplest workable implementation, a new note will be assigned to the Channel with the lowest count of active notes. Then, all else being equal, the Channel with the oldest last Note Off would be preferred. This set of rules has at least one working real-world implementation.

MPE controllers should preferentially re-use a Channel that has been most recently deployed to play a certain Note Number once the previous note has entered its Note Off state. This avoids stacking and chorusing identical notes, which sounds bad in monotimbral applications, and affects synthesizers that are not designed specifically for MPE

MPE Example: Roli Lightpad Block

Quick touch of top-left 'note'

Sequence Notes
224 0 64 Pitch Wheel Channel 1 (no bend)
176 74 63 CC Channel 1, SoundController 5 (brightness)
208 14 204 Channel 1 Aftertouch (but has two data bytes)
144 48 83 Note on 48, 83 velocity
208 25 204 Channel 1 Afterouch
208 32 204 Channel 1 Afterouch
208 0 204 Channel 1 Afterouch
128 48 46 Note off 48, 45 velocity

Quick touch/dragdown of top-left 'note'

Sequence Notes
224 0 64 ch1bend Pitch Wheel (no bend)
176 74 63 ch1cc, brightness
208 4 204 ch1 pressure
144 48 10 ch1 Note on 48
208 67 204 ch1 pressure
224 28 64 ch1 bend
208 124 204 ch1 pressure
176 74 61 ch1 brightness
224 32 64 ch1 bend
208 127 204 ch1 pressure
176 74 60 ch1 brightness
224 30 64 ch1 bend (224)
176 74 61 ch1 brightness
224 35 64 ch1 bend
224 41 64 ch1 bend
176 74 60 brightness
224 37 64 ch1 bend
224 35 64 ch1 bend
224 38 64 ch1 bend
176 74 59 brightness
224 39 64 ch1 bend
176 74 58 brightness
224 44 64 ch1 bend
208 107 204 ch1 pressure
176 74 54 brightness (74)
224 56 64 ch1 bend
208 127 204 ch1 pressure
176 74 50 ch1 brightness
224 50 64 ch1 bend
128 48 127 ch1 note off 48

Quick touch/dragdown of two top-left 'notes'

Sequence Notes
224 0 64 ch1 bend (224) zero
176 74 63 ch1 cc brightness (176,74)
208 0 204 ch1 pressure (208) (two bytes of data?)
144 48 63 ch1 note-on 144,48
225 0 64 ch2 bend (225) zero
177 74 63 ch2 cc brightness (177,63)
209 0 204 ch2 pressure (209)
145 49 18 ch2 note-on 49
208 26 204 ch1 pressure
176 74 57 ch1 brightness
209 11 204 ch2 pressure
208 106 204 ch1 pressure
209 127 204 ch2 pressure
177 74 67 ch2 brightness
225 14 64 ch2 bend
208 94 204 ch1 pressure
209 111 204 ch2 pressure
177 74 66 ch2 brightness
225 18 64 ch2 bend
208 127 204 ch1 pressure
209 127 204 ch2 pressure
177 74 68 ch2 brightness
225 19 64 ch2 bend
176 74 58 ch1 brightness
177 74 69 ch2 brighness
225 17 64 ch2 bend
177 74 68 ch2 brighness
225 19 64 ch2 bend
176 74 57 ch1 brightness
225 17 64 ch2 bend
177 74 67 ch2 brightness
208 86 204 ch1 pressure
209 22 204 ch2 pressure
177 74 65 ch2 brightness
225 4 64 ch2 bend
129 49 127 ch2 note off 49
128 48 127 ch1 note off 48
home .. topics .. interface .. reference .. examples .. tipjar