Manage Macros

From Audacity Development Manual
Jump to: navigation, search
.
Manage Macros allows you to edit, remove or rename existing Macros or add a new Macro and to apply Macros to you project or a set of files. Any built-in, LADSPA, LV2, Nyquist, VST or Audio Unit (Mac) effect shown in the Effect Menu can be added to a Macro. You can also add plug-ins in any format that are shown in the Generate or Analyze Menus (including Vamp analysis effects), the built-in Find Clipping analyzer and a number of export commands.

Macros may be applied to either the entirety of the current project or to a selection of files using the Tools > Macros... command.

It is possible to use Noise Reduction in Macros but see Noise Reduction Tips for how the Noise Profile is captured.

Contents

  1. Accessing Macros
  2. Select a Macro
  3. Edit Steps in the Macro
    1. Command
    2. Editing an existing command
    3. Export commands
    4. Deprecated Export commands
  4. Shrink - reduced Macros Palette dialog
  5. Apply Macro
  6. Cancel
  7. Where Macros are stored
  8. Macros Examples
  9. Error: Batch command not recognized


Accessing Macros

Accessed by:
ManageMacros.png


For help with what the Macro effects do and how to set their parameters, see Effect Menu


Select Macro

Select Macro contains a list of already defined Macros. You can define the name of a new Macro and select which Macro is active.

The left hand box in the dialog (labeled Select Macro) contains a list of already defined Macros. Until you add a new Macro, it only has a single built-in "MP3 Conversion" Macro. You can:

  • Use the New button to create a new Macro
  • Use left-click (or use the Up or Down keyboard arrows) to select the Macro you want to work on
  • Delete any user-added Macro with the Remove button
  • Rename any user-added Macro with the Rename button
The Remove and Rename buttons are grayed out when the Macros that ship with Audacity are selected.
  • New: Add a new Macro to the list.
  • Remove: Remove the selected Macro from the list.
  • Rename...: Rename the selected Macro.
  • Import...: not currently active
  • Export: not currently active


Edit Steps in the Macro

Edit Steps lists the sequence of commands in order of first to last (End) for the Macro selected in the "Select Macros" box to left.

  • The Macro can include a number of common Audacity functions and effects to be executed in any order you specify.
  • To create an audio file as part of the Macro process you must include an "Export" command (such as Export as WAV).
  • In many cases the parameters for each command in the Macro can be specified within the Manage Macros dialog.

You can:

  • Add or remove commands for the selected Macro
  • Change the order in which the commands execute in the Macro
  • Edit the parameters for some effects in the Macro

Command

  • Insert: Insert a new command into the list
  • Edit: Edit the parameters of the currently selected command
  • Delete: Delete the currently selected command in the list
  • Move Up: Move the currently selected command up in the list
  • Move Down: Move the currently selected command down in the list
  • Defaults: This button is only active when the Audacity supplied Macros are selected in the "Select Macros" list on the left, and will reset the Macro to its default values.

Editing an existing command

To edit an existing command double-click it, or use the Up or Down keyboard arrow to select it then press Space. The parameter settings dialog for that command will be displayed.

Inserting a new command

To insert a new command in a Macro, left-click or use the Up or Down keyboard arrow to select an existing command. The new command to be inserted will be placed above this selected command. Then press Insert.

  • The "Select Command" dialog appears, listing all the available commands. Double-click a command from the list to insert it in the "Command" box, as shown in the image below after inserting "Normalize".
Alternatively, use the Up or Down keyboard arrow to select the command, then press Space.
SelectCommand.png
 
  • The full list of all commands, with descriptions, is available at Scripting Reference.
  • Some 'scriptable' commands are particularly useful for Macros. See these pages for details:

 

  • If the command has editable parameters, the Edit Parameters button will be active. Clicking this button will bring up the dialog box for the effect where you can set the parameters as if you were applying the standalone effect.
  • If you have previously created user presets for an effect you can use the Use Preset to select one for use with that effect in the Macro.
  • Choose OK in the effect dialog to accept the parameters you entered, or Cancel to revert to the default parameters.
  • Choose OK in the "Select Command" dialog to add the command to the Macro.
Bulb icon Macros will work on pre-existing selections you make in your project prior to running the Macro. But the selection can be over-ridden by your Macro itself as there are Macro commands available to effect selections in the audio. In particular All(Select All) will select the entire project and Select which is parameterizable (see the provided Fade Ends Macro for an example where the first and last one seconds of the audio are selected for the fades).
  • If you want to select all tracks, and maintaining your current time selection, use "Select: First=0 Last=100". It won't waste time twiddling its thumbs on the tracks that are not there.

Export commands

  • There are four basic export commands available: Export as WAV, Export as MP3, Export as FLAC and Export as Ogg.
    • See Apply Macro for details of naming and location of exported files.
Warning icon Parameters for export formats cannot be set in "Manage Macros". To configure export parameters for the Macro, click File > Export > Export Audio... to access the Export Audio Dialog, click Options, set the parameters, press OK then Cancel the export. An audio track must be on screen in order to open the Export Audio Dialog.

Special Export command

  • Export2: there is also a special Export command Export2 which enables you to export to a specific target file and format. When using Export2 you have to give the full file name (including path and filename extension).

    Note carefully that the filename is not dynamically changeable when running the Macro, once set in the Export2 parameters, so you may wish to create several Macros the Export2 each targeting different file locations, names and filetype.

Bulb icon

Example: "C:\Users\<username>\Desktop\my file.flac" (this works)

Not: C:\Users\<username>\Desktop\my file.flac (the file name is not quoted)

Not: "my file.flac" (no path given)

Not: "C:\Users\<username>\Desktop\myfile" (no file extension)

The quote marks around the file pathing are supplied by Audacity once the Export2 command has been edited in setting up or edoting the Macro

When entering the pathing data in the edit parameters dialog for the command you don't put the quote marks i.e. C:\Users\<username>\Desktop\my file.flac

Deprecated Export commands

The following two commands are now deprecated and may well be removed in future versions of Audacity. They were part of "CleanSpeech" (which has long been removed from Audacity).

  • The Export as MP3 56k before and Export as MP3 56k after commands can be used respectively to export "before" and "after" MP3 files at 56 kbps bit rate at any point in the Macro processing. This allows you to compare the result of one or more effects, or provide files for different purposes with and without a particular effect.
    • The name of the MP3 exported by the "Export as MP3 56k before" command is prefixed by "MasterBefore_" followed by the date and time. The name of the MP3 exported by the "Export as MP3 56k after" command is prefixed by "MasterAfter_" followed by the date and time.


Shrink - reduced Macros Palette dialog

Use the Shrink button to show a reduced Macros Palette dialog with a simple list of the existing Macros, enabling you to apply the Macros but not edit them.

This smaller version is useful for presets. It stays open after applying a macro, so it is a palette of custom functions, and you can pick another and apply that.

Using the Expand button on this reduced dialog will return you to the full Manage Macros dialog.

For more details see the Macros Palette page.


Apply Macro to

Apply Macro to enables you to make a Macro operate on either your current open project, or a set of selected external files.

See Macros Palette for details of how these two buttons operate.


Cancel to exit the dialog

The dialog will remain open on the screen, but allowing you to perform other Audacity functions.

To dismiss the dialog simply click on the Cancel button


Where Macros are stored

Each Macro is automatically saved as a separate text file with TXT extension in the "Macros" folder in Audacity's folder for application data:

  • Windows: Users\<username>\AppData\Roaming\audacity\Macros
  • Mac: ~/Library/Application Support/audacity/Macros
  • Linux: ~/.audacity-data/Macros
Bulb icon In order to see the Macros folder on Windows, macOS or GNU/Linux, you must show hidden files and folders or type the folder location into your file manager's address bar.

  • Windows: In the tree on the left of Explorer, double-click "Users" then double-click your username, then on the right, double-click the AppData or Application Data folder and navigate through that. If necessary, show hidden files and folders on Windows or type %appdata%\audacity\Macros or shell:appdata\audacity\Macros into the Explorer address bar then press Enter on your keyboard.

  • macOS: Open Finder, use the Go menu, choose Go to Folder and type ~/Library/Application Support/audacity/Macros, or set Finder to show your User Library folder.

Sharing a Macro

You can copy a Macro from your Macros folder and send it to another user, or to copy another user's Macro into your Macros folder so as to add to your own list of Macros. An updated list of Macros will be available next time you open "Manage Macros" in Audacity.

You can also edit your Macros using copy and paste between them.

Bulb icon Comments in Macros: since Macros just ignore invalid commands you can edit your TXT Macros to add comments.

We suggest using the # character to start your comment lines: "# this is my comment ..."


Macros Examples

See the Macros Examples page for examples of using Macros.


Error: Batch command not recognized

This error may sometimes occur for one or more commands in a Macro when updating from a previous Audacity version. The error may also occur if users sharing Macro have different Audacity versions or different versions of the plug-ins used in the Macro. The error will occur if:
  • any command in the Macro uses a different text format than that recognized by the version of Audacity in use
  • any plug-ins listed in the Macro are missing, in an incorrect location or are incompatible with the version of Audacity in use.
To resolve these errors, ensure you have compatible versions of all required plug-ins and that the plug-ins are installed correctly. If necessary, use the "Manage Macros" dialog to delete the command that fails then insert a replacement command for the same effect from the "Select Command" dialog.


<  Back to: Macros