Mixing Tracks with Macros
Forum rules
This forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Mixing Tracks with Macros
Using latest Windows 10 and Audacity 2.3.0
I have a large set of voice .wav files with varying length and I want to mix a single sound fx file (fixed length) to them in a batch using Audacity's Macros system. Further, that sound fx file being applied to all those voice wav files should fade in then fade out at the end while the voice wav files being processed stay the same volume.
So workflow looks like..
1) Load a batch of varying length voice .wav files
2) Copy single sound fx to clipboard
3) Fade in #2 and loop it (if its length were less than #1)
4) When near the end of #1 Fade out #2
5) Trim and save as new file
This would then move onto next voice .wav file to repeat.
Any help is VERY appreciated as I need all this automated via the macros. Thank you community!
I have a large set of voice .wav files with varying length and I want to mix a single sound fx file (fixed length) to them in a batch using Audacity's Macros system. Further, that sound fx file being applied to all those voice wav files should fade in then fade out at the end while the voice wav files being processed stay the same volume.
So workflow looks like..
1) Load a batch of varying length voice .wav files
2) Copy single sound fx to clipboard
3) Fade in #2 and loop it (if its length were less than #1)
4) When near the end of #1 Fade out #2
5) Trim and save as new file
This would then move onto next voice .wav file to repeat.
Any help is VERY appreciated as I need all this automated via the macros. Thank you community!
Re: Mixing Tracks with Macros
A "normal" Macro can't do things conditionally. A normal Macro just runs a list of commands.
The approach I would take:
1) Manually loop the "sound fx" so that it is at least as long as the longest voice file.
2) Manually fade-in the start of the "sound fx" (only need to do this once).
Then create a Macro to import the "sound fx", trim it to the same length as the first track, fade out the end, (normalize?), export.
"IF" is a "conditional statement". A normal Macro can't do that ("Nyquist-Macros" and scripting via an external language with mod-script-pipe can do this, but these approaches are much more complex and unnecessary in this case).
The approach I would take:
1) Manually loop the "sound fx" so that it is at least as long as the longest voice file.
2) Manually fade-in the start of the "sound fx" (only need to do this once).
Then create a Macro to import the "sound fx", trim it to the same length as the first track, fade out the end, (normalize?), export.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Mixing Tracks with Macros
Thank you Steve (and everyone else in the community)! Appreciate this help.
This is what I have so far in my Macro..
What this does is grab the fixed length sound fx and mix it with any multi-length sound file I wish.
Problem is it does not trim the output based on the random length of the sound files that pass through.
I have faded in the fixed length sound fx .wav so that part is done but my current challenge is now:
1) Mix the fixed length sound fx to each incoming variable length sound file and trim it to those (not to the fixed length sound byte) and
2) Fade out only the fixed length sound fx based on the trim of #1.
I get a feeling #2 is gonna be a challenge if I cannot get the macro to dynamically fade in the fixed length sound fx based on when each variable length sound file starts.
Any help is appreciated especially at each stage but I'll need actual Macro Commands, applicable parameters, and where in the sequence to place them to figure this out.
This is what I have so far in my Macro..
Code: Select all
Command Parameters
Import2 [path to my single fixed length sound fx .wav]
Mix and Render to New Track
Export as WAVProblem is it does not trim the output based on the random length of the sound files that pass through.
I have faded in the fixed length sound fx .wav so that part is done but my current challenge is now:
1) Mix the fixed length sound fx to each incoming variable length sound file and trim it to those (not to the fixed length sound byte) and
2) Fade out only the fixed length sound fx based on the trim of #1.
I get a feeling #2 is gonna be a challenge if I cannot get the macro to dynamically fade in the fixed length sound fx based on when each variable length sound file starts.
Any help is appreciated especially at each stage but I'll need actual Macro Commands, applicable parameters, and where in the sequence to place them to figure this out.
Re: Mixing Tracks with Macros
You will need to refer to the Scripting Reference to get the exact names for these commands (https://manual.audacityteam.org/man/scr ... rence.html)
- Select the first track and make the selection 0 seconds relative to the end of the track. (Cursor is now at the end of the track)
- Select the second track, and extend the selection to the end of the track ("SelEnd:")
- Delete the selected audio
- For a 2 second fade out, select "-2" seconds, relative to the end of the track, and apply a fade-out
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Mixing Tracks with Macros
So based on what you said the Macro goes as:
I'm hoping this is somewhat close at least so it can properly trim first before I figure out the fade out of the sound fx.
If possible, please correct the above: I am very sure this will be used by others as I've never found another Audacity macro which does this.
Code: Select all
Command Parameters
Select RelativeTo="SelectionEnd" Tracks="1"
Import2 [path to my single fixed length sound fx .wav]
Cursor To Track End
Select Tracks Mode="Set" TrackCount="2"
Selection to End
Delete
Mix and Render to New Track
Export as WAVIf possible, please correct the above: I am very sure this will be used by others as I've never found another Audacity macro which does this.
Re: Mixing Tracks with Macros
Almost but not quite..
So the above will cut back -10 seconds from the end of the fixed length sound FX but that only works for voice files passing that fit correctly so this is not a solution to properly cut/trim each sound file that passes. Its also not fading out the sound fx still.
Can one see what is incorrect with the above Macro?
Code: Select all
Command Parameters
Select End="0" RelativeTo="SelectionEnd" Track="0"
Select RelativeTo="SelectionEnd" TrackCount="2"
Select End="-10" RelativeTo="SelectionEnd" Track="0"
Fade Out Use_Preset="<Factory Defaults>"
Import2 [path to my single 14sec sound fx .wav]
Delete
Mix and Render to New Track
Export as WAVCan one see what is incorrect with the above Macro?
Re: Mixing Tracks with Macros
Try this:
Code: Select all
Import2:Filename="<path to sfx file>.wav"
Select:End="0" Mode="Set" RelativeTo="SelectionEnd" Start="0" Track="1" TrackCount="1"
SelCursorToTrackEnd:
Delete:
SelectTime:End="2" RelativeTo="ProjectEnd" Start="0"
FadeOut:
SelectAll:
MixAndRender:
ExportWav:
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Mixing Tracks with Macros
Utterly marvelous Steve!
Very close now! Almost there!
Ok so the final tweaks I need are:
1) Fade in the background sound fx for 0.5 second from the start (we got the end one now working but if I Select Time at Project Start it will cut off the sound fx within a second) and..
2) Change the decibel level of the fixed length sound fx itself (taking into account the fade in and out at the ends).
Thank you so very much Steve!!
Edit: Re-evaluated your original logic and got the Fade in 0.5 at the start of the sound FX to work perfectly.. Here is my update..
So essentially the new tweak is at Project Start to Fade In the fixed length Sound Fx in 0.5 seconds. Also made it 1sec (instead of 2) for the Fade Out on the fixed length Sound Fx .
So final question is if one can change the volume of either the Sound FX (Project?) or the different length sound files being shuttled through (Selection)?
Edit: ok I think I figured how to isolate the fixed-length sound fx and not the different length sound files. Here is the final Macro..
Change here was Selecting Time "Relative to Project" then using the Amplify option in the sequence above. 
Very close now! Almost there!
Ok so the final tweaks I need are:
1) Fade in the background sound fx for 0.5 second from the start (we got the end one now working but if I Select Time at Project Start it will cut off the sound fx within a second) and..
2) Change the decibel level of the fixed length sound fx itself (taking into account the fade in and out at the ends).
Thank you so very much Steve!!
Edit: Re-evaluated your original logic and got the Fade in 0.5 at the start of the sound FX to work perfectly.. Here is my update..
Code: Select all
Import2:Filename="<path to sfx file>.wav"
Select:End="0" Mode="Set" RelativeTo="SelectionEnd" Start="0" Track="1" TrackCount="1"
SelCursorToTrackEnd:
Delete:
SelectTime:End="0" RelativeTo="ProjectStart" Start="0.5"
FadeIn:
SelectTime:End="1" RelativeTo="ProjectEnd" Start="0"
FadeOut:
SelectAll:
MixAndRender:
ExportWav:
So final question is if one can change the volume of either the Sound FX (Project?) or the different length sound files being shuttled through (Selection)?
Edit: ok I think I figured how to isolate the fixed-length sound fx and not the different length sound files. Here is the final Macro..
Code: Select all
Import2:Filename="<path to sfx file>.wav"
Select:End="0" Mode="Set" RelativeTo="SelectionEnd" Start="0" Track="1" TrackCount="1"
SelCursorToTrackEnd:
Delete:
SelectTime:RelativeTo="Project"
Amplify:Ratio="0.89" [-1.0 db]
SelectTime:End="0" RelativeTo="ProjectStart" Start="0.5"
FadeIn:
SelectTime:End="1" RelativeTo="ProjectEnd" Start="0"
FadeOut:
SelectAll:
MixAndRender:
ExportWav: