au files format specification

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
fmiyara
Posts: 18
Joined: Sun Jul 07, 2013 10:08 pm
Operating System: Please select

au files format specification

Post by fmiyara » Sun Jul 07, 2013 10:30 pm

Dear All,

I'm new to this forum.

Does anybody know where one can download a specification of the structure of .au files in the data folder of an Audacity project?

I mean headers, data format and so on.

Thank you in advance

Federico Miyara

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: au files format specification

Post by steve » Mon Jul 08, 2013 10:59 am

As far as I'm aware the .au files are headerless one channel PCM audio. The bit format and sample rate is defined by the .AUP file.
Note that the .au files in Audacity projects are "Audacity data files" and not directly related to the "Sun Microsystems" format of the same file extension.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fmiyara
Posts: 18
Joined: Sun Jul 07, 2013 10:08 pm
Operating System: Please select

Re: au files format specification

Post by fmiyara » Mon Jul 08, 2013 5:08 pm

As far as I'm aware the .au files are headerless one channel PCM audio. The bit format and sample rate is defined by the .AUP file.
I've been trying to examine the contents of the .au file (sort of reverse engineering). In fact it has a header, it starts with sdn. (I guess it is short for "sound"), then the length of the header, then some information about Audacity, then the samplig rate, then the IEEE 754 32 bit floating point representation of min, max and rms declared in the aup (rms doesn't seem to be actually rms, I'm afraid). Then the same information is repeated except that rms is shifted 4 bits (multiplied by 16). Then there comes some unrecognized dark matter :) that may be rather long (about 3 kb) and, finally, the audio data in IEEE 754 format. No footer.

However, this is the result of analyzing a few cases, so I'm not quite certain it is the whole story.

By the way, I need the format so as to be able to generate/read/analyze Audacity porojects with other software, particularly mathematical software such as Matlab, Octave or Scilab. Of course one could use the export/import feature, but I think it is better to do it directly.

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: au files format specification

Post by kozikowski » Mon Jul 08, 2013 6:28 pm

We warn people that Audacity is not a WAV editor but an audio production editor. Data sacrifices and deviations are tolerated in order to produce a pleasant sounding show. Scientists are routinely dismayed that sucking a show into Audacity and blowing the same show back out will not always produce a bit-accurate match.

Koz

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: au files format specification

Post by steve » Mon Jul 08, 2013 6:32 pm

Here is the official (but very brief) documentation that I could find: http://manual.audacityteam.org/man/Glossary#au
fmiyara wrote:By the way, I need the format so as to be able to generate/read/analyze Audacity porojects with other software, particularly mathematical software such as Matlab, Octave or Scilab. Of course one could use the export/import feature, but I think it is better to do it directly.
What sort of analysis do you want to do?
To import into Matlab etc. it will probably be easiest to export as raw pcm.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fmiyara
Posts: 18
Joined: Sun Jul 07, 2013 10:08 pm
Operating System: Please select

Re: au files format specification

Post by fmiyara » Mon Jul 08, 2013 7:58 pm

Thank you for that link. However, I agree that this information is too brief.
What sort of analysis do you want to do?
To import into Matlab etc. it will probably be easiest to export as raw pcm.
I want, for instance, to get the audio, modify it and save it in the Audacity native format. Now I know how to retrive de samples, but I'm not sure that if I just save the output (modified) ones where I think they go, I always will get compatible au files.

I need also to convert back and forth metadata information, such that one can get a wav file with cues and labels readable by other software such as cool edit or adobe audition, or read a wav file and include such metadata as labels in an Audacity project

fmiyara
Posts: 18
Joined: Sun Jul 07, 2013 10:08 pm
Operating System: Please select

Re: au files format specification

Post by fmiyara » Tue Jul 09, 2013 4:18 pm

We warn people that Audacity is not a WAV editor but an audio production editor. Data sacrifices and deviations are tolerated in order to produce a pleasant sounding show.
I think that being an audio production editor is not incompatible with being an excellent tool for any kind of sound processing, including scientific research and advanced measurement. However, I was simply asking for the technical specification of au files. I mean, for instance, something akin to the wav or flac or even the highly proprietary mp3 format that can be easily found on the web.
Scientists are routinely dismayed that sucking a show into Audacity and blowing the same show back out will not always produce a bit-accurate match.
2) Would you please be more specific, providing some example of a transparent processing such as importing and exporting which yields a different result?

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: au files format specification

Post by steve » Tue Jul 09, 2013 5:16 pm

fmiyara wrote:2) Would you please be more specific, providing some example of a transparent processing such as importing and exporting which yields a different result?
Audacity works internally in 32 bit float format.
By default, when exporting to a lower bit format the output has dither applied. This is usually beneficial for audio work, but for detailed analysis work you may want to turn dither off, or export in 32 bit float format. Dither can be disabled in "Edit > Preferences > Quality".

fmiyara wrote:I want, for instance, to get the audio, modify it and save it in the Audacity native format.
Just out of interest - why?
It would be much simpler to work in raw PCM format.
fmiyara wrote:I need also to convert back and forth metadata information,
Audacity handles metadata in the .AUP file, not the .AU files.
fmiyara wrote:or read a wav file and include such metadata as labels in an Audacity project
Audacity handles labels in the .AUP file, not in the .AU files.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: au files format specification

Post by kozikowski » Tue Jul 09, 2013 5:27 pm

Audacity always does everything internally at 32-bit floating. Audacity defaults to Export Dither (noise) to help mask bit translation errors that might otherwise "add up" in an output show and produce audible distortion.

There is a technique whereby you import a "perfect" WAV (for example) show, set Audacity for that exact wav specification, turn dither off and export an identical show except for the filename and datestamp. But then, why bother?

This doesn't work with compressed file types like MP3 or m4a because they always become damaged in the transition through 32-floating. Audacity is not an MP3 editor.

Koz

fmiyara
Posts: 18
Joined: Sun Jul 07, 2013 10:08 pm
Operating System: Please select

Re: au files format specification

Post by fmiyara » Tue Jul 09, 2013 6:39 pm

Thank you all for the example and its solution.
Just out of interest - why?
It would be much simpler to work in raw PCM format.
I hope in a future to have all processing done inside Audacity, but for the time being, some processing must be done using specific software such as Matlab, Scilab or Octave. I find it cumbersome having to export and import audio in whatever format (wav, pcm) to have it available outside the Audacity environment, when a script out there could read and process an Audacity project and return a valid Audacity project.
Audacity handles metadata in the .AUP file, not the .AU files.
Audacity handles labels in the .AUP file, not in the .AU files.
I'm aware of that. However, importing a WAV file with, for instance, cues or notes, doesn't result in the inclusion of cues as labels in the .AUP; and, conversely, .AUP labels are not exported to .WAV. Cues or whatever time-related marks are most interesting for measurement documentation purposes, musical analysis, phonetic analysis, bioacoustics, and so on.

Post Reply