簡述
簡單來說,MIDI是一項通訊協定,將原始的串列資料轉換為具有標準的音樂資料。
就像電子琴可發出不同聲音,但並不是利用基本的鋼琴發聲原理,而是使用按鈕(琴鍵)傳輸電子信號到晶片並判別琴鍵的位置對應鋼琴是甚麼音調,在透過電子喇叭輸出。
當你將電子琴接到電腦上作輸入,電子琴並不是把聲音傳入電腦,而是使用MIDI這個通訊協定將音高傳入電腦中,輸出的音色可由軟體自行調整。
像是音高就可以使用數位的方式傳輸,因為音高可以被量化成為頻率,而在MIDI中有0~127總共128種音高。每個數字都特定的音高,像是60就是代表C4。
MIDI Messages(MIDI信息)
MIDI Messages是受MIDI所規範的資料封包,在開發MIDI樂器時必須遵守MIDI所是制定的傳輸規則。
MIDI Messages是一個封包,最多由3 bytes組成,每一個byte都有相對應的功能。
- Status Byte
- Data Byte 1
- Data Byte 2
排列方式為:
| Status Byte | Data Byte 1 | Data Byte 2 |
Status Byte:MIDI Messages有非常多種,必須透過Status Byte讓裝置知道要做甚麼事情。
Data Byte 1:用途必須先看Status Byte是什麼類型。
Data Byte 2:用途必須先看Status Byte是什麼類型。
Channel Voice Messages
Channel:當連接上多個MIDI裝置時,每個樂器必須要有各自的Channel做區分。
Channel Voice Messages 總共有16個Channels,從1~16。
Channel Voice Messages 總共有16個Channels,從1~16。
Note on及Note off可比喻為按下琴鍵和放開琴鍵。
Key number意思就是鋼琴的音高(可比照前圖),數字範圍為0~127。
velocity即鋼琴按下按鍵後發出聲音的強度,數字越大琴聲越強,數字範圍為0~127。
封包範例(通道1;Note On;音高64;強度127)
封包範例(通道1;Note On;音高64;強度127)
| 145 | 64 | 127 |
封包範例(通道0;Note Off;音高64;強度64)
| 128 | 64 | 64 |
Control Change:
Control Change | CC
像是音訊效果器的旋鈕或是鋼琴下的踏板,資料會因為你轉的位置或是往下踩的深度做改變。
Controller number就是單指那個旋鈕的編號,有分種類,數字範圍為0~127。Controller value即是代表位置、深度資料,數字範圍為0~127。
封包範例(通道1;Control Change;4 Foot Controller;值127)
| 177 | 4 | 127 |
封包範例(通道0;Control Change;0 Undefined;值64)
| 176 | 0 | 64 |
Voice Message定義
Voice Message
|
Status Byte(十六進制)
|
Data Byte 1
|
Data Byte 2
|
| Note off | 8x | Key number | Note Off velocity |
| Note on | 9x | Key number | Note on velocity |
| Polyphonic Key Pressure | Ax | Key number | Amount of pressure |
| Control Change | Bx | Controller number | Controller value |
| Program Change | Cx | Program number | None |
| Channel Pressure | Dx | Pressure value | None |
| Pitch Bend | Ex | MSB | LSB |
MIDI Messages總表
| Command Name | Status Byte | Data Byte 1 | Data Byte 2 |
|---|---|---|---|
| Note Off | 128 + Channel | 0-127 Pitch | 0-127 Velocity |
| Note On | 144 + Channel | 0-127 Pitch | 0-127 Velocity |
| Poly Pressure | 160 + Channel | 0-127 Pitch | 0-127 Pressure |
| Control Change | 176 + Channel | 0 Undefined | 0-127 MSB |
| Control Change | 176 + Channel | 1 Modulation Wheel | 0-127 MSB |
| Control Change | 176 + Channel | 2 Breath Controller | 0-127 MSB |
| Control Change | 176 + Channel | 3 After Touch | 0-127 MSB |
| Control Change | 176 + Channel | 4 Foot Controller | 0-127 MSB |
| Control Change | 176 + Channel | 5 Portamento Time | 0-127 MSB |
| Control Change | 176 + Channel | 6 Data Entry | 0-127 MSB |
| Control Change | 176 + Channel | 7 Main Volume | 0-127 MSB |
| Control Change | 176 + Channel | 8-31 Undefined | 0-127 MSB |
| Control Change | 176 + Channel | 32-63 LSB of 0-31 | 0-127 MSB |
| Control Change | 176 + Channel | 64 Damper Pedal | 0:off 127:on |
| Control Change | 176 + Channel | 65 Portamento | 0:off 127:on |
| Control Change | 176 + Channel | 66 Sostenuto | 0:off 127:on |
| Control Change | 176 + Channel | 67 Soft Pedal | 0:off 127:on |
| Control Change | 176 + Channel | 68-92 Undefined | 0:off 127:on |
| Control Change | 176 + Channel | 93 Chorus | 0:off 127:on |
| Control Change | 176 + Channel | 94 Celeste | 0:off 127:on |
| Control Change | 176 + Channel | 95 Phaser | 0:off 127:on |
| Control Change | 176 + Channel | 96 Data Entry + 1 | 0:off 127:on |
| Control Change | 176 + Channel | 97 Data Entry - 1 | 0:off 127:on |
| Control Change | 176 + Channel | 98-121 Undefined | 0:off 127:on |
| Control Change | 176 + Channel | 122 Local Control | 0-127 |
| Control Change | 176 + Channel | 123 All Notes Off | 0 |
| Control Change | 176 + Channel | 124 Omni Mode off | 0-15 |
| Control Change | 176 + Channel | 125 Omni Mode on | 0 |
| Control Change | 176 + Channel | 126 Mono on/Poly off | 0 |
| Control Change | 176 + Channel | 127 Poly on/Mono off | 0 |
| Program Change | 192 + Channel | 0-127 Program | Not used |
| Channel Pressure | 208 + Channel | 0-127 Pressure | Not used |
| Pitch Wheel | 224 + Channel | 0-127 LSB | 0-127 MSB |
| System Exclusive | 240 | 0-127 Id Code | Any number of bytes |
| Undefined | 241 | Not used | Not used |
| Song Position | 242 | 0-127 LSB | 0-127 MSB |
| Song Select | 243 | 0-127 Song | Not used |
| Undefined | 244 | Not used | Not used |
| Undefined | 245 | Not used | Not used |
| Tune Request | 246 | Not used | Not used |
| End of Exclusive | 247 | Not used | Not used |
| Timing Clock | 248 | Not used | Not used |
| Undefined | 249 | Not used | Not used |
| Start | 250 | Not used | Not used |
| Continue | 251 | Not used | Not used |
| Stop | 252 | Not used | Not used |
| Undefined | 253 | Not used | Not used |
| Active Sensing | 254 | Not used | Not used |
| System Reset | 255 | Not used | Not used |
沒有留言:
張貼留言