Decoded, the binary XML is an XML
document with the same elements as the older .aup files. The header the
writer emits is stored as FT_Raw fields and skipped on reading. It is an XML
declaration with standalone="no" and this DOCTYPE:
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN"
"http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
Audacity’s forum has said this DTD is badly out of date, so the source code is the reference used here.
The element tree
project
├── tags
│ └── tag
├── wavetrack
│ └── waveclip
│ ├── sequence
│ │ └── waveblock
│ ├── envelope
│ │ └── controlpoint
│ └── waveclip (a cutline, same shape)
├── labeltrack
│ └── label
├── timetrack
│ └── envelope
├── notetrack
└── effects (also inside a wavetrack)
└── effect
└── parameters
└── parameter
project
| Attribute | Meaning |
|---|---|
xmlns | http://audacity.sourceforge.net/xml/ |
version | The document format, written "%i.%i.%i": 1.3.0 in Audacity 3.x (and in Audacity 4’s test file), 2.0.0 in the current development source. Audacity refuses a file with a version newer than its own. |
audacityversion | The version of Audacity that wrote the document |
projname | Name of the _data folder, in .aup files only |
sel0, sel1 | Selection start and end, seconds, 10 places |
selLow, selHigh | Selected frequency range in Hz, 10 places; written only when 0 or more (a spectral selection) |
vpos, h, zoom | Vertical scroll position (integer), horizontal position (seconds, 10 places) and zoom (pixels per second, 10 places) |
rate | Project sample rate, Hz |
snapto | on or off (kept for compatibility; on reads as snap to nearest) |
selectionformat, frequencyformat, bandwidthformat | Names of the number formats of the selection toolbar |
time_signature_tempo, time_signature_upper, time_signature_lower | Tempo (real) and time signature (integers); written by Audacity 3.4 and later |
preferred_export_rate | The sample rate the last export used; a real number, or −1 for none |
These are all the attributes the source registers for the project (they come from the
modules that register with it, in an order that follows how the program is built).
Besides them, a project can hold the child elements tags (project
metadata), effects (the project’s real-time effect stack) and the tracks.
A file can hold other attributes, written by modules a build adds, and a reader should
skip them. A reader refuses a document that lacks version or
audacityversion, or whose version is newer than its own.
wavetrack
A stereo track is written as two wavetrack elements, the first with
linked set.
| Attribute | Type | Meaning |
|---|---|---|
name | string | Track name |
isSelected | boolean | Whether the track is selected |
channel | integer | 0 left, 1 right, 2 mono; written for older versions and not read by Audacity 3.4 and later. Its writer gives a mono track 0 (left), as it tests for “no channels” and not for one. |
linked | integer | A link type: 0 none, 1 the first channel of a pair in projects of older Audacity, 2 group, 3 aligned. Audacity 3.4 and later writes 3 on the first channel of a stereo pair and 0 on the second and on mono tracks; above 3 reads as 2, below 0 as 0. |
rate | real | Sample rate, 1 to 1,000,000 |
gain | real | Track volume, a linear factor (the attribute keeps its old name; the code calls it volume) |
pan | real | −1 to 1 |
sampleformat | long | The track’s sample format |
offset | real | Read only, from old projects |
mute, solo | boolean | Written by every playable track (audio and note): written as 0 or 1 |
height, minimized | integer, boolean | The track’s height in the track panel (40 to 1000 when read) and whether it is collapsed. The attribute names for channel n above the first are the name followed by the number (height1, minimized1), the code in ChannelView::WriteXMLAttributes builds them so. |
colorindex | integer | The waveform colour chosen for the track (a number into Audacity’s palette) |
The attributes come in this order: name, isSelected, the
attachments’ (height, minimized, colorindex,
as the build registers them), channel, linked,
mute, solo, rate, gain,
pan, sampleformat. After them a track can carry an
effects child (its real-time effect stack; see below), then its
waveclip children. A rate is stored as a real number and
read to the nearest integer between 1 and 1,000,000; a pan outside −1 to 1
or a rate outside its range makes Audacity refuse the project.
The legacy track forms of Audacity 1.2, a sequence, envelope
or waveblock straight inside a wavetrack, are still read
(as one clip at the track’s offset) and never written.
waveclip
A clip is one continuous piece of audio on a track. A clip with no samples is not written.
| Attribute | Type | Meaning |
|---|---|---|
offset | real, 8 places | Time in seconds of the sequence’s first sample, on the project’s time line |
trimLeft, trimRight | real, 8 places | Seconds hidden at the start and the end of the sequence. The clip plays from offset + trimLeft to offset + length − trimRight, where length is numsamples ÷ the track’s rate (for an unstretched clip). |
centShift | integer | Pitch shift in cents (hundredths of a semitone); 0 for none |
pitchAndSpeedPreset | long | The stretching algorithm’s preset: 0 default, 1 optimise for voice (PitchAndSpeedPreset in ClipInterface.h) |
rawAudioTempo | real, 8 places | The audio’s tempo in beats a minute; 0 when unset |
clipStretchRatio | real, 8 places | Stretch applied to the clip: 1 for none, 2 plays it twice as long |
name | string | Clip name |
clipStretchToMatchTempo, clipTempo, groupId, colorindex, isSelected | boolean, real, long, integer, boolean | Written by the development line (Audacity 4) only: whether the clip follows the project tempo, the clip’s own tempo, its clip group number, its colour and whether it is selected. Audacity 3.7.1 neither writes nor reads them. |
The attributes are written in this order. The clip’s children are one
sequence (a clip of a stereo track exists once in each of the track’s two
wavetrack elements, each with the sequence of its channel), an
envelope of volume points, and any number of nested waveclip
elements, the audio kept behind a cut line (same shape). An envelope’s times are
seconds counted from the start of the sequence.
A reader that wants to play a clip reads the samples of the blocks between
trimLeft and the end less trimRight (in samples,
round(trim × rate)), puts them at offset + trimLeft,
multiplies each by the envelope at its time, and adds overlapping clips. A clip with a
stretch ratio other than 1, or a pitch shift, is rendered by Audacity’s time-stretching
library (Staffpad); that algorithm is not described here.
sequence and waveblock
| Element | Attribute | Type | Meaning |
|---|---|---|---|
sequence | maxsamples | integer | Largest block, in samples. Must be between 1,024 and 67,108,864. |
sequence | sampleformat | integer | Stored sample format |
sequence | effectivesampleformat | integer | The format the data is really at, added in Audacity 3.0.3 |
sequence | numsamples | 64-bit | Total samples. Corrected, and the file flagged, if it does not match the blocks. |
waveblock | start | 64-bit | The block’s first sample within the sequence |
waveblock | blockid | 64-bit | The row of sampleblocks. A value of zero or less is a silent block of that many samples. |
envelope
| Element | Attribute | Type | Meaning |
|---|---|---|---|
envelope | numpoints | size | Number of controlpoint children. Must not be negative (Audacity refuses the envelope otherwise). |
controlpoint | t | real, 12 places | Time of the point, seconds from the start of the sequence (or of the time track) |
controlpoint | val | real, 12 places | Value at that time |
A clip’s envelope is a gain, between 0.0000001 and 2, default 1. Between two points the
gain follows a straight line in decibels (the logarithm of the values is
interpolated linearly, then raised to the power 10 again: halfway between 0.1 and 1 is
0.316); before the first point it is the first value, after the last point the last, and
with no points it is 1. Two points at the same time make a step. A time track’s
envelope is made the same way (also interpolated logarithmically) and is a speed
factor, its default 1; its limits are the track’s rangelower and
rangeupper (0.2 and 2.0 for a new track).
labeltrack and label
| Element | Attribute | Meaning |
|---|---|---|
labeltrack | numlabels | Number of labels. Must not be negative. |
labeltrack | name, isSelected | Common track attributes |
label | t, t1 | Label start and end, in seconds, 10 places; equal for a point label |
label | selLow, selHigh | The label’s frequency range in Hz (10 places), written only when 0 or more |
label | title | Label text |
A labeltrack’s attributes are name, isSelected, the
attachments’ (height, minimized), then numlabels.
timetrack
| Attribute | Type | Meaning |
|---|---|---|
name, isSelected | Common track attributes | |
rangelower, rangeupper | real, 12 places | Range of the time warp |
displaylog | boolean | Logarithmic display |
interpolatelog | boolean | Logarithmic interpolation |
A timetrack has one child, an envelope.
notetrack
A MIDI note track (built into Audacity only when it is compiled with MIDI support). All its data is attributes of one element with no children.
| Attribute | Type | Meaning |
|---|---|---|
name, isSelected | Common track attributes | |
height, minimized, bottomnote, topnote | integers | Display state, written by the track’s attachments (the lowest and highest note shown) |
mute, solo | boolean | As on an audio track |
offset | real | Where the note data starts, seconds |
visiblechannels | integer | Bit set of the 16 MIDI channels shown |
velocity | real | The track’s velocity setting |
data | string | The notes as text in the Allegro format (Alg_seq::write of the Allegro library that Audacity includes, in its text form) |
effects
The real-time effect stack of the project or of one audio track. A track’s
effects element comes straight after the track’s attributes.
| Element | Attribute | Meaning |
|---|---|---|
effects | active | boolean: the stack is switched on |
effect | active, id, version | Whether this effect is on, the plug-in’s ID string and its version |
parameters | Child of effect, written when the plug-in saves settings | |
parameter | name, value | One setting, name and value as text |
The older .aup form
Projects before Audacity 3.0 are this XML as a plain text .aup file, with
the audio in small files under a <projname>_data folder. Each
waveblock has a simpleblockfile child with
filename, len, min, max and
rms attributes, or another type of block file.
The block file elements, from the Audacity 2.4.2 source (SaveXML in
SimpleBlockFile.cpp, SilentBlockFile.cpp,
PCMAliasBlockFile.cpp, LegacyBlockFile.cpp):
simpleblockfile:filename(the file name only, no folder),len(samples),min,max,rms.silentblockfile:lenonly; no file exists.pcmaliasblockfile:summaryfile(an.auffile in the data folder holding only the summaries),aliasfile(full path of the external audio file),aliasstart,len,aliaschannel,min,max,rms.legacyblockfile(Audacity 1.1):name,len,norms,summarylen. Audacity 3’s importer does not read it.
Block files are named eXXYYZZZ.au ("e%02x%02x%03x") and kept in
eXX/dYY/ folders under the data folder. A simple block file is an
.au file (magic .snd, 24-byte header, data offset = 24 + summary
bytes, data size 0xFFFFFFFF, encoding 3, 4 or 6 for 16-bit, 24-bit or float, 44100 Hz,
one channel) whose summary sits between header and samples: the 20-byte tag
AudacityBlockFile112, then the 64K frames, then the 256 frames, each frame
three little-endian floats (min, max, rms).
This page’s viewer does not read the .aup form; it is documented from source only.
What Audacity checks when it reads a document
projectneedsversionandaudacityversion; a newerversionis refused.- A
wavetrack’srateis between 1 and 1,000,000 and itspanbetween −1 and 1;sampleformatis one of the three valid values. - A
sequence’smaxsamplesis between 1,024 and 67,108,864, its formats are valid, andnumsamplesis not negative. - The
waveblockstartvalues must run on without gaps; where they do not, Audacity moves the blocks and flags the project. Anumsamplesthat is not the sum of the blocks is corrected and flagged. - A
waveblockwhoseblockidhas no row insampleblocksmakes the sequence fail to open. - A
labeltrackand anenvelopeneed a count that is not negative.
The explorer’s viewer reports each of these in the tab’s issue list instead of stopping.
Not confirmed
- Attributes written by Audacity modules and plug-ins outside the source read here (third-party builds can add project or track attachments); the viewer lists any attribute it does not know in the track’s attribute row.
- The time-stretching algorithm’s output for clips with a stretch ratio other than 1 or a pitch shift.