API Like Control File and Support Option

I’ve been reading various posts etc. regarding controlling Audacity and really nobody has asked for a simple and direct solution that would allow other programs to control Audacity.

What I’m proposing is quite simple. (we can refine with discussion)

Add following options to Audacity :
o Option to define a directory and control file name, e.g. c:\audacity\audacity.ctrl
o Option to enable / disable control file monitoring and execution events
o Option to set a polling interval to the control file

I think you can guess where this is going

Audacity will only ever access the control file in read only mode (this will help reduce/stop privilege access issues)

Another program can now create and write to the control file.

The control file is basic and simple and really just a control button file. The user will have to manual setup Audacity to their input source, file formats, sampling rates, etc etc.

Control file would basically have: (or similar to be discussed)

ADC_FUNC=REC_START
or
ADC_FUNC=REC_PAUSE
or
ADC_FUNC=REC_STOP
or
ADC_FILE=file name specification

Such a simple control interface would allow any external program give basic and simple commands to Audacity.

To scope this I would like to mention, for example, my Scan125 Control Program

https://www.nick-bailey.co.uk/scan125/index.html

If you look at one of the main screen display shots then there is a recording group at the bottom with simple buttons. User can option set in the program what the file name will be. Also some record setting for Pause (pauses when squelch is closed), Split (changes file name on different frequency) and Record (automatically start/stop recording on signal reception). This is WAV only.

Scan125 could easily write to the Audacity Control File as could any other program.

I appreciate that this solution is “crude” but often people only want a crude and simple solution. I want Audacity to do what is does best and other programs to do what they do best.

In my case I write programs to control communications receivers. So for example on a yacht as sea, or just a SW listener will want to record a scheduled broadcast (be they asleep or awake). They now have the flexibility of Audacity to set the quality and recording format of their choice and other programs, scripts (python, perl, rexx, java, macros, etc. to just trigger BASIC/minimal Audacity functions.

Audacity has an API which is accessed via an optional module called “mod-script-pipe”. This module allows Audacity to be controlled by sending commands to a “named pipe” (FIFO), so it can be used with any language that supports named pipes (though primarily intended for Python.
More informations here: https://manual.audacityteam.org/man/scripting.html

Thanks Steve

I fully aware of the audacity API via the mod-scrip-pipe.

This is fine if you have a scripting language like Python already installed on your system.

In my case I develop on Visual Studio (Visual Basic) and implementing named pipes is not that easy and certainly not solution that can be easily done with portable non install applications.

For an end user of either an installed or simple portable application if they want sound recording then they will probably be willing to install Audacity. However asking them to install Audacity and then hunt down and install “mod-script-pipe” will probably not go down very well.

In my applications I use the Windows mciSendString (built in commands) and they have worked perfectly till windows 10 came along. Simple WAV record and playback for the user but certainly no frills or other audio processing stuff.

This is what has driven me to suggesting / questioning a very simple and crude alternative to commanding audacity to do something via a simple monitored text like file.

Now if there are Visual Studio VB developers out there who can implement a named pipe (not as a service) from a standalone .exe application then “I’m All Ears” and would then agree that mod-scrip-pipe would an option.

mod-script-pipe will probably be released officially with Audacity 2.3.2, though at this stage it will probably still be an optional extra. In due course it will be included as standard. I doubt there is much will among the Audacity developers to develop a second API for users that don’t like Python.

I don’t use VB, but perhaps this will help: https://support.microsoft.com/en-us/help/177696/how-to-use-named-pipes-in-a-visual-basic-32-bit-program