Label Track Info

A feature request was logged on Audacity’s GitHub pages:

Proposal Label Track Info #2410

When there are more than a handful of labels it’s often difficult to determine their exact number and type (point or region); one must either visually count them or open the Label Editor dialog, scroll to the bottom of the dialog, and examine the line number of the final item.

Occasionally there will be labels before time-zero; this can occur when a label exists at a place in the track which has been shifted before zero with the clip-handle drag-bars.

This was originally logged in 2014 as a Proposal in the Audacity Wiki:
https://wiki.audacityteam.org/wiki/Proposal_Label_Track_Info

Getting the label data into Audacity is relatively straightforward thanks to Audacity’s Scripting Commands, which can be accessed via “AUD-DO“.

However, you may notice that AUD-DO returns a list in the form of a dotted list, in which all of the information of interest is in the string:

Parsing the string to extract the information in a usable form is rather a pain, so I added a function to Audacity (available since Audacity 2.3.0) called “AUD-GET-INFO“. This works much like (aud-do “GetInfo:…), but with simpler syntax and the return value is a valid Nyquist list expression.

The Plug-in (LabelSummary.ny):

Installation:

Installation (and enabling after installing) is in the usual way for Nyquist plug-ins. See: Instructions in Audacity manual
When installed, the plug-in will appear in Audacity’s “Tools” menu as: “Label Summary”.

Running the plug-in:

Simply click on “Tools menu > Label Summary”.
The plug-in will display a summary of the labels in the project, looking similar to this:

2 thoughts on “Label Track Info”

  1. Is there a way to determine the current audacity project path via scripting?
    Would it be hard to add?
    (I see that the Scripting Reference mentions no such function)

    1. Is there a way to determine the current audacity project path via scripting?

      Not directly, but you can use the GetPreference: command to read the list of “Recent Files”.

      So long as either:

        1. The project was opened from disk, or
        2. The project has been saved,

      then the current project will be the final file in the list.

      Note that the number of “recent files” depends on how many files has been opened since the list was last cleared. This makes it a bit awkward as you have to check file01, file02, file03, … until you run out of recent files, then use the last non-empty file name.

      Example to get the first in the list:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.