Looking for a good way to write a program to control record times.

In short, after Audacity is open:

Create a track and set it to record.
Create a label track and create a label.
Pull the next label text from a file and write it to the label.
After one hour, close the track and save the audio file.

Only one audio file will be created every weekend. It will contain 48 one-hour tracks.

I am looking into a script and using python but any reference I find seems overly complicated for this use. Is this still be best way to do this of is there another way. If it is the best way, I will continue trying to et it working.
Win 10, Audacity 2.4.2

any reference I find seems overly complicated for this use.

A non-developer will think so, but programming also has to deal with trash collection and error trapping. What happens if the program goes for label text and there isn’t one? What happens if there’s a temporary interruption in the show stream?

Macro instructions typically can’t make branching decisions. There is no IF this condition, THEN do something. That puts you right in real programming and simple code won’t do it. The above example is actually more complex. IF this condition, THEN do something, ELSE do something different. If you have three or four of those, the program goes into pages of branches and decisions. And all this is based on the assumption of a properly operating and stable system.

It will contain 48 one-hour tracks.

Audacity doesn’t make a very good surveillance recorder and one reason for that is an inability to gracefully deal with large files. The older Audacity used to poop out at 13 hours. The limit is higher now, but still, a 48-hour stereo sound file is going to be enormous. 30.48GB at perfect quality WAV. Plus WAV poops out at 4GB, and in some cases 2GB.

Many design decisions.

Why are we doing this?


You missed my point on what I am finding as complicated. I can handle the coding. The problem is in the instructions to get the setup in place. Too much is presumed. It is the common problem when directions are written by the experienced and not verified through new people to the situation.

I am aware of the potential problems with huge files. I have been recording 24 hour tracks for over 5 years now. Problems are few and far between and rarely any real issue.

As it is right now, I have to be at the computer at 3am to enable the second session. My hope is to automate that and possibly break the recordings down to usable 1 hour tracks.

If it’s a surveillance task, there are programs specifically for that …
(not tried that particular program myself though).

Here is my latest development.
Here is my problem:
I can use this program to start recording but when I add a label, it gets added but the recording stops.
Why is that?
Is there a fix?
RecordTest.py.txt (2.49 KB)

Why is that?

If you’re doing this in Macro language, it’s because a Macro is a single thread. It’s do this and stop. Not do this and while that’s going, do something else. Alternately, if you do get that to work, it won’t stop.

It sounds like you need Python or one of the other actual programming languages. And as Trebor above, by the time you get that far, you’re far further ahead with an actual surveillance recorder designed to do this.


I am using python and pipe_test.py as shown in the attachment.

Scripting commands are in most cases very similar to normal keyboard commands, though in some cases there are some subtle differences. One of those differences is apparent here.

What you need to do is to complete the recording first, and then add the labels at the required places.

If you want to add labels interactively during the recording (as in your Tk script), then rather than using Python, you can simply move focus to the Audacity window and use the normal keyboard shortcut “Ctrl + M”. Alternatively, if you need to use Python rather than the normal shortcuts, you could add the label time to a list, then when the recording stops, create a label at each time in the list.

In the next Audacity release, it will be possible to add the labels during recording with the “AddLabelPlaying:” command, but you will still need to wait until the recording is stopped before you can add the label text.