Macros (formerly known as Chains) let you chain together multiple commands to automate repetitive tasks.
You can apply any of the existing macros using the Macros Palette. To open it you can either:
Use the menu Tools > Apply Macros > Palette, or
Use the Shrink button in the Manage Macros dialog
Once invoked, the Macros Palette window will remain on-screen, actively available, at all times unless and until you dismiss it or close Audacity.
In the "Macro" list, left-click on a Macro (or use Up or Down keyboard arrow) to select the Macro you want to apply.
Use the Project button to apply the selected Macro to the current project.
The typical purpose of this option is effect automation - apply a sequence of effects to the project, using effect parameters and an order of applying the effects that you have found to work well for the type of audio you are processing. This saves time and provides consistency in your workflow.
The effects in the Macro are applied to the selected region of waveform in the selected audio tracks. Usually the selected Macro would not include an export command so as to use the greater flexibility of the Export Audio Dialog.
If an export command is included in the Macro, the entire project audio is exported irrespective of track or region selection. Therefore if the project contains multiple audio tracks, they will be mixed together, unless any of the tracks are muted on the Track Control Panel.
If the project has been Saved, then the exported files will be saved in a folder named macro-output. The macro-output folder will be in the location specified in Directories Preferences.
If the audio in the project came from an imported file as its initial step (that is, it is a named project), the macro-output folder will also be in the location specified in Directories Preferences.
If the project has not been saved and is un-named, the normal Export Audio dialog will appear enabling you to choose the name and location of the exported file.
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).
The typical purpose of this option is batch processing - apply the Macro to multiple audio files so as to apply one or more effects to them, and/or convert them to another file format. You can convert from any file format supported by Audacity to WAV, MP3, OGG or FLAC.
Use the Files... button to apply the selected Macro to selected external audio files that are in a single directory.
If you already have audio in the current project window, you must save and close that project using File > Close before applying a Macro to files.
You cannot apply a Macro to multiple Audacity AUP3 project files, instead you need to use Python scripting.
The selected Macro must include an Export step, otherwise the processed audio will not be retained.
You cannot process multi-channel audio files (for example, 5.1 surround sound files) using Macros, even if Import / Export Preferences has been set to "Use custom mix". Any multi-channel files you import will be mixed down on export.
A standard File Open dialog box will appear. Choose a directory then you can select one or any number of supported audio files in that directory, including older AUP project files (but not AUP3 project files).
You cannot select files outside that directory, and files in folders inside that directory will not be processed.
It is convenient therefore to first put all the audio files you want to process into one folder before applying the Macro.
After selecting the audio files you want to process, choose Open.
Each file will be imported into Audacity and processed, exported to the format you chose in the Macro, then the processed audio will be removed so as to clear the temporary disk space that had been used.
The exported files will be saved in a folder named "macro-output" in the folder specified in the Macro output field in Directories Preferences. The original files are not altered.
If you leave the entry for Macro output blank in Directories Preferences then Audacity will default to creating a folder called "macro-output" in:
Windows: C:\Users\<your username>\Documents\Audacity
Mac: /Users/<your username>/Documents
Linux: /home/<your username>/Documents
When a Macro is applied to files, the only option is to import and process the entire file. Thus the entire file will be exported unless an action or effect in the Macro (such as Cut or Truncate Silence) removes some audio.
If modifying the audio before exporting, the Select Time function may be useful to select audio to remove or modify.
Some optional Nyquist plugins have parameters to trim or extend audio by a specific length and Nyquist can do calculations too, so it may be helpful to use Nyquist plugins from within a macro.
It is recommended not to process more than 500 files at a time.
Use the Expand to return to the full-size, full-function Manage Macros dialog.
The apply Macro buttons are also available on the Manage Macros dialog - so all Macro operations can be made from that full dialog.
To dismiss the dialog simply click on the Cancel button
Otherwise the dialog will remain open on the screen, but allowing you to perform other Audacity functions.
Manage Macros allows you to edit, remove or rename existing Macros or add a new Macro. It also allows you 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 plugins 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.
The full list of all Macro commands, with descriptions, is available at Scripting Reference.
You can access the Manage Macros dialog by using either:
The menu Tools > Manage Macros, or
The Expand button in the Macros Palette dialog.
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 built-in MP3 Conversion and Fade Ends Macros.
Use left-click (or use the Up or Down keyboard arrows) to select the Macro you want to work on
New: Adds a new Macro to the list.
Remove: Remove the selected Macro from the list - grayed out when the Macros that ship as part of Audacity are selected.
Rename...: Rename the selected Macro - grayed out when the Macros that ship as part of Audacity are selected.
Restore: Resets any Audacity provided Macro to its default settings - grayed out when user-provided Macros are selected.
Import...: Enables you to import a Macro from a TXT file.
Export: Exports the selected Macro to a TXT file.
Edit Steps lists the sequence of commands in order of first to last (End) for the Macro selected in the Select Macro 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).
The Export command will use the settings you used the last time you used the same command from the File > Export > Export... menu command, or default settings if you have never used that command from the menu.
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
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
Save: This button is only active when you have made edits to a Macro. It enables you to save those changes.
You can also edit an existing command by double-clicking it, or using the Up or Down keyboard arrow to select it and then pressing Space. The parameter settings dialog for that command will be displayed.
A few commands are intentionally omitted from the Macro Manager (such as Close:) because they are unsuitable for use in Macros.
To insert a new command in a Macro, left-click or use the Up or Down keyboard arrow to select an existing command and then press Insert. The new command will be placed above this selected command.
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.
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:
Extra Menu: Scriptables I - most commonly useful scriptables.
Extra Menu: Scriptables II - less commonly useful scriptables, but also including Select and Set Track, which combine functionality of several scriptables.
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.
It is strongly recommended that you set parameters for the commands that you use in a Macro. Otherwise Audacity will use the last-used parameter setting(s) when you ran the effect(s) manually.
Also note carefully that settings used in Macros will not affect or change the last-used parameter settings for any effect when next run manually.
This example shows the Set Track Status command.
The tick boxes on the left determines whether a feature should be used. When not selected, that feature does nothing.
The second tick box determines whether the feature is set to "on" or "off".
This shows:
The track name will not be changed
Track selectedness will be set to Not Selected
Track focus will be set to Focused
Commands that call Effects, Generators, Analyzers or Tools, use the same familiar graphical interface (GUI) as appears when they are used from the normal top level menus.
Many of the other commands provide a simple GUI comprised of checkboxes and text entry boxes. Typical examples can be seen in the Scriptables I and Scriptables II menus.
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
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, maintaining your current time selection, use "Select: First=0 Last=100". It will not waste time twiddling its thumbs on the tracks that are not there.
When applying a Macro to files there is no pre-existing selection so you will need to create a selection in the Macro if your Macro requires audio to be selected to act on (and most Macros do).
There are four basic export commands available: Export as WAV, Export as MP3, Export as FLAC and Export as Ogg.
See Macros Palette for details of naming and location of exported files.
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.
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.
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 editing the Macro
When entering the pathing data in the edit parameters dialog for the command you do not put the quote marks for example: C:\Users\<username>\Desktop\my file.flac
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.
Comments be added to Macros to enable you to document what is happening in the Macro.
Add a comment to your macro using the Comment command and edit its parameters to type the text of your comment.
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 enables you to make a Macro operate on either your current open Project or a set of selected external Files.
It is recommended not to process more than 500 files at a time
See Macros Palette for details of how these two buttons operate.
To dismiss the dialog simply click on the Close button.
If there any unsaved changes you will be asked if you want to save them or not.
See the Macros Examples page for examples of using Macros.
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 plugins 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 plugins 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 plugins and that the plugins 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.
This page provides some examples of how the Macros feature in Audacity can be used.
A batch processing Macro to compress and normalize WAV files then convert them to MP3:
Insert Compressor to reduce the dynamic range of each WAV, also normalizing them to maximum amplitude of 0 dB
Insert Export as MP3 to convert them to MP3 format
Click Apply Macro to: Files... to select the files on which to run the Macro.
Click OK to close the Manage Macros window
Alternatively you can choose Tools > Apply Macro..., select the Loud MP3 Macro then click Apply Macro to: Files... where you can select the files on which to run the Macro
An effects automation Macro for the current project that applies noise reduction and equalization:
Insert Normalize with settings of:
Remove any DC offset
-10 dB (to allow for boosting frequencies later in the Macro without clipping)
Insert Noise Reduction
Insert Filter Curve EQ (to perform the frequency adjustment)
Insert another Normalize at different settings (without offset removal, setting a final amplitude of -1 dB)
Click OK to close the Manage Macros window
When later needed in your workflow, choose Tools > Apply Macro..., select the NR&EQ Macro then click Apply Macro to: Project to apply the Macro to the selected track(s) in the current project window.
If a Noise Profile exists, that Noise Profile will be used. It is often best to capture a suitable Noise Profile before running a Macro.
If a Noise Profile does not exist:
If the Macro is applied to the current project (as above), the current selection is used to create the Noise Profile. Therefore, other effect commands in the Macro will also only apply to that selection. If an export command is added, the entire file will be exported.
If the Macro is applied to files, the first file (all of it) is used to create the Noise Profile. It may be useful to prepare a file containing a suitable Noise Profile and name it so that it is alphabetically the first file of those to be run in the Macro.
The Select command with 'Relative To=Selection' can be used to extend and contract a selection.
Command: "Select: RelativeTo=Selection Start=-1 End=1" Description: This command expands a selection by two seconds
Command: "Select: RelativeTo=Selection Start=1 End=-1" Description: This command contracts a selection by two seconds
Command: "Select: RelativeTo=Selection Start=1 End=1" Description: This command moves a selection right by one second
Command: "SelTrackStartToEnd" Description: This command (from Select > Region > Track Start to End) Selects all audio in all selected tracks.
Command: "SelNextClip" and "SelPrevClip" Description: These commands are useful with Clips
This Macro takes a single mono track, and converts it to a stereo track, with one channel a spectrogram and the other a wave.
It is one example of how to creatively abuse the Macro system, since audacity is not set up to handle mixed views on wave tracks.
Note the use of a TrackCount of 0.5 to select just one of two channels in a stereo track.
The TrackCount of 0 is used to unselect all tracks.
With normal project rate of 44100Hz, this selects about 126 samples centered on the cursor, and applies the 'Repair' effect to it. 'Repair' can only handle up to 128 samples.