Importing and Exporting Labels

From Audacity Development Manual
Jump to: navigation, search
Label Tracks can be exported to, and imported from plain text files (.txt extension). The structure of the file is a tab-delimited plain text format that can be opened by any text editor or spreadsheet application and edited there.

Standard (default) format

The standard structure to display a label denoting its Timeline position and any text it contains is as below.

2.150000  →  2.150000  →  point label at 2.15 seconds
3.400000  →  6.100000  →  region label from 3.4 to 6.1 seconds

In the example above, the first column has the start time in seconds, the second column has the end time, and the third column if present shows the text of the label. Start time and end time are identical for a point label. Values are separated by tab characters (which will often appear as an arrow in text editors, as shown above).

Extended format with frequency ranges

This is non-default and needs to be turned on in Import / Export Preferences in the Exported Label Style box if you wish or need to use this.

If a label is created from a point or region in a Spectrogram track where Spectral Selection is enabled (or if a label is otherwise created when a low frequency and high frequency value are already stored in the project), the labels file also contains the frequency range for that label.

1.000000  →  1.000000  →  This point was clicked at 6928.456055 Hz
\  →  6928.456055  →  6928.456055
2.000000  →  2.500000  →  Low frequency undefined, High frequency 6334.588867 Hz
\  →  -1.000000  →  6334.588867
3.000000  →  3.500000  →  Low frequency 8908.015625, High frequency undefined
\  →  8908.015625  →  -1.000000
4.000000  →  4.500000  →  Low frequency 1484.669312 Hz, High frequency 2969.338523 Hz
\  →  1484.669312  →  2969.338523 

In the example above, there is a point label at 1 second, then three region labels each starting one second further along. After the time position and text content information in the first line, a second line for each label records the low frequency followed by the high frequency.

To view the low and high frequency values for a label, either select the label then look in Spectral Selection Toolbar, or right-click the label and choose "Edit" to open the Label Editor window.

Usage of label files

Sometimes it may be useful to use these labels in another application (for example if somebody wanted to know the time where each piece of an interview starts or stops), or to import a labels file that someone has shared with you.

You can export labels using the Label Editor window mentioned above, or by choosing File > Export Other > Export Labels. By default the exported file has the same name as the current name of the label track. If there are multiple label tracks, the labels of all those tracks are combined into a single label track in the exported file, which by default has the same name as the current name of the last label track.

Labels can be imported using the Label Editor window, or by choosing File > Import > Labels. Imported label tracks are added to the bottom of all existing track types in the project, just as when you import an audio track.

Advice If you import labels created by some application other than Audacity, make sure the application supports UTF-8 or use only ASCII (Latin unaccented) characters and numbers. Otherwise, accented or any other non-Latin characters may cause the file to not import.

If you use a Windows application to create the file, you may have to use "Save As" and look for a specific option that saves with UTF-8 encoding.

Exporting selected label tracks

Export Labels cannot export selected label tracks or selections within label tracks.

To export individual label tracks the workaround is to:

  1. temporarily delete all but one label track and export that
  2. use Undo to restore the temporarily deleted label tracks
  3. repeat for each label track in turn

|< Label Tracks