The chna chunk (channel allocation) ties each track of the audio to the
Audio Definition Model (ADM, ITU-R BS.2076) metadata held as XML in an
axml chunk.
The ADM says what each track is, such as a channel of a 5.1 mix or a moving object, and
the chna chunk says which track in the file is which. EBU Tech 3285
supplement 7 defines it for Broadcast Wave files; the 64-bit BW64 format uses the same
chunk.
Fields
Offsets are from the start of the chunk’s data. Numbers are little-endian.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | u16 | numTracks | the number of tracks used: the number of different trackIndex values |
| 2 | 2 | u16 | numUIDs | the number of track UIDs used |
| 4 | 40 each | record | audioID | one entry for each track UID, laid out below |
The chunk can be made larger than it needs, with unused entries at the end left as
zeros, so a writer can fill it in later without moving anything. Supplement 7 places it
before the data and axml chunks. The explorer reports a
numUIDs larger than the entries that fit.
audioID
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | u16 | trackIndex | the track in the data, counting from 1; libbw64 refuses 0, and an unused entry is zero |
| 2 | 12 | char[12] | UID | the audioTrackUID in the ADM metadata, such as ATU_00000001 |
| 14 | 14 | char[14] | trackRef | the audioTrackFormatID it refers to, such as AT_00010001_01 |
| 28 | 11 | char[11] | packRef | the audioPackFormatID, such as AP_00010002 |
| 39 | 1 | u8 | pad | a pad byte; libbw64 writes a space |
Several entries can name the same track, which is why numTracks and
numUIDs can differ. An example built for this page, with one entry:
00000000 63 68 6E 61 2C 00 00 00 01 00 01 00 01 00 41 54 chna,.........AT
00000010 55 5F 30 30 30 30 30 30 30 31 41 54 5F 30 30 30 U_00000001AT_000
00000020 31 30 30 30 31 5F 30 31 41 50 5F 30 30 30 31 30 10001_01AP_00010
00000030 30 30 32 20 002
The rules of supplement 7, and what the explorer checks
The chunk size is 4 plus 40 times the number of entries, so supplement 7’s stereo example
(two entries) has a size of 84, and its object-based example, with room for 32 entries and four
in use, 1,284. The number of entries is at least numUIDs, and
numUIDs should match the entries in use; numTracks counts each track
once however many UIDs it has. An unused entry has a trackIndex of 0 and NULs in
every other field.
| Field | Form |
|---|---|
UID | ATU_xxxxxxxx, x a hexadecimal digit |
trackRef | AT_xxxxxxxx_xx, an audioTrackFormatID; or AC_xxxxxxxx_00, an audioChannelFormatID, when the track and stream formats of linear PCM are left out of the ADM (the 00 only pads the string; ITU-R BS.2088-2, section 8.2) |
packRef | AP_xxxxxxxx; all NULs when the audioStreamFormat refers to a channel format rather than a pack |
In an ID such as AP_00010002 the first four digits give the type (0001
DirectSpeakers, 0002 Matrix, 0003 Objects, 0004 HOA, 0005 Binaural) and the last four the
number. A number up to 0x0FFF is a common definition from ITU-R BS.2094, which
the axml chunk does not have to repeat; 0x1000 and above are custom
definitions that the axml chunk must contain.
The explorer reports a numUIDs or numTracks that does not match the
entries, an ID that does not have the form above, a UID used twice, an unused entry that is
not empty, bytes after the last whole entry, and a track index past the number of channels of
the format chunk. It also compares the entries with the ADM in the axml chunk:
each UID there and here, and the track and pack format each UID names, must agree. The
allocation table and the ADM tables are shown on the Sound tab.
Checked on three real files that carry both chunks: the 4-channel test file of the EBU ADM
renderer, a Pro Tools ADM export (14 tracks) and a Nuendo export from the EBU ADM toolbox’s
tests (34 tracks, with axml before chna). In each, the counts match
the entries and every UID, track format and pack format agrees with the axml,
and the explorer reports nothing.