Before version 3.0, Audacity saved a project as two things next to each other: an
.aup file, which is XML text, and a folder named after the project with
_data added (song.aup and song_data). The XML
describes tracks, clips and the order of the audio blocks; the audio itself is in many
small files in the folder. Each fact below is marked V (read in the
source), I (inferred from it) or U (not confirmed).
What this page follows
The Audacity 2.4.2 source, the last release that wrote this form: ProjectFileIO.cpp
(the XML header and the project element), Track.cpp, WaveTrack.cpp,
WaveClip.cpp and Sequence.cpp (tracks, clips and sequences),
SimpleBlockFile.cpp, SilentBlockFile.cpp,
PCMAliasBlockFile.cpp, LegacyBlockFile.cpp and
BlockFile.cpp (block files and summaries), DirManager.cpp (names),
and ImportAUP.cpp from Audacity 3 (what the importer accepts). The elements
have the same shape as in the project
document of a .aup3 file.
Recognising the file
V Audacity 3’s importer takes a file as a project when it starts with
<?xml and the first 255 bytes contain <audacityproject or
<project. Audacity 1.0 used a different text format that starts with
AudacityProject; it is not XML and is not read. The explorer applies the same
rule.
The project element
V The file is an XML declaration, the DOCTYPE
-//audacityproject-1.3.0//DTD//EN, then a project element in the namespace
http://audacity.sourceforge.net/xml/.
| Attribute | Meaning |
|---|---|
projname | Name of the data folder. The importer looks for this folder beside the file, then for <file name>_data, and stops if neither exists. |
version, audacityversion | The document format (1.3.0 from Audacity 1.3 to 2.4; 1.1.0 in 1.2) and the Audacity that wrote it. The importer needs both, and the version must be five characters. |
rate, sel0, sel1, vpos, h, zoom, snapto, selectionformat, frequencyformat, bandwidthformat | Sample rate, selection, scroll position, zoom and toolbar formats, as in the project document page. |
Tracks, clips and sequences
V From Audacity 1.3 a wavetrack holds one or more waveclip
elements, each with a sequence (the blocks) and an envelope. In an Audacity 1.2
project the wavetrack holds the sequence directly and carries an
offset attribute; the importer makes one clip from it. A stereo track is two
wavetrack elements, the first with linked="1" and channel="0",
the second with channel="1". channel 2 is mono.
V A sequence has maxsamples (the largest block, in samples),
sampleformat (0x00020001 = 131073 for 16-bit, 0x00040001 = 262145 for
24-bit, 0x0004000F = 262159 for 32-bit float) and numsamples (the total). Its
waveblock children each have start (the first sample of the block) and one block
file element. The starts must run on without gaps and numsamples must be their total;
the importer refuses a block with len of 0 or less.
Block file elements
- V
simpleblockfile:filename(name only),len,min,max,rms. - V
silentblockfile:lenonly; no file exists. - V
pcmaliasblockfile:summaryfile(an.auffile in the data folder holding only the summaries),aliasfile(full path of the external audio file),aliasstart,aliaslen,aliaschannel,min,max,rms. There is nolen. - V
legacyblockfile(Audacity 1.1):name,len,norms,summarylen. Audacity 3 does not import it.
V Names are e%02x%02x%03x plus .au (.auf for an alias
summary), and the file sits in folder eXX, then dYY, under the data
folder: song_data/e00/d00/e0000000.au.
The .au block file
V A simple block file is an AU file. Audacity writes the
magic .snd in the byte order of the machine, so a file from an Intel or ARM
computer starts with the bytes dns. and is little-endian; the reader checks the magic to
tell.
| Offset | Field | Value written |
|---|---|---|
| 0 | magic | 0x2E736E64 |
| 4 | dataOffset | 24 + the summary bytes |
| 8 | dataSize | 0xFFFFFFFF (not stated) |
| 12 | encoding | 3 (16-bit), 4 (24-bit) or 6 (32-bit float) |
| 16 | sampleRate | always 44100 (the source says “don’t fabricate”; the true rate is in the XML) |
| 20 | channels | always 1 |
V Between the header and the samples (the annotation area of an AU file) is the summary: the
20-byte tag AudacityBlockFile112, then one frame per 65,536 samples, then one frame per 256
samples (256 per 64K frame, padded). A frame is three 32-bit floats: minimum, maximum and
root-mean-square. The padding frames hold FLT_MAX, -FLT_MAX and 0. The XML’s
min, max and rms are the whole block’s.
What the explorer shows
The viewer reads the .aup file you give it: tracks, clips, every block file with the path
where it should be, labels, tags, and the XML. The audio is in the separate _data folder.
Open the .aup together with the .au files of that folder (drop the project and
the folder, or select them together) and the viewer also reads each block file it finds at the path
the project gives:
- the 24-byte header, checked (signature in either byte order, encoding, rate, channels, the
dataOffsetthat the block’s length implies, the number of samples in the file against the project’slen); - the summary: the tag, the 64K frames and the 256-sample frames, listed frame by frame, each compared with the summary computed from the samples (I: a difference is shown as a note, not a problem, because the project does not check it and the formula is read from the source, not from a file Audacity wrote);
- the project’s
min,maxandrmsagainst the samples (written in the XML with few digits, so they are compared with a small tolerance); - the samples, as a waveform you can play for each track and for the mix, with the track’s gain and pan, the envelope and the clip offset applied; a stereo pair of linked tracks is one stereo track; each block file also opens as its own file, and each track as a WAV.
A block file the project names that is not among the supplied files is a problem that gives its expected
path, and it plays as silence. When no block file is supplied at all, the viewer shows the expected paths
and no problem. If the page stopped searching the folders at its limit (100,000 files or 10,000 folders), a
problem says so, since a missing block file may then simply not have been read. A block file found under another
folder name is used and noted. An aliased block (pcmaliasblockfile) keeps its audio in a file elsewhere;
its summary file and that audio are shown by location only. Faults the importer would refuse (a missing
attribute, a block of no length, a gap in the starts, a wrong numsamples) are listed as issues and the
file is still shown.
Not confirmed
- U No
.aupwritten by Audacity was available: the viewer was tested on projects built to the writer’s code (scripts/audacity/build-aup.mjs), block files included. How a real file from Audacity 1.3 or 2.x compares with them, byte for byte, is unconfirmed. - U The Audacity 1.0 text format and the 1.1 block file layout were not read from source here.