Export of Track Lengths

One not uncommon (I’d imagine) use for Audacity is to record audio for presentations. To sync such audio up with slides/video, one needs to know exactly when one track stops and another begins.

In other words, one needs a list of the lengths of each track, eg.:

1: 1:30.234
2: 1:11.123
3: 2:01.429

Currently the only way to extract such info is to go track by track, highlighting each track, looking at it’s length at the bottom of the screen (I don’t know how blind users could even do this), and then typing it into a separate text file (and then doing the same thing for every track in the file).

However, Audacity has all this info available, so generating such a list should be trivial for it. If you’ll forgive some pseudo code …

output = ‘’;
for trackIndex in file.tracks:
output += trackIndex + ': ’ + file.tracks[trackIndex].length + ‘\n’

Whether Audacity actually generates a .txt file, or simply displays the track length list in a modal, the point is that if there was simply a menu option that let users “Extract Track Lengths”, it would provide a huge benefit (for the subset of users who need this info) … and again hopefully should be pretty easy to generate.

In Audacity 2.3.1:

Enable the “Extra” menu (https://manual.audacityteam.org/man/view_menu.html)

Then in the Extra menu > Scriptables 11 > Get Info (https://manual.audacityteam.org/man/extra_menu_scriptables_ii.html)

Select “Tracks” as the command, and either JSON, LISP or Brief as the format. (https://manual.audacityteam.org/man/extra_menu_scriptables_ii.html#get_info)
If the format is “Brief”, the start and end times of the track are shown after the “kind” of track, for example, the highlighted numbers below are the start and end times in seconds:

“Audio Track” 0 1 “wave” 0 30 0 1 1 0 0 -1 1

Well that was so clear and obvious, no wonder I didn’t find it on my own! :unamused:

Seriously though, thank you so much for that answer, it will help me a lot.

However, I don’t think this really solves the problem for anyone but me. Ideally this “ticket” should be converted into a “make this task possible for an ordinary human being who isn’t an Audible developer or forum admin to accomplish”.

Actually I take that back; my “extras” menu has no “Scriptables” option at all (“Scriptables 11” or anything else).

I’d have thought that most “ordinary human beings” would be capable of looking in the Selection Toolbar (which should be readable by Jaws for VI users). I was just giving a tip about an “advanced” feature (for “advanced users” :confused: :wink: )

Which version of Audacity do you have?

2.2.2 (Linux)

Hey man, the “ordinary humans” bit was just me giving you a user’s perspective, because as a developer myself I know how easy it is to lose that (there’s a reason companies pay huge sums of money for usability studies where they essentially just watch people use their software; if developers could just “think like a user” they never would pay for such things). And I thought the smiley (and following text) indicated that I was being tongue in cheek, and not rude or dismissive of your effort to help.

But look, if you sincerely believe that those steps you outlined are the best way for people who want to use Audacity for presentations to get track lengths, and you sincerely believe that all those people will be able to figure out those steps you outlined (without coming here and getting you to outline them), then one random person in a forum thread (bug ticket?) like myself saying “maybe there could be an easier way” certainly won’t be able to convince you otherwise.

I just thought that, like myself, you would want people who use your software to be able to do so, easily, and I was providing feedback to the effect that right now, for me (data point of one) it’s not. But since it might have gotten lost in this text-based medium, I’ll be explicit: I very much appreciate your assistance, and any “negative feedback” I provided was only to suggest an avenue for improving the program, no in any way to be unappreciative.

The “Scriptables” are a new feature (and still under development). They are only available in very recent versions of Audacity (sorry, I don’t recall exactly when they were introduced - possible 2.3.0).

Me too, hence the smilies :wink:
Feedback is very much appreciated.

I think that for the vast majority of Audacity users, the exact track length is not particularly important. Out of the 50,000+ forum topics, there have been very few requests for text output of track lengths.

We do have some related feature requests logged:

Other analytical/statistical ability:

Track sample data: > headroom to dBFS (audio level), peak minimum and maximum sample, RMS volume, replay gain etc. see SF, Wavelab, Cool Edit etc. over an arbitrary length of audio, even the whole file. (8 votes)

Allow export selected audio and/or Export Multiple to name files with start and length (or end) of the selection (1 votes 02May17)

Permanent indication of/add box for total length of project: (6 votes)

  • This should be “end-time” minus “start-time”, so ignoring white space at the start (1 votes)
  • Show project length when Length button is selected with no region selected (1 votes)

Separate time displays for End and Length Very useful to see both at the same time(2 votes)

The feature request page is here: Missing features - Audacity Support
If you would like to “vote” for any of these features, or would like your suggestion to be logged as a separate item, then I’d be happy to log that for you. If the latter (separate item), please suggest wording to make it clearly distinct from the current suggestions.

And please note that as a relatively new feature, the Selection Bar now has options:

  • Start and End of selection: the start time and the end time of your selection (default setting)
  • Start and Length of selection: the start time and the length of your selection
  • Length and End of selection: the length and the end time of your selection
  • Length and Center of selection: the length and the time at the center of your selection

(Selection Toolbar - Audacity Manual)

Thanks again!

I do realize that this is only a concern for the subset of Audacity users who use the tool for presentations, and I have no idea how big that subset is; I just know that this feature would be very useful to that subset. My hope was that even if that subset was relatively small, the easy of implementation might help justify making the (hopefully small) effort to support them … but I completely understand if it isn’t.

I tried searching the feature request page but couldn’t find anything except for:

  • Import/Export of envelope points: as XML file

  • Import/Export playlist file like M3U/PLS

… and I don’t think either of those would output the necessary information (but they might)?

I hate to make someone else do work for me, but strangely even though that page is a wiki I can’t just sign up for an account (even with a CAPTCHA or something), so I guess I have to ask you to edit it for me? Could you please add the following bullet point to the end of “Other Import/Exports”:

Ability to export track length data as a text file (or even just as copy/paste-able text in a dialog). > Use Case/Rationale: > Audacity users who build presentations (where each track corresponds to a particular slide or other visualization in the presentation) need to know the length (and/or the exact start/end time) of each track, and the only way to get this information currently is to hand type it after selecting each track individually.

Also, if I could make just one more suggestion, if you want feature requests submitted some other way (eg. via the page you linked … although it’s not editable so I don’t know how anyone could request a feature there) it might make sense to link to it on this page: Missing features - Audacity Support … along with some text to the effect of “maybe you don’t want to be here at all, maybe you want to go request a feature”.

And one more time, just for good measure … thanks for taking the time to help me with this “ticket”!

That could be done quite easily with a Nyquist plug-in, though it would require a fairly recent version of Audacity.
I’m not sure if your version will be new enough, but you can try this “proof of concept” code in the Nyquist Prompt effect.
If the debug window does not open automatically in your version, try using the Debug button.

;nyquist plug-in
;version 4
;type analyze
;debugflags trace

(setf *float-format* "%.2f")

(format t "~s   Start: ~a   End: ~a   Length: ~a~%"
        (get '*track* 'name)
        (get '*track* 'start-time)
        (get '*track* 'end-time)
        (- (get '*track* 'end-time)(get '*track* 'start-time)))

A workaround would be to

  1. Select each track in turn
  2. Label each selected track in turn with a clear identifiable label
  3. Use File > Export > Export Labels… This will list out the start and end times of each track
  4. import the label text file into Excel
  5. add a simple formula to calculate the length

See: https://manual.audacityteam.org/man/file_menu_export.html#export_labels

Feature Request: it would be cute if the Export Labels calculated the length and listed that too


I’d guess a fairly small subset. Because Audacity is such a versatile application, there are many, widely differing subsets (or as we tend to call them: “use cases”).

One of my favourite features in Audacity is that it has a built-in scripting language called “Nyquist”. Although only a small subset of users are likely to use Nyquist directly, indirectly it is one of the most widely used features. Nyquist is an interpreted language that runs straight from the plain text code (no need to compile), and with the addition of some special “header” comments, can be used by Audacity as “plug-ins”.

Audacity ships with quite a few Nyquist plug-ins. In the Effect menu, the effects listed at the bottom (Adjustable Fade, Clip Fix, Crossfade Clips, …) are Nyquist plug-ins. There are also a large number of optional plug-ins available, many of which were written to provide functionality required by subsets of Audacity users: Missing features - Audacity Support

Plug-ins are a very good way of providing functionality that is required only by a subset of users, as it avoids adding “clutter” for other users. It would be nice if installing Nyquist plug-ins was easier, but we’re working on that.

Perhaps won’t need to if we can provide a plug-in to do the job.

Originally the Audacity wiki was like Wikipedia in that anyone could set up an account and post directly to the wiki. To combat spam, restrictions on accounts were progressively increased, but even when manually verifying that user accounts were genuine, a lot of what was being posted was written so badly that it was often incomprehensible. We do not have the resources to adequately monitor, edit, rewrite submissions to a public wiki, so it is now available as a read-only addition to the manual. There is still a huge amount of cruft in the wiki that needs updating / revising / deleting, but the priority for the documentation crew is to keep the manual up to date.

Our preferred way for Audacity users to submit feature request is via this forum. This allows Audacity users to comment and discuss feature requests before they are transferred to the wiki. A large number of requested features are for things that Audacity already has, so feature requests sometimes mutate into a discussion about how to improve an existing feature.

Thanks for the link. That’s a pretty old page, and it has a note at the top for wiki editors, indicating that it needs some TLC. I’ve put that on my to-do list.

You’re very welcome. Thank you for your feedback, and my apologies if my initial reply appeared dismissive - that wasn’t the intention, but even emojis are limited in their ability to express mood :wink:

I’d be interested in your feedback on the Nyquist code that I posted - if it works for you, then I’d be happy to turn it into an installable plug-in and post it to the wiki plug-ins page so that it is available for everyone.

I tried running the Nyquist code and it only generated the following output:

“Slide 32” Start: 1191.40 End: 1199.89 Length: 8.49

… because I only had my last track selected :blush: . But then I selected everything and got:

“Slide 1” Start: 0.00 End: 6.99 Length: 6.99
“Slide 2” Start: 6.99 End: 47.19 Length: 40.19
“Slide 3” Start: 47.19 End: 86.37 Length: 39.19
“Slide 4” Start: 86.37 End: 122.04 Length: 35.67
“Slide 5” Start: 122.04 End: 174.64 Length: 52.60
“Slide 6” Start: 174.64 End: 215.86 Length: 41.23
“Slide 7” Start: 215.86 End: 264.41 Length: 48.55
“Slide 8” Start: 264.41 End: 292.15 Length: 27.74
“Slide 9” Start: 292.15 End: 331.60 Length: 39.46
“Audio Track” Start: 331.60 End: 369.20 Length: 37.60
“Slide 11” Start: 369.20 End: 415.48 Length: 46.28
“Slide 12” Start: 415.48 End: 434.96 Length: 19.48
“Slide 13” Start: 434.96 End: 470.65 Length: 35.69
“Slide 14” Start: 470.65 End: 502.44 Length: 31.80
“Slide 15” Start: 502.44 End: 565.67 Length: 63.23
“Slide 16” Start: 565.67 End: 616.52 Length: 50.85
“Slide 17” Start: 616.52 End: 662.71 Length: 46.19
“Slide 18” Start: 662.71 End: 713.50 Length: 50.79
“Slide 19” Start: 713.50 End: 771.29 Length: 57.80
“Slide 20” Start: 771.29 End: 815.28 Length: 43.99
“Slide 21” Start: 815.28 End: 832.00 Length: 16.72
“Sldie 22” Start: 832.00 End: 872.61 Length: 40.61
“Audio Track” Start: 872.61 End: 907.92 Length: 35.31
“Slide 24” Start: 907.92 End: 959.41 Length: 51.49
“Slide 25” Start: 959.41 End: 990.04 Length: 30.63
“Slide 26” Start: 990.04 End: 1016.58 Length: 26.53
“Slide 27” Start: 1016.58 End: 1069.26 Length: 52.68
“Slide 28” Start: 1069.26 End: 1100.25 Length: 30.99
“Slide 29” Start: 1100.25 End: 1119.08 Length: 18.83
“Slide 30” Start: 1119.08 End: 1158.32 Length: 39.24
“Slide 31” Start: 1158.32 End: 1191.40 Length: 33.08
“Slide 32” Start: 1191.40 End: 1199.89 Length: 8.49


Thanks a ton!

I think the idea of making a plug-in out of that would be a perfect solution. It would give presenters exactly what they need, while keeping it out of the way of most users. My one suggestion would be that it would be ideal if the plug-in could somehow have UI which let you pick which values to output, and possibly also a way to define how you want them separated.

Personally all I really need is the lengths, ie.:


Which I got by tweaking your code slightly to be:

(format t "~a~%"
        (- (get '*track* 'end-time)(get '*track* 'start-time)))

But someone else might well need:

“Slide 1”, 0.00, 6.99
“Slide 2”, 6.99, 47.19
“Slide 3” , 47.19, 86.37

or whatever, so even a simple UI could make the plug-in useful to a lot more people.

Thanks again. I am just starting work on a new class, which I expect to have 32 (8 weeks/quarter X 4 videos a week) projects that need this. Plus I revise my existing course every so often and need to recalculate these times for certain lessons as well.

Having this code will save me a ton of time: you rock!

OK, so here’s a plug-in version for you to try.

Full functionality requires Audacity 2.3.0 or later, but it should still be usable in any version of Audacity from 2.2.0 onwards.
In versions of Audacity earlier than 2.3.0, output to file is not supported, but everything else should work.

There’s no documentation as yet, but given our discussions to date, I think it should be quite easy to work out.
If you have time to thoroughly test all available features, that would be a big help towards releasing it on the Audacity wiki plug-ins page.

Installation instructions for Nyquist plug-in on Linux are here: https://manual.audacityteam.org/man/installing_effect_generator_and_analyzer_plug_ins_on_linux.html#nyquist_install
When correctly installed, it will appear in the Analyze menu.

And here’s the plug-in:
trackinfo.ny (5.35 KB)