Export to WAV command in a Macro

Windows 10 Pro - Audacity 3.0.3 64bit

Let’s see if I can explain this without sounding totally incoherent.

I have a macro that ends with the “Export WAV” command. If I use the macro directly after recording in Audacity it will: Normalize, apply Noise Gate, apply Compression, apply Loudness Normalization, Play the audio, then bring up the Export to WAV dialog box to put in a folder destination and file name. All of this works fine and gives me the finished voice audio I am looking for.

What I don’t understand is if I import a file that already has a file name and run the same Macro, it will perform all aspects of the macro except for opening the Export to WAV dialog box.

Both are voice only recordings. The only exception is one was recorded directly in Audacity and the other was imported into Audacity. The recorder I used assigns it a date and time for a file name
2021-08-09 4-26 PM.m4a. I have changed the file name to exclude the dashes and spaces. Same result.

I have even copied the file to the desktop before importing it into Audacity. It does not matter what extension the recorded file has, the end results are the same. After the macro has run, I can click File and Export to WAV and the Export to dialog box opens immediately with that file name but with the .wav extension instead of m4a. It is obvious this would not overwrite the original file since they have different extensions, so is this some type of bug?

Here is the Macro:

Normalize:ApplyGain=“1” PeakLevel=“-5” RemoveDcOffset=“1” StereoIndependent=“0”
NoiseGate:attack=“5” decay=“100” gate-freq=“0” hold=“50” level-reduction=“-60” mode=“Gate” stereo-link=“LinkStereo” threshold=“-30”
Compressor:AttackTime=“0.1” NoiseFloor=“-35” Normalize=“1” Ratio=“1.5” ReleaseTime=“1” Threshold=“-30” UsePeak=“1”
ClipFix:gain=“0” threshold=“80”
LoudnessNormalization:DualMono=“1” LUFSLevel=“-16” NormalizeTo=“0” RMSLevel=“-20” StereoIndependent=“0”

(The “Play” command before the “ExportWav” is to verify the audio is acceptable before committing to saving.)

This doesn’t ring any bells, but I know what I would try. Do this on a test file—nothing valuable.

Open a test performance file in Audacity. Delete the original file. Run the Macro. Did it succeed? Did you get different symptoms?


Does it export as WAV?

No, the macro ExportWav does not export the file. After the MACRO has run and ignored the ExportWav command, I can then click on File>Export as Wav, it will then save the file as a wav file with the original .m4a file name and the .wav extension.

Same outcome.

Another wild guess. We don’t know if the Macro is getting stuck or just going around it. Add a harmless Macro step after the export. See if the extra step executes.


I’ve tested this macro and it works for me. However, note that it does not prompt to export the WAV file - it just exports it automatically.

I’m applying the macro to the “project”.

Got It, although it is a little confusing. It will prompt you for a file name and directory when it it is recorded in Audacity and has no file name or directory, but if it already has a file name it will direct the file to the directory you have in the macro directory settings under Preferences or to the default Audacity directory if none is listed the default directories for Macros. It would be much simpler if it would just open the Export WAV Save window or show you where it is putting the file. I’m sure the powers to be have their reasoning for this. Thanks for the answer.
WAV Export Window.JPG

Is there a way to add to the macro what folder the macro is saved in? Not by adjusting the preferences each time but having that macro save to the same folder each time. That would be nice. :slight_smile:

Yes, it’s so that you can run a macro on a batch of files and automatically process them (including exporting the processed files) without manual intervention. If you had to manually click the “Save” button on every export, then it would be impossible to just leave Audacity to run the batch and come back when it had finished (because Audacity would be stuck waiting on the first “Export”).

If you want to manually select the name and / or location for the export, just leave that step out of the macro, and when “Play” has finished, manually export (You could set a keyboard shortcut for “Export as WAV” - see: https://manual.audacityteam.org/man/keyboard_preferences.html)

Do you mean:

  1. the same folder as the imported file?
  2. always export to one specific folder?

If you mean the former, I wrote a plug-in for that: https://forum.audacityteam.org/t/legacy-macro-output-folder/62096/1

If you mean the latter, that what the “Preferences > Directories” does.

I understand the first, I was the one that started the conversation which ended with you writing that plug-in. Thanks by the way, it’s working perfect.

The files are originally on a handheld recorder. They can be moved to the desktop or the folder I want the finished file in, and the use the macro with the LegacyMacroOutputFolder at the start, then move the file from the macro-output folder to the final destination. I was thinking of streamlining the process and the macro doing the complete job. To be able to set the macro(s) to write the file to specific folders when they are used instead of having to change it in preferences each time. In the parameters, you would set the folder that particular macro would write to the final folder. Then you could have several macros with their own set of instructions and write to different folders without any further (mistakes) interaction.

Sorry, just a dream I suppose. I don’t know if this could be done and probably not worth the effort for just one request. Maybe that could be a future request. I can use the current LegacyMacroOutputFolder plug-in.

Thank you Steve for all you do to make our Audacity experience more enjoyable.

Sorry, I seem to have skipped over this post!

This does seem like the most logical way.

You can do that with the “SetPreference:” Macro command.
The command takes two parameters:



For the “Value”, you must use a “fully qualified path”.
I’m on Linux and I’m not sure if, on Windows, you need to use forward slashes or double back-slashes. I think either will work.


SetPreference: Name="Directories/MacrosOut/Default" Value="C:\\Users\\FLCoast\\Desktop\\"

Thanks for the suggestion Steve, but unable to get this to work with the current macro.

Test that command on its own in a macro (just that one command in a new macro).
After running the macro, look in “Preferences > Directories” to see if the “Macro output” directory has been set.
(note that the “Value” directory must be a directory that actually exists).

SetPreference:Name=“Directories/MacrosOut/Default” Reload=“0” Value=“C:\Users\Wayne\Desktop\”

Not working

Assuming that:

  1. Your log-in name is “Wayne”
  2. You are using Audacity 3.0.3 (NOT 3.0.2 or earlier)
    Then this should work:
SetPreference:Name="Directories/MacrosOut/Default" Reload="0" Value="C:\\Users\\Wayne\\Desktop"

(Check in “Help menu > About Audacity” to ensure that you are using Audacity 3.0.3)

All of that is correct. I am using 3.0.3 64bit, although I am using the zip version with the “Portable” folder with Audacity installed on c:. All macros are in c:\ Audacity303\Portable Settings\Macros.

Please attach the file:
C:\ Audacity303\Portable Settings\audacity.cfg