Changing volumes of tracks in the same time

Hello, Audacity is close to be perfect. There is one really really really bad thing that could be improven soooo easily.

When you have many tracks on a project, because you have spent years on the project and after months you add a sound here and there and after a year you have 90 tracks, sometimes everything together make the final mixe saturated

The only way is to reduce the dB of every track. If you reduce -2 dB on each track, the whole mix don’t sature anymore.

On the left of each track, you have the panoramic left/right) and the volume in dB. You can easily change the dB for one single track at one time, but not many.

I make sounds for movies, I have mixes some great albums on audacity. But me and my friends when we want to lower the whole mix from 2dB, we are like… “ok… le’ts change every 90 tracks individually”

And we spend the afternoon doing this if this is 12 songs with 90 tracks each…


It would be PERFERCT if there were a shortcut or a way to lower at the same time every “volume slide” at the left of each tracks…

  1. Select all the tracks - Ctrl+A shortcut
  2. Effect > Amplify
  3. type -2 in the Amplification field
  4. Click OK
  5. result: all tracks reduced by -2db

WC

In this situation (and when mixing in-general) I’d recommend the following:

Export the mix as 32-bit floating-point WAV. Floating-point can go way-way over 0dB with virtually no upper limit without [u]clipping[/u] (“saturating”). By default, Audacity uses floating-point “Internally” so it won’t clip either (although you can clip your DAC when you play it).

Re-import the floating-point WAV file (presumably stereo?) and Normalize or Amplify to bring-down the levels

Export again to your desired final-format.

And we spend the afternoon doing this if this is 12 songs with 90 tracks each…

I love Audacity, but 90 tracks!!! You should probably be using a [u]DAW[/u] that’s actually designed for multitrack recording & mixing. [u]Cakewalk[/u] (not on that list) is now FREE!

It’s a big learning curve stepping-up to a full DAW from a “little audio editor”, but after you get past that it’s probably better and easier for the kind of work you’re doing. You could use still Audacity along with your DAW, either for recording “simple tracks” that will be mixed later, or to “master” the final-stereo mix. There’s nothing wrong with using more than one tool.

Hi,
I have the same problem, so i wrote a command-line utility to decrease volume of all tracks by -1 dB.
If you are running Windows, download this: https://drive.google.com/file/d/1GuNamSk2v9-dhaYGTQDFxVYBgprLApT0/view?usp=sharing
For Linux this: https://drive.google.com/file/d/1yWBXv6iLMMPC3hcsBhF9p1bE2AxkNpPP/view?usp=sharing

run it from command line like this: volumedown yourfile.aup
if you need decrease by -2 dB, run it twice…




Here is the source code in Free Pascal. You can compile it for other platforms:


Program VolumeDown;
uses SysUtils, Crt, Math;
var
F, F2 : TextFile;
Soubor, Radek, GainCislo, RadekVystupni : AnsiString;
Ano : string;
N : Integer;
Gain, dBGain : Real;
Zmena : ShortInt;

function PrectiCislo (Radek1: AnsiString; M: Integer): string;
var
Cislo : string;
begin
Cislo:=‘’;
repeat
Cislo:=Cislo+Radek1[M];
Inc(M);
until Radek1[M]=‘"’;
PrectiCislo:=Cislo;
end;

begin
WriteLn;
WriteLn;
if (ParamCount<1) or (ParamStr(1)=‘-h’) then begin
WriteLn(‘VolumeDown is a tool to decrease (or increase) volume of all tracks of .AUP file for Audacity’);
WriteLn(‘usage: volumedown [-h] [-i] <filename.aup>’);
WriteLn(‘-h show this help’);
WriteLn(‘-i increase volume of all tracks by 1 dB instead of decreasing’);
WriteLn(‘just: volumedown <filename.aup> decrease volume of all tracks by 1 dB’);
exit;
end;
if ParamStr(1)=‘-i’ then Zmena:=1 else Zmena:=-1;
if Zmena=-1 then write(‘VolumeDown started. Decrease volume of all tracks in ‘+ParamStr(1)+’ by 1 dB? [Y/n]: ‘) else
write(‘VolumeDown started. INCREASE volume of all tracks in ‘+ParamStr(ParamCount)+’ by 1 dB? [Y/n]: ‘);
ReadLn(Ano);
if (Ano<>’’) and (Ano<>‘Y’) and (Ano<>‘y’) then begin WriteLn(‘nothing done…’); Delay(2000); exit end;
Soubor:=ParamStr(ParamCount);
Assign(F,Soubor);
Assign(F2,Soubor+’.aup’);
Reset(F);
ReWrite(F2);
repeat
ReadLn(F,Radek);
GainCislo:=‘’;
RadekVystupni:=‘’;
N:=0;
repeat
Inc(N);
if Radek[N]+Radek[N+1]+Radek[N+2]+Radek[N+3]+Radek[N+4]+Radek[N+5]=‘gain="’ then begin
GainCislo:=PrectiCislo(Radek, N+6);
DecimalSeparator:=‘.’;
Gain:=StrToFloat(GainCislo);
if Zmena=-1 then
if Gain<0.017783 then begin Gain:=0.017783; WriteLn(‘gain of the track was already -36 dB!’) end else WriteLn(‘gain decreased’)
else
if Gain>56.234131 then begin Gain:=56.234131; WriteLn(‘gain of the track was already 36 dB!’) end else WriteLn(‘gain increased’);
dBGain:=20*log10(Gain)+Zmena;
Gain:=Power(10,dBGain/20);
N:=N+6+Length(GainCislo);
GainCislo:=FloatToStr(Gain);
RadekVystupni:=RadekVystupni+‘gain="’+GainCislo;
end;
RadekVystupni:=RadekVystupni+Radek[N];
until N=Length(Radek);
WriteLn(F2,RadekVystupni);
until EOF(F);
Close(F);
Close(F2);
DeleteFile(Soubor);
if RenameFile(Soubor+‘.aup’,Soubor) then WriteLn(‘file changed successfully!’);
Delay(2000);
end.


It’s pretty easy to do this using Audacity’s built in scripting language “Nyquist” to run Macro commands.

One of the nice things about Nyquist plug-ins is that they don’t need to be compiled. They run directly from plain text files.

Here’s a plug-in that sets the gain of all tracks:

;nyquist plug-in
;version 4
;type tool
;name "All Tracks Gain"
;author "Steve Daulton"
;copyright "Released under terms of the GNU General Public License version 2"

;control db "Reduce Gain by (dB)" int "" 0 -36 36

(aud-do "SelectAll:")
(aud-do (format nil "SetTrackAudio: Gain=~s" db))

and here is is as a plug-in file that can be installed (see: https://manual.audacityteam.org/man/customization.html#plug-ins)
AllTrackGain.ny (289 Bytes)

Thanks for including the source code. We’re big fans of open source.
Have you used ever GitHub? It’s a very convenient way to host source code and binaries (Audacity source code is on GitHub).

This won’t work in future versions of Audacity. From the next Audacity release (version 3.0.0) Audacity’s project format changes to become a single file (the new format is based on SQLite) rather than the old “AUP + pile of files”. However, Audacity will still expose an interface that allows it to be controlled by any external language that supports “named pipes”. (I expect “FpMkfifo” will work in Free Pascal).

Using the scripting API is recommended over hacking the XML.

More info here: Scripting - Audacity Manual
and here: Scripting Reference - Audacity Manual

Hello, great to hear about scripting in Audacity! Good job!
The thing is that your code changes volume of all tracks to the same number. The topic here is to decrease volume of every track by xx dB (relative value).
I found another script of you on this thread: https://forum.audacityteam.org/t/adjusting-gain-on-multiple-tracks/57009/1 But it seems to be not working well.
Thank you!

There are many variations possible on this theme. My post was intended as an easy example (just two lines of actual code).

The scripting interface is relatively new and still being improved.

In Audacity 2.4.2 there are now commands “TrackGainInc:” and “TrackGainDec:” which increase / decrease the track gain for the “focused” track (the “current” track that has the yellow border). This will be slower than my previous script because it has to step through each track, set focus on the track, and then increase / decrease the track gain. Something like:

;version 4
;type tool

(setf tracks (get '*project* 'tracks))

(dotimes (i tracks)
  (aud-do (format nil "SelectTracks: Track=~s TrackCount=1 Mode=\"Set\"" i))
  (aud-do "SetTrackStatus: Focused=1")
  (aud-do "TrackGainDec:"))

The above code can be run from the Nyquist Prompt (Nyquist Prompt - Audacity Manual), but for convenience it would be better to convert it into an installable plug-in by adding the necessary “headers” (see: Missing features - Audacity Support).
When installed, you could create a keyboard shortcut to run it. (See: Shortcuts Preferences - Audacity Manual)

The “All Tracks Gain” plugin will install and enable on my system, but it does not show up in the Effects menu. I have even restarted the program. It remains hidden. Is there some reason this wouldn’t show up?

Yes, because it is a “Tool” type plug-in. When installed it will appear in the Tools menu.

Ah, there it is under the “TOOLS” menu and not the effects menu. That wasn’t obvious to this noob