Introduction
The IRCAM sound file is the sound format of the computer-music software of IRCAM, Berkeley and CARL: the manual page of its
header file calls the system the “Berkeley/IRCAM/CARL Sound Filesystem” (BICSF), and FFmpeg names the format “Berkeley/IRCAM/CARL
Sound Format”. IRCAM’s own copy of the header file (sfheader.h, version 1.5) is dated 28 March 1992. The files use the
extension .sf, or .ircam, and FFmpeg and libsndfile read and write them. The cmix music language read
them, and the source of its successor RTcmix still carries the header.
The format is very simple: a header of exactly 1,024 bytes, then the samples. The header holds the sample rate, the number of channels and how a sample is stored, and after those four fixed items a chain of small records (codes) that can carry the maximum amplitude of each channel and a comment. There is no length field: the samples run to the end of the file.
Structure
The header is the first 1,024 bytes. Its first 16 bytes are the fixed items; the chain of codes starts at byte 16 and ends with a code of 0; the rest of the header is zero. The samples follow, interleaved by channel.
0Header1,024 bytes0sf_magic the magic number, which also says the byte order4 bytes4sf_srate the sample rate, a 32-bit float4 bytes8sf_chans the number of channels4 bytes12sf_packmode how a sample is stored4 bytes16sf_codes the chain of codes (maximum amplitude, comment, …), ended by a code 0, then zeros1,008 bytes
1024Samples interleaved by channel, to the end of the filevaries
All numbers use the byte order of the machine that wrote the file, and the magic number tells which: see the magic number.
Telling it from other formats
The extension .sf is not reliable on its own, but the first four bytes are: 64 A3 MM 00 with MM
from 1 to 4, or 00 MM A3 64. A file that starts with one of these is an IRCAM sound file. One more thing
to know: some systems wrote hybrid files, whose first 28 bytes are a Sun/NeXT AU
header with an offset of 1,024, followed straight away by an IRCAM header, so that the same file opens as an AU sound and as an
IRCAM sound. The AU page describes how the explorer shows such a file; this format’s header is the one inside it.
What the viewer shows
Drop a file on the page, or use the explorer, to open it. The viewer shows:
- the whole structure as a tree: the header with its magic number, sample rate, channels, packing mode, every code of the chain with its code, size and data, and the unused header bytes, then the samples; every byte of the file is covered
- a table of the sound’s facts: the machine and byte order the magic gives, the sample rate, channels, packing mode, the maximum amplitude of each channel with its time stamp, the comment, the frames, the duration, and the peak and RMS levels
- a waveform that plays in the browser, for every packing mode the sources define (8-, 16-, 24- and 32-bit integers, 32- and 64-bit floats, A-law and µ-law); clicking a point on the waveform selects the bytes of that sample
- problems, marked on the tree and listed: a file shorter than 1,024 bytes, a sample rate or channel count that is zero, a packing mode that no source defines, a chain of codes that does not end, a code that no header defines, header bytes after the codes that are not zero, and bytes at the end that do not make a whole frame
It never refuses a damaged file: whatever cannot be read is shown as labelled bytes with a note.
Not described
Unknown
- Reference and viewer: what the two numbers of the
SF_AUDIOENCODcode (4) mean. The IRCAM header names the structure (encodingandgrouping, “written by pvanal”) and nothing found says what values they take (Codes). The viewer shows both numbers. - Reference and viewer: codes above 4. IRCAM’s header ends its list at
SF_CODMAX4; no source defines a later code. The viewer shows an unknown code’s bytes with a problem. - Reference and viewer: IRCAM’s own documentation of the format. The format description above rests on the header files of IRCAM, BICSF and RTcmix and the readers in FFmpeg and libsndfile; IRCAM’s manual pages for the format (the manual that
sfheader.hpoints to as “man (3carl) sfcodes”) were not found online.
Links
Software
- FFmpeg – command-line tool that reads and writes IRCAM sound files and converts them to other formats (Windows, macOS, Linux)
- libsndfile – library that reads and writes IRCAM sound files; many audio editors and music programs use it (Windows, macOS, Linux)
- RTcmix – real-time descendant of the cmix music language, which used these files (macOS, Linux)
Developers
- cmusic – the CARL software distribution, with the BICSF header files,
libbicsfand its manual pages (C) - FFmpeg ircamdec.c – the demuxer that reads IRCAM sound files (C)
- libsndfile ircam.c – the reader and writer in libsndfile (C)
Reference
- BICSF sfheader(7) – the manual page of the header and its macros
- BICSF sfcodes(3) – the manual page of the chain of codes