Stop recording with a macro

Seems that macros cannot be activated when recording is active. I would like to have a button assigned to a macro. Macro would the stop recording and save the result. How to do that?

Audacity 2.3.0 and Windows 10.
Macro and recording.jpg

When would it stop and save the result?

To stop recording on a key press, use Space to stop the recording.

To stop recording after a specified length of time could be done with AutoHotkey or similar. This can’t be done with a macro because there isn’t a timer for macros.

Of course stop and save can be done with two key presses, one for stop and second for save.
What I am after is to do these two with one key press only. Only problem is that macro cannot be activated during recording.

That is correct.

Sounds like that is a feature and not a bug. Could you explain why macros are disabled?

Most things are disabled during recording - recording is seen as a critical non-interruptable activity in Audacity.


This is understandable and acceptable. Would be nice to have a possibility to automate some actions connected to stop recording, though.

There are three forms of scripting (automation) in Audacity:

  1. “Macros” are the simplest, but also the most limited.
    A Macro is a simple list of commands that run from the top of the list to the bottom of the list.
  2. “Nyquist Macros” are a more advanced / more powerful form of scripting (
    An important limitation of Nyquist Macros is that it is not currently possible for a Nyquist Macro to apply Nyquist effects. If you need to mix Audacity commands with Nyquist commands, then you either need to use a normal “Macro”, or “mod-script-pipe”.
  3. The third, and most powerful form of scripting, is to use an external scripting language such as Python to control Audacity via “mod-script-pipe”.
    Mod-script-pipe is not yet shipped with Audacity, and has to be built from the source code along with building Audacity from the source code. This complication rules out mod-script-pipe as an option for most users, but hopefully mod-script-pipe will become available as a standard part of Audacity in the near future.

Stopping a recording with a script can only be done in the 3rd (most powerful) form of scripting,with “mod-script-pipe”.

Building in Windows to enable mod-script-pipe seems to be relatively straightforward.
However, would be nice to see some documentation before doing that. Documentation page for that is currently not working.

Would it be possible to activate a python script during recording with one key press? That script would stop recording and save the result.

The page addresses are case sensitive: Scripting - Audacity Manual

Probably easiest to do that with something like AutoHotKey, as that supports global shortcuts (meaning that the Python script would not need to be running or even have focus when you press the key.)

I just used the link here:

Good catch Jutzi

I just fixed those links in the Audacity Wiki

But you’d find it easier to go straight to the Manual, on the front page you will find an entry for Scripting

**Update:**And I just updated the alpha Manual for the upcoming 2.3.1 to put the Scripting entry on its own bulleted line to give it more “discoverability”.