Introduction
CAF is Apple’s audio file format for macOS and iOS, part of Core Audio. It was designed to replace AIFF and WAV inside Apple’s software: its sizes are 64-bit, so a file has no 4 GB limit, and it can hold any format Core Audio supports, from plain PCM to AAC and Apple Lossless.
Most CAF files met in practice hold uncompressed PCM, for example sound effects in apps and audio exported by Apple’s tools.
Structure
A CAF file starts with an 8-byte file header: the type caff, a 16-bit
version (1) and 16-bit flags. Chunks follow, each a four-character type and a signed
64-bit size, all big-endian. The audio description chunk desc comes first
and gives the sample rate (as a 64-bit float), the format ID, format flags, bytes and
frames per packet, channels and bits per channel.
The audio data chunk data starts with a 4-byte edit count, then holds the
audio. Its size may be −1 when it is the last chunk and its length was not known while
recording. Formats with packets of varying size also need a packet table chunk
pakt. Optional chunks carry the channel layout, markers, regions and
text information.
0File header caff, version, flags8 bytes8desc chunk header and audio description44 bytes52Optional chunks chan, pakt, info, mark …varies…data chunk header, edit count, audiovaries
Links
Software
- QuickTime Player – Apple’s built-in media player, which plays CAF (macOS)
- Logic Pro – Apple’s professional music production app, which records and exports CAF (macOS)
- GarageBand – Apple’s free music app, which uses CAF for its loops (macOS, iOS)
- VLC media player – free player for almost any audio or video file (Windows, macOS, Linux, mobile)
- FFmpeg – command-line tool that converts CAF to and from other formats (Windows, macOS, Linux)
Developers
- Audio Toolbox – Apple’s framework for reading and writing audio files, CAF included (Swift, Objective-C)
- libsndfile – library that reads and writes CAF (C)
Reference
- Apple Core Audio Format Specification – Apple’s full specification of the CAF header and chunks