A marker is a named position in the audio. A region is a group of markers, such as the loop points of an instrument.
Marker chunk
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | mSMPTE_TimeType | the timecode type, below; 0 means no marker has a valid time |
| 4 | 4 | u32 | mNumberMarkers | the number of markers |
| 8 | 28 each | record | mMarkers | the markers |
Marker
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | FourCC | mType | the marker’s type, below |
| 4 | 8 | f64 | mFramePosition | the frame number, starting from 0 |
| 12 | 4 | u32 | mMarkerID | the ID of its name in the strings chunk |
| 16 | 8 | record | mSMPTETime | the timecode, below; all 0xFF means invalid |
| 24 | 4 | u32 | mChannel | the channel, counting from 1, or 0 for all |
| Offset | Size | Type | Name |
|---|---|---|---|
| 0 | 1 | s8 | mHours |
| 1 | 1 | s8 | mMinutes |
| 2 | 1 | s8 | mSeconds |
| 3 | 1 | s8 | mFrames |
| 4 | 4 | u32 | mSubFrameSampleOffset |
Marker types
What each type means (Apple’s specification): pbeg and pend
delineate the start and end of a CD or other playlist (a program); tbeg
and tend the start and end of a track on a CD; indx is a
Red Book index; rbeg and rend start and end a region (see the
region chunk); rsyc is a region synchronisation point, used to align a
point in or outside the region with an event such as a beat; sbeg and
send are the start and end of the selection a user made on a displayed
waveform; cbeg and cend start and end the source of a copy
or move, dbeg and dend its destination; slbg
and slen are the start and end of a sustain loop, rlbg and
rlen the start and end of a release loop (the specification words both release
markers as “for a sustain loop”). A generic marker (0) has no meaning of
its own.
| Value | Constant (after kCAFMarkerType_) |
|---|---|
| 0 | Generic |
pbeg | ProgramStart |
pend | ProgramEnd |
tbeg | TrackStart |
tend | TrackEnd |
indx | Index |
rbeg | RegionStart |
rend | RegionEnd |
rsyc | RegionSyncPoint |
sbeg | SelectionStart |
send | SelectionEnd |
cbeg | EditSourceBegin |
cend | EditSourceEnd |
dbeg | EditDestinationBegin |
dend | EditDestinationEnd |
slbg | SustainLoopStart |
slen | SustainLoopEnd |
rlbg | ReleaseLoopStart |
rlen | ReleaseLoopEnd |
sply | SavedPlayPosition |
tmpo | Tempo |
tsig | TimeSignature |
ksig | KeySignature |
The last four types are not in the specification: they are in the SDK’s CAFFile.h
(kCAFMarkerType_SavedPlayPosition, _Tempo, _TimeSignature and
_KeySignature), which gives only the constants and no description of what they mark. Their names say what they are meant for (a saved play position, a tempo, a time signature and a key signature, each placed at mFramePosition). Apple’s own code does not give them more: the CAF code of AudioToolbox (extracted from the dyld shared cache and disassembled) builds none of the four codes, and its only use of tmpo is the iTunes MP4 atom of that name. Where the marker’s value is kept, if anywhere, is not defined by any source found; the viewer shows them by name.
SMPTE timecode types
| Value | Constant (after kCAF_SMPTE_TimeType) | Frames per second |
|---|---|---|
| 0 | None | no timecode |
| 1 | 24 | 24 |
| 2 | 25 | 25 |
| 3 | 30Drop | 30, drop frame |
| 4 | 30 | 30 |
| 5 | 2997 | 29.97 |
| 6 | 2997Drop | 29.97, drop frame |
| 7 | 60 | 60 |
| 8 | 5994 | 59.94 |
| 9 | 60Drop | 60, drop frame |
| 10 | 5994Drop | 59.94, drop frame |
| 11 | 50 | 50 |
| 12 | 2398 | 23.98 |
Types 0 to 8 are the specification’s; types 9 to 12 are in the SDK’s CAFFile.h only. Their names agree with CoreAudioBaseTypes.h, whose SMPTETimeType enumeration lists the same rates in the same order without the leading “none” (so its 60 drop frame, 59.94 drop frame, 50 frame and 23.98 frame are 8, 9, 10 and 11 there and 9, 10, 11 and 12 here), describing them as “Constants that describe the type of SMPTE time”.
Region chunk
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | mSMPTE_TimeType | as for markers |
| 4 | 4 | u32 | mNumberRegions | the number of regions |
| 8 | varies | record | mRegions | the regions |
A region:
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | mRegionID | a unique ID; 0 is best avoided |
| 4 | 4 | u32 | mFlags | flags, below |
| 8 | 4 | u32 | mNumberMarkers | the number of markers |
| 12 | 28 each | record | mMarkers | the region’s markers, as above |
| Flag | Constant | Meaning |
|---|---|---|
| 1 | kCAFRegionFlag_LoopEnable | the region loops; at least one play direction must be set |
| 2 | kCAFRegionFlag_PlayForward | plays forward |
| 4 | kCAFRegionFlag_PlayBackward | plays backward |
With both direction flags set, the region plays forward and backward in turn.
A region description may hold more than two markers: the first two delineate the
span of frames, and what the others mean is up to the application. A file may have
markers with no regions, regions with no marker chunk, or both; the two chunks each
have a timecode type, and when both are present the specification says they are
typically the same. When the type is 0 (none), every marker’s timestamp must be
invalid (all bytes 0xFF); when it is not 0, a marker may still have an
invalid timestamp. The explorer marks a type that differs between the two chunks and
a valid timestamp under type 0.
Example
A marker chunk with one program-start marker at frame 1,000, named by string 1, with no timecode, for all channels (44 bytes with the chunk header):
| Bytes | Meaning |
|---|---|
6D 61 72 6B | mark |
00 00 00 00 00 00 00 24 | the data is 36 bytes |
00 00 00 00 | mSMPTE_TimeType 0: no timecode |
00 00 00 01 | 1 marker |
70 62 65 67 | mType pbeg: program start |
40 8F 40 00 00 00 00 00 | mFramePosition 1000.0 |
00 00 00 01 | mMarkerID 1 |
FF FF FF FF FF FF FF FF | mSMPTETime all FF: invalid |
00 00 00 00 | mChannel 0: all channels |
The explorer marks a marker or region after the end of the audio, a marker ID that the strings chunk lacks, a region or marker ID used twice, an instrument chunk that names a region the region chunk lacks, and a looping region with no direction.
Source: Apple, Core Audio Format Specification 1.0, sections Marker Chunk, Region Chunk and Instrument Chunk (CAFMarker, CAF_SMPTE_Time, kCAFMarkerType_*, kCAF_SMPTE_TimeType*, kCAFRegionFlag_*, Tables 2-16 to 2-18).