Export label tracks as separate files

After reading discussion “Export individual label when multiple labels in project” https://forum.audacityteam.org/t/export-individual-label-when-multiple-labels-in-project/58799/1
I’ve created a small Python GUI tool which exports label tracks as separate files to a chosen folder.
It’s more of a proof-of-concept now, but works.)

https://github.com/Winand/audacity_toolbox

A couple of problems.

The first is minor:

root.attributes('-toolwindow', True)

The “toolwindow” attribute is Windows only and throws an error on NIX platforms

_tkinter.TclError: bad attribute "-toolwindow": must be -alpha, -topmost, -zoomed, -fullscreen, or -type

The second is more problematic.
I tested (on Linux) with these labels:

0.723214	0.723214	1
2.049107	2.517857	Учёба
3.629464	4.352679	3

The problem is that

GetInfo: Type="Labels"

returns:

[ 
  [ 1,
    [ 
      [ 0.723214, 0.723214, "1" ],
      [ 2.04911, 2.51786, "Учёба      [ 3.62946, 4.35268, "3" ] ] ] ]

Note that the final double quote, close square bracket, and comma are missing from the second label.

I’ve fixed the 1st one

And yes, the second seems to be a bug in Audacity. I’ve tried to read data in binary mode

(accidently posted unfinished message)
I’ve tried to read data in binary mode and 2 chars are still missing in JSON:
b’ [ 2.04911, 2.51786, "\xd0\xa3\xd1\x87\xd1\x91\xd0\xb1\xd0\xb0 [ 3.62946, 4.35268, “3” ] ] ] ]\n’

There’s such a unicode issue in Ubuntu (Audacity 2.4.2), but not in Windows.

I did the same and came to the same conclusion.

I have an idea for a fix, but it requires modifying the Audacity source code and then building Audacity.
Are you able to build Audacity from the source code?

steve wrote:

Are you able to build Audacity from the source code?

Yesterday I installed Ubuntu 18 in Hyper-V, but it installs cmake 3.10. When I run

cmake -DCMAKE_BUILD_TYPE=Release -Daudacity_use_ffmpeg=loaded …
it complains that cmake 3.15 is needed.

Do I need Ubuntu 20 to build Audacity?

Ok, I see now:) https://forum.audacityteam.org/t/building-audacity-2-4-2-on-debian-10-with-cmake-3-18/58352/1

I’ve managed to build latest Audacity 3.0 oct 26, and “GetInfo: Type=Labels” works as expected with your sample file.

That’s good. I committed the fix last night.

Note that Audacity 3.0.0 is still “alpha” software, and there’s a BIG change in it. The alpha manual is here: https://alphamanual.audacityteam.org
Ensure that you read this page - this is the big change: https://alphamanual.audacityteam.org/man/Audacity_Projects
A list of the most serious known issues for 3.0.0 are here: https://bugzilla.audacityteam.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=DEVEL%20-%20FIX%20MADE&list_id=25467&priority=P0&priority=P1&priority=P2&query_format=advanced

I also noticed a problem with Audacity 2.4.2 from Ubuntu’s app store. It’s a snap package and temp folder is /tmp/snap.audacity/tmp which has restricted access permissions. So it’s more difficult to access audacity_script_pipe.to(from).#### files from Python script.

We’ve had multiple reports of problems with both Snapcraft and Flatpak builds of Audacity. Those builds are not made by the Audacity Team. My advice is to not use them until the package maintainers get them working properly and reliably.