MIDI interface and MIDI time code (MTC)

Source: Internet
Author: User
Hardware interface for MIDI
MIDI protocol is a special serial communication protocol, is specially designed for digital music transmission, so it has its own characteristics: Each line allows the connection of 16 MIDI devices, each device has its own channel number, the data flow is one-way, do not answer,      Playing equipment just issue the MIDI command without detecting whether the receiving device is accurately received, due to the characteristics of the music itself, the receiving device is judged to receive the correct signal to respond, and the wrong signal will be ignored-music playing, allow to lose the note, but not to confuse the rhythm. The MIDI protocol specifies that the MIDI signal is transmitted in a serial asynchronous signal with a baud rate of 31.25K, and each byte of data consists of 10 bits, a starting bit, 8 bits of data, a stop bit, and no parity bit.      Each note of the open (or off) command has 3 bytes, calculated, less than 1mS can transmit a note of the Switch command, a MIDI command is generally 1-3 bytes, continuous transmission. In the MIDI protocol, commands such as press/release, Force, post-contact pressure, various MIDI controllers, and some system information are specified. In fact, there are a number of different MIDI protocols, after the General MIDI Protocol (GM) was developed in 1991, after a practice test, and did not solve all the problems, so Roland and Yamaha two companies developed their own agreement called GS and XG, to try to better solve the problem, However, the two protocols are not fully compatible.     The incompatible parts of these protocols, primarily for more advanced MIDI applications, are compatible with general keyboard and control commands. Unlike the RS232 port, the difference between the MIDI signal and the current is different logic, the output of the MIDI device is connected to the input of another receiving device, and in this circuit, the 5mA current represents the logic "0", the 0mA represents the logic "1", and the standard MIDI device uses the optical isolation connection       , there is no handshake signal between the devices. In accordance with the MIDI protocol, the MIDI signal input and output are 5-pin DIN plug, the output of each device to another device input, in the system of multiple devices access, each intermediary device is responsible for forwarding the MIDI signal to its input port.
Midi time Code (MTC) is a sub-protocol in MIDI. The time information for SMPTE is included in the MTC protocol data. The MTC protocol consists of several MIDI message, and there are several other sysex message.
The most important messages in the MTC protocol are called Quarter Frame (not including SysEx message). Its status code is 0XF1, and then 1 bytes is the data byte. The Quarter frame is sent based on the running SMPTE and is sent at 1/4 of SMPTE, or 1 SMPTE frames, and 4 Quarter frames are sent. A complete MTC timeframe requires 8 quarter frames, that is, the MTC timeframe is updated at only 1/2 of SMPTE, so for 30fps SMPTE, the corresponding MTC timeframe is only 15fps.
The composition format of quarter frame in MTC (2 bytes): Status Byte (fixed to 0XF1) + Data byte  for the two-level representation of date Byte in quarter frame as: nnnn dddd, corresponding to the following table: nnnn            dddd 0000             Frames current low 4bit (bit 0-BIT3) 0001             Current frames 4bit (bit4-bit7) 0010           &N BSP, current seconds Low 4bit (bit0-bit3) 0011             Current seconds 4bit (BIT4-BIT7) 0100   & nbsp         Current minutes low 4bit (BIT0-BIT3) 0101             Current minutes High 4bit (BIT4-BIT7) 0110             Current hours low 4bit (BIT0-BIT3) 0111     &NBS P       Current hours 5bit (BIT4) + current SMPTE type when nnnn=0111, redefine the two-level format of date byte as: nnnn Xyyd x--is unused bit and is set to 0 yy-- Types of SMPTE currently in use:             00--24fps             01--25fps &NB Sp           10--30fps (Drop Frame)             11--30fps d--Current hours 5bit (BIT4) For example: continuous incoming traffic is 0xF1 0x01    0x F1 0x12    0xf1 0x23    0xf1 0x34    0xf1 0x45    0xf1 0x56    0xf1 0x67    0xf1 0x77 indicates that the current synchronization time is: frames:0x21;    Seconds:0x43;    Minutes:0x65;     hours:0x17;    smpte Type:30fps
Self-understanding: When the above data stream is received and parsed, the current timeframe corresponding to the SMPTE should have reached 0x23. (because 1 full MTC time information takes time to correspond to 2 frames of SMPTE information)
MTC synchronization time information flow, normal playback is sent sequentially, the corresponding NNNN is continuously sent from 0000-0111 cycles; the low bit of frames,seconds,minutes,hours is sent before the high bit. However, MTC has the function of inverted broadcast, then just as normal is the opposite, the corresponding high bit is sent before the low bit.
In MTC, the 2 data frames 0xF1 0x0n and 0xF1 0x4n are used as the cutoff points and are always sent in real-time SMPTE data. That is, 1 full MTC packets are just at the junction of 2 SMPTE data frames, the first half of the MTC packet is data from the previous SMPTE frame, and the latter part of the MTC is the current SMPTE data. When parsing, pay special attention to it.
Full frame full frame is a sysex message, and a full frame contains 1 frames of SMPTE time information. Data stream format: (hex) F0 7F cc F7 HR mn SC fr cc--sysex channel (0-127) corresponds to 126 channel devices. If 0x7f (127) means all devices on the MIDI chain need to recognize the current full Frame Message hr--current hours mn--current minutes sc--current seconds fr--Current frames
Full Frame is only used as a recognition and preparation for SMPTE, and all devices on the MIDI chain will not actually work unless the quarter Frame Message is received. Master MIDI device, before sending the full frame to the send quarter frame, there must be a pause to satisfy the slave MIDI device to have a forecast for SMPTE time.
In Fast forward and rewind, the primary MDI device should stop sending the quarter frame Message instead of the full frame counterpart.

Reference: Http://home.roadrunner.com/~jgglatt/tech/mtc.htm http://www.electronics.dit.ie/staff/tscarff/Music_ Technology/midi/mtc.htm http://www.elmvideotechnology.com/MIDI/MTC/ Mtc-users-manual-modular-midi-time-code-reader.pdf http://wenku.baidu.com/view/d9761e2eb4daa58da0114a53.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.