Export of Track Lengths

Anything you think is missing, or needs enhancement, goes here.
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
steve
Site Admin
Posts: 80693
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Export of Track Lengths

Post by steve » Wed May 01, 2019 9:59 am

machineghost wrote:
Tue Apr 30, 2019 7:02 pm
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'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: https://wiki.audacityteam.org/wiki/Down ... t_Plug-ins

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.
machineghost wrote:
Tue Apr 30, 2019 7:02 pm
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.
Perhaps won't need to if we can provide a plug-in to do the job.
machineghost wrote:
Tue Apr 30, 2019 7:02 pm
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
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.
machineghost wrote:
Tue Apr 30, 2019 7:02 pm
it might make sense to link to it on this page: https://wiki.audacityteam.org/wiki/Reporting_Bugs
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.
machineghost wrote:
Tue Apr 30, 2019 7:02 pm
And one more time, just for good measure ... thanks for taking the time to help me with this "ticket"!
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 ;)

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

machineghost
Posts: 67
Joined: Wed Sep 05, 2018 5:00 pm
Operating System: Linux *buntu

Re: Export of Track Lengths

Post by machineghost » Wed May 01, 2019 10:26 pm

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 :oops: . 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
Victory!!!!

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.:
39.24
33.08
8.49
Which I got by tweaking your code slightly to be:

Code: Select all

(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!

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

Re: Export of Track Lengths

Post by steve » Fri May 03, 2019 12:05 am

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/ins ... st_install
When correctly installed, it will appear in the Analyze menu.

And here's the plug-in:
trackinfo.ny
(5.35 KiB) Downloaded 31 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply