Monkey’s Audio stores its tags at the end of the file as a list of named items, after the terminating data. WavPack, TTA and Musepack use the same tag. Numbers are little-endian. APEv1 has only a footer; APEv2 may also have a header.
Layout
| Part | Size | Notes |
|---|---|---|
| Header | 32 | Optional, APEv2 only |
| Items | varies | In the order written |
| Footer | 32 | Always in APEv1; usual in APEv2 |
Header and footer
Both have this layout, and a reader finds the tag from the footer at the end of the file.
| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 8 | char[8] | Preamble | APETAGEX |
| 8 | 4 | uint32 | Version | 1000 for APEv1, 2000 for APEv2 |
| 12 | 4 | uint32 | Tag size | Bytes of the items and the footer, not the header |
| 16 | 4 | uint32 | Item count | Items in the tag |
| 20 | 4 | uint32 | Flags | See below |
| 24 | 8 | bytes | Reserved | 0 |
| Flag bit | Meaning |
|---|---|
| 31 | The tag has a header |
| 30 | The tag has no footer |
| 29 | This 32-byte block is the header; 0 means the footer |
| 1 and 2 | Item type, in items |
| 0 | Read-only, in items |
Items
| Size | Field | Meaning |
|---|---|---|
| 4 | Value size | Bytes of the value |
| 4 | Item flags | Bit 0 is read-only; bits 1 and 2 are the type, below |
| varies | Key | ASCII, 2 to 255 characters, ending in a zero byte |
| value size | Value | As the type says |
| Type | Value holds |
|---|---|
| 0 | UTF-8 text; several values may be separated by zero bytes |
| 1 | Binary; usually a description, a zero byte, then the data |
| 2 | An external locator: a UTF-8 URL |
| 3 | Reserved |
Keys are case-insensitive. The usual ones are listed on the MP3 APE tags page.