$$ \definecolor{rr}{rgb}{0.95,0.1,0} \definecolor{bb}{rgb}{0,0.4,1} \definecolor{gg}{rgb}{0,0.6,0} \definecolor{yy}{rgb}{0.8,0.5,0} \definecolor{pp}{rgb}{0.9,0,0.5} $$
내성적 물망초
: 내 성적 물리 때문에 망하기 10초 전

표준 미디 파일 1.0 / 헤더 청크

~카테고리:
나머지/midiSpec

청크 상세설명

헤더 청크 (header chunk)

파일 시작 부분의 헤더청크는 파일의 데이터에 관한 기본적 정보를 서술한다. 다음은 완전한 청크의 구조이다.

[헤더청크] = [청크유형] [길이] [형식] [트랙청크수] [분할값]
[청크유형]

앞서 말했듯 [청크유형]은 'MThd'라는 아스키 네 글자이다.

[길이]

[길이]는 32비트로 표현된 숫자 6이다 (높은 바이트 먼저).

데이터 섹션에는 상위 바이트 순으로 저장된 16비트짜리 단어 세 개가 들어있다.

[형식]

[형식]은 파일 전반의 구조를 결정한다. [형식]에는 세 값만이 정의돼있다.

0다중채널 트랙 한 개가 있는 파일.
1동시적 트랙(이나 미디출력) 한 개 이상의 시퀀스가 있는 파일.
2독립적 단일트랙 패턴 한 개 이상이 나열된 파일.
[트랙청크수]

[트랙청크수]는 파일 안의 트랙청크의 개수이다. 0형식 파일에서는 무조건 1이다.

[분할값]

[분할값]은 델타타임의 의미를 정한다. 두 가지 형식이 있는데, 하나는 `metrical time, 하나는 `time-code-based time이다.

04분음표당 틱수
1514                           0
1`negative SMPTE format프레임당 틱수
1514           8 7             0

[분할값]의 비트 15가 0일 때, 비트 14부터 0은 4분음표를 구성하는 텔타타임 "틱"의 수를 나타낸다. 예를 들어, [분할값]이 96일 때, 파일에서 두 이벤트 사이에 8분음표 만큼의 시간간격은 48이다.

`If bit 15 of [division] is a one, delta-times in a file correspond to subdivisions of a second, in a way consistent with SMPTE and MIDI time code. Bits 14 thru 8 contain one of the four values -24, -25, -29, or -30, corresponding to the four standard SMPTE and MIDI time code formats (-29 corresponds to 30 drop frame), and represents the number of frames per second. These negative numbers are stored in two's complement form. The second byte (stored positive) is the resolution within a frame: typical values may be 4 (MIDI time code resolution), 8, 10, 80 (bit resolution), or 100. This system allows exact specification of time-code-based tracks, but also allows millisecond-based tracks by specifying 25 frames/sec and a resolution of 40 units per frame. If the events in a file are stored with bit resolution of thirty-frame time code, the division word would be E250 hex.