LOF Files

From Audacity Development Manual
Jump to: navigation, search
A LOF file can be used to Import or Open a set of audio files into Audacity.
  • A LOF file is a plain text file ending with the extension ".lof" that contains a list of audio files to import into an Audacity project window.
  • It can optionally contain commands to create new project windows into which to import the audio files.

Use

To use LOF files in Audacity use either of:

Then select List of files in basic text format from the Files of type dropdown list:

Selecting a LOF file for Import.png


Command syntax

There are only two commands "file" and "window", each with associated options:

file (required)

Specifies the full path to the file which then imports as a new track in the current window (the path must always be in double quotes):

  • offset: an optional parameter to the file command, specifying the start time of the audio file in seconds

window (optional)

Creates a new Audacity project window for subsequent files in the list:

  • offset: an optional parameter to the window command, specifying the left-most time displayed in the window
  • duration: an optional parameter to the window command, specifying how much time should be displayed in the window

Comments

The hash character # can be used anywhere on a line to precede a comment - everything after # on that line is ignored by the importer.

Bulb icon Tips:
  • Each command must be placed on a separate line.
  • Files are imported in the order shown in the LOF file.
  • If the file to be imported is in the same folder as the LOF file, you need only give the file name inside double quotes.
Warning icon There is a known issue Bug 2743 - "window" command ignored in LOF files (probably only the initial one)

It appears that Audacity always ignores the first "window" command it encounters and then honors the succeeding ones.

So to make the example below work as intended you would need to place two "window" commands at the beginning - the first will be ignored.


Example

Given an empty project window, the following LOF file located at C:\Desktop imports the audio file "sample1.wav" from the Desktop into that window, followed by "sample2.wav" and "sample3.wav" from other locations underneath. Then a new project window is created and the audio file "sample4.wav" from the Desktop is imported into it.

# everything following the hash character is ignored
window # an initial window command is implicit and optional
file "sample1.wav"                   # sample1.wav is displayed
file "C:\Ken\sample2.wav" offset 5   # sample2.wav is displayed with a 5s offset
file "C:\Dave\sample3.wav"           # sample3.wav is displayed with no offset
window offset 5 duration 10          # open a new window, then zoom to display
# 10 seconds of sample4.wav from 5 seconds to 15 seconds, offsetting it by 2.5 seconds
file "sample4.wav" offset 2.5

The file names shown are for a Windows system, but the same syntax applies on Mac and Linux with the obvious change to a suitable file path.