The MIDI Specification文档格式.docx
《The MIDI Specification文档格式.docx》由会员分享,可在线阅读,更多相关《The MIDI Specification文档格式.docx(58页珍藏版)》请在冰点文库上搜索。
![The MIDI Specification文档格式.docx](https://file1.bingdoc.com/fileroot1/2023-5/6/fdaed61a-e31c-46ae-900b-923cfea6bc7c/fdaed61a-e31c-46ae-900b-923cfea6bc7c1.gif)
wrongdirection"
asmoredevicesaredaisy-chainedtootherdevice'
sMIDITHRUjacks.Theresultisthatthereisalimittothenumberofdevicesthatcanbedaisy-chained.
Messages
TheMIDIprotocolismadeupofmessages.Amessageconsistsofastring(ie,series)of8-bitbytes.MIDIhasmanysuchdefinedmessages.Somemessagesconsistofonly1byte.Othermessageshave2bytes.Stillothershave3bytes.OnetypeofMIDImessagecanevenhaveanunlimitednumberofbytes.TheonethingthatallmessageshaveincommonisthatthefirstbyteofthemessageistheStatusbyte.Thisisaspecialbytebecauseit'
stheonlybytethathasbit#7set.Anyotherfollowingbytesinthatmessagewillnothavebit#7set.So,youcanalwaysdetectthestartaMIDImessagebecausethat'
swhenyoureceiveabytewithbit#7set.ThiswillbeaStatusbyteintherange0x80to0xFF.Theremainingbytesofthemessage(ie,thedatabytes,ifany)willbeintherange0x00to0x7F.
TheStatusbytesof0x80to0xEFareformessagesthatcanbebroadcastonanyoneofthe16MIDIchannels.Becauseofthis,thesearecalledVoicemessages.(MyownpreferenceistosaythatthesemessagesbelongintheVoiceCategory).FortheseStatusbytes,youbreakupthe8-bitbyteinto24-bitnibbles.Forexample,aStatusbyteof0x92canbebrokenupinto2nibbleswithvaluesof9(highnibble)and2(lownibble).ThehighnibbletellsyouwhattypeofMIDImessagethisis.Herearethepossiblevaluesforthehighnibble,andwhattypeofVoiceCategorymessageeachrepresents:
8=NoteOff
9=NoteOn
A=AfterTouch(ie,keypressure)
B=ControlChange
C=Program(patch)change
D=ChannelPressure
E=PitchWheel
So,forourexamplestatusof0x92,weseethatitsmessagetypeisNoteOn(ie,thehighnibbleis9).What'
sthelownibbleof2mean?
ThismeansthatthemessageisonMIDIchannel2.Thereare16possible(logical)MIDIchannels,with0beingthefirst.So,thismessageisaNoteOnonchannel2.WhatstatusbytewouldspecifyaProgramChangeonchannel0?
ThehighnibblewouldneedtobeCforaProgramChangetypeofmessage,andthelownibblewouldneedtobe0forchannel0.Thus,thestatusbytewouldbe0xC0.HowaboutaProgramChangeonchannel15(ie,thelastMIDIchannel).Again,thehighnibblewouldbeC,butthelownibblewouldbeF(ie,thehexademicaldigitfor15).Thus,thestatuswouldbe0xCF.
NOTE:
AlthoughtheMIDIStatusbytecountsthe16MIDIchannelsasnumbers0toF(ie,15),allMIDIgear(includingcomputersoftware)displaysachannelnumbertothemusicianas1to16.So,aStatusbytesentonMIDIchannel0isconsideredtobeon"
channel1"
asfarasthemusicianisconcerned.Thisdiscrepancybetweenthestatusbyte'
schannelnumber,andwhatchannelthemusician"
believes"
thataMIDImessageison,isacceptedbecausemosthumansstartcountingthingsfrom1,ratherthan0.
TheStatusbytesof0xF0to0xFFareformessagesthataren'
tonanyparticularchannel(andthereforealldaisy-chainedMIDIdevicesalwayscan"
hear"
andchoosetoactuponthesemessages.ContrastthiswiththeVoiceCategorymessages,whereaMIDIdevicecanbesettorespondtothoseMIDImessagesonlyonaspecifiedchannel).ThesestatusbytesareusedformessagesthatcarryinformationofinteresttoallMIDIdevices,suchassyncronizingallplaybackdevicestoaparticulartime.(Bycontrast,VoiceCategorymessagesdealwiththeindividualmusicalpartsthateachinstrumentmightplay,sothechannelnibbleschemeallowsadevicetorespondtoitsownMIDIchannelwhileignoringtheVoiceCategorymessagesintendedforanotherdeviceonanotherchannel).
Thesestatusbytesarefurtherdividedintotwocatagories.Statusbytesof0xF0to0xF7arecalledSystemCommonmessages.Statusbytesof0xF8to0xFFarecalledSystemRealtimemessages.Theimplicationsofsuchwillbediscussedlater.
Actually,certainStatusbyteswithinthisrangearenotdefinedbytheMIDIspectodate,andarereservedforfutureuse.Forexample,Statusbytesof0xF4,0xF5,0xF9,and0xFDarenotused.IfaMIDIdeviceeverreceivessuchaStatus,itshouldignorethatmessage.SeeIgnoringMIDIMessages.
Whatfollowsisadescriptionofeachmessagetype.Thedescriptiontellswhatthemessagedoes,whatitsstatusbyteis,andwhetherithasanysubsequentdatabytesandwhatinformationthosecarry.Generally,thesedescriptionstaketheviewofadevicereceivingsuchmessages(ie,whatthedevicewouldtypicallybeexpectedtodowhenreceivingparticularmessages).Whenapplicable,remarksaboutadevicethattransmitssuchmessagesmaybemade.
NoteOff
Category:
Voice
Purpose
Indicatesthataparticularnoteshouldbereleased.Essentially,thismeansthatthenotestopssounding,butsomepatchesmighthavealongVCAreleasetimethatneedstoslowlyfadethesoundout.Additionally,thedevice'
sHoldPedalcontrollermaybeon,inwhichcasethenote'
sreleaseispostponeduntiltheHoldPedalisreleased.Inanyevent,thismessageeithercausestheVCAtomoveintothereleasestage,oriftheHoldPedalison,indicatesthatthenoteshouldbereleased(bythedeviceautomatically)whentheHoldPedalisturnedoff.IfthedeviceisaMultiTimbralunit,theneachoneofitsPartsmayrespondtoNoteOffsonitsownchannel.ThePartthatrespondstoaparticularNoteOffmessageistheoneassignedtothemessage'
sMIDIchannel.
Status
0x80to0x8FwherethelownibbleistheMIDIchannel.
Data
TwodatabytesfollowtheStatus.
Thefirstdataisthenotenumber.Thereare128possiblenotesonaMIDIdevice,numbered0to127(whereMiddleCisnotenumber60).Thisindicateswhichnoteshouldbereleased.
Theseconddatabyteisthevelocity,avaluefrom0to127.Thisindicateshowquicklythenoteshouldbereleased(where127isthefastest).It'
suptoaMIDIdevicehowitusesvelocityinformation.OftenvelocitywillbeusedtotailortheVCAreleasetime.MIDIdevicesthatcangenerateNoteOffmessages,butdon'
timplementvelocityfeatures,willtransmitNoteOffmessageswithapresetvelocityof64.
Errata
AnAllNotesOffcontrollermessagecanbeusedtoturnoffallnotesforwhichadevicereceivedNoteOnmessages(withouthavingreceivedrespectiveNoteOffmessages).
NoteOn
Indicatesthataparticularnoteshouldbeplayed.Essentially,thismeansthatthenotestartssounding,butsomepatchesmighthavealongVCAattacktimethatneedstoslowlyfadethesoundin.Inanycase,thismessageindicatesthataparticularnoteshouldstartplaying(unlessthevelocityis0,inwhichcase,youreallyhaveaNoteOff).IfthedeviceisaMultiTimbralunit,theneachoneofitsPartsmaysoundNoteOnsonitsownchannel.ThePartthatsoundsaparticularNoteOnmessageistheoneassignedtothemessage'
sMIDIchannel.
0x90to0x9FwherethelownibbleistheMIDIchannel.
Thefirstdataisthenotenumber.Thereare128possiblenotesonaMIDIdevice,numbered0to127(whereMiddleCisnotenumber60).Thisindicateswhichnoteshouldbeplayed.
Theseconddatabyteisthevelocity,avaluefrom0to127.Thisindicateswithhowmuchforcethenoteshouldbeplayed(where127isthemostforce).It'
suptoaMIDIdevicehowitusesvelocityinformation.OftenvelocityisbeusedtotailortheVCAattacktimeand/orattacklevel(andthereforetheoverallvolumeofthenote).MIDIdevicesthatcangenerateNoteOnmessages,butdon'
timplementvelocityfeatures,willtransmitNoteOnmessageswithapresetvelocityof64.
ANoteOnmessagethathasavelocityof0isconsideredtoactuallybeaNoteOffmessage,andtherespectivenoteisthereforereleased.SeetheNoteOffentryforadescriptionofsuch.This"
trick"
wascreatedinordertotakeadvantageofrunningstatus.
AdevicethatrecognizesMIDINoteOnmessagesmustbeabletorecognizebotharealNoteOffaswellasaNoteOnwith0velocity(asaNoteOff).TherearemanydevicesthatgeneraterealNoteOffs,andmanyotherdevicesthatuseNoteOnwith0velocityasasubstitute.
Intheory,everyNoteOnshouldeventuallybefollowedbyarespectiveNoteOffmessage(ie,whenit'
stimetostopthenote