Remote turntable control

Hello and thanks for all the good work.

I have a turntable to which I can control START/STOP via a shell command which activates an USB relay.
I’m looking for a way to use this with audacity, ie when I press ‘record’, the table would start playing, and when I stop recording it would stop.

Do you know of a way to do this ? Can a python script receive ‘recording’ or ‘stop’ events so I could have it command the relay ?
I found out how to send commands to audacity, not to get events notification and do actions accordingly.

Thanks

No, but if you have a recent version of Audacity, and if it has been built with mod-script-pipe (for scripting support), then Python can “send” recording and stop commands to Audacity. You could write a Python script to activate your relay, and then start Audacity recording.
See: Scripting - Audacity Manual

Thanks for this quick reply
Yes that makes sense, I will try doing 2 scripts which do “START turntable” + “start recording in audacity”, and “stop recording in audacity” + “STOP turntable”
Last question, is there a way to trigger such scripts straight from Audacity UI ? By assigning it to a custom button/macro/shortcut ?

Thanks

Not at present.

Strangely enough, there was a discussion just yesterday on the developer’s mailing list regarding the feasibility and security considerations of allowing Nyquist plug-ins to access system commands (such as running external scripts). As yet, no decision has been made, but I suspect that the security risks will outweigh the potential benefits.

You could of course give your Python script a simple GUI (for example with Tkinter) and/or a Desktop / Apps menu launcher.

Oh I didnt know that nyquist plugins could be used for general purpose plugins apart from audio filters.
At least as I understood they can read/write files, so I could use a watched file or fifo to allow communication with an external script.
But doing a dedicated external UI will be indeed way easier. Thanks.

Nyquist now has access to the “scripting commands”, which has greatly extended what it can do. There are however a couple of important limitations:

  1. You cannot modify a project with Nyquist, and with an Audacity scripting command, from the same Nyquist plug-in. You can modify the project with Nyquist, OR, from an Audacity scripting command.
  2. You cannot call a Nyquist plug-in from Nyquist. There can only ever be one instance of Nyquist running at a time.

Some examples of Nyquist plug-ins that are not “filters” of any kind:
https://manual.audacityteam.org/man/sample_data_export.html
https://manual.audacityteam.org/man/sample_data_import.html
https://manual.audacityteam.org/man/silence_finder.html
https://manual.audacityteam.org/man/sound_finder.html
Nyquist Plugin Installer - Audacity Manual (this one has nothing to do with audio at all).