Scripting Question

Hello everyone,

I’m sorry if this question is stupid because I don’t know much about how the scripting in Audacity works.
So my group and I use audacity to record our dnd sessions and I thought that it would be useful to be able to tag certain parts of the recording to come back to later. All I need from audacity is to get the current timestamp of the recording based on an input. I want to know if I can use a script as a bridge between audacity and another program that will write the timestamp to a database. Is it possible to get the current time in the recording while it is still recording? Sorry again if this is a stupid question but thanks!

Scripting control of Audacity works in the direction of:
External program → Audacity

Audacity would not need to tell a scripting language such as Python what the current time is, because Python can work that out itself.

from datetime import datetime

print(datetime.today())
# returns: 2022-06-09 10:34:38.042082

If you start the recording using Python, then you can log the time at which recording starts as a reference point for all other events in the recording.

Labels can be added during recording by sending the “AddLabelPlaying:” command from Python to Audacity.


For experimenting with Python scripting commands, I’d recommend using “pipeclient.py” interactively from the command-line. pipeclient.py can also be loaded as a module into Python to greatly simplify writing Python apps to control Audacity. See: https://github.com/audacity/audacity/blob/master/scripts/piped-work/pipeclient.py

Thanks for the helpful response! I’ll try to mess around with pipeclient.py and see what all I can do. I appreciate it.