Phatdb is the name I have given to the mcd.db file format created by PhatNoise Media Manager software to be playable by Kenwood Car Stereo head units supporting ACDrive Technology.
The PhatDB is a database of song metadata. It contains information on all tracks, artists, albums, genres and playlists in a compact format. The concept is similar to the itunesdb database found on ipods, though phatdb is less complex.
This document describes the format of the PhatDB file.
A Free Software program and library to build mcd.db files is available here:
All multibyte types are stored in big endian (network) byte order. They must be byte-swapped to be read on little-endian PC platforms.
The overall structure looks like this:
The file begins with a header containing the following elements:
|0x00000010||n_tracks||uint32||Total Number of Tracks|
|0x00000014||n_artists||uint32||Total Number of Artists|
|0x00000018||n_albums||uint32||Total Number of Albums|
|0x0000001c||n_genres||uint32||Total Number of Genres|
|0x00000020||n_playlists||uint32||Total Number of Playlists|
|0x00000024||artists_len||uint32||Len of Artists Array|
|0x00000028||albums_len||uint32||Len of Albumns Array|
|0x0000002c||genres_len||uint32||Len of Genres Array|
|0x00000030||playlists_len||uint32||Len of Playlist Array|
The File Header is immediately followed by an array of n_tracks track structures (offsets are relative to start of track structure). Tracks are stored in alphabetical order.:
Where the phat_str structure looks like this:
|0x00000000||string_length||uint16||Length of String (bytes)|
|0x00000002||string_width||uint16||Width of String?|
When string_width is 2 (Track Title) data is UCS-2 encoded. When string_width is 1 (Track Path), data is CP437 encoded. data is null-terminated and padded to a multiple of 4 bytes. string_length is the length of data (including padding).
Immediately following the track listing, there are sections for artists, albums and genres. All lists are in alphabetical order. Each section has the following format:
|0x00000000||item_list||phat_list||PhatDB Item List|
|0x00000xxx||track_item_arr||uint32||Track/Item Assignment Array|
The structure of the phat_list is as follows:
|0x00000000||array_offset||uint32||Item Array Offset|
|0x00000004||name||phat_str||Item Name String|
array_offset is an index into track_item_arr. This array contains a mapping of track id's relating to that item (artist, album, genre). The length of the each array is given by the fields in the header artists_len, albums_len and genre_len. item_index seems to be an index for skipping through large arrays, perhaps indexed alphabetically?
The playlists section immediately follows the genre section. It is identical to the sections above except that it does not have the item_index.