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

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
Emerogork
Posts: 314
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

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

Post by Emerogork » Wed Sep 02, 2020 9:29 am

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.
repeat.

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

kozikowski
Forum Staff
Posts: 68901
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

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

Post by kozikowski » Wed Sep 02, 2020 10:19 am

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?

Koz

Emerogork
Posts: 314
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

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

Post by Emerogork » Wed Sep 02, 2020 10:36 am

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.

Trebor
Posts: 9847
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

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

Post by Trebor » Wed Sep 02, 2020 12:20 pm

If it's a surveillance task, there are programs specifically for that ...
https://www.ispyconnect.com/userguide-m ... rding.aspx
(not tried that particular program myself though).

Emerogork
Posts: 314
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

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

Post by Emerogork » Wed Sep 16, 2020 9:34 am

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?
Attachments
RecordTest.py.txt
(2.49 KiB) Downloaded 4 times

kozikowski
Forum Staff
Posts: 68901
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

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

Post by kozikowski » Wed Sep 16, 2020 10:19 am

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.

Koz

Emerogork
Posts: 314
Joined: Wed May 18, 2011 11:56 pm
Operating System: Windows 10

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

Post by Emerogork » Wed Sep 16, 2020 10:56 am

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

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

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

Post by steve » Wed Sep 16, 2020 11:01 am

Emerogork wrote:
Wed Sep 16, 2020 9:34 am
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?
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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply