How to perform the same tasks on multiple files?

Hi, sorry if my question is very primary but I have little familiarity with computers and even less with commands in the “Terminal” of Linux. Still, maybe I can learn.

I would like to automate the execution of the same tasks on a set of files that are in a single folder.

The tasks are:

1 - Open file
2 - Reduce the peak volume to -9dB
3 - Apply the “Clip Fix” effect
4 - Raise the volume to -3dB
5 - Save changes by overwriting the original file
6 - Do the same for all other files in the same folder.

For volume reduction I have used “Effects” / “Amplifie” but I could use “Effects” / “Normalize”.

The parameters for the “Clip Fix” command are the original ones, that is, “Threshold of Clipping (%)” = 95 and “Reduce amplitude to allow …” = 0.

I would like to automate these tasks because there are too many files.


Thank you very much.

\

I’m using:

Linux Mint MATE 1.22.2 - LightDM Distro: Linux Mint 19.3 Tricia - base: Ubuntu 18.04 bionic
Audacity 2.2.1
I’m not sure about the release I’m using but I’ve installed Audacity using Application Manager which came with Linux Mint

Could it be important too: my PC is a HP 1000 Notebook with Intel I3 and 4GB RAM. If i’ve missed something, please ask me.

Thank you.

<<<
3 - Apply the “Clip Fix” effect

My impression of Clip Fix was that it wasn’t a global tool like Amplify. It only worked on single clipping points and it used the information from the waves immediately before and after to devise a “patch” for that one point. If you have heavy clipping, there is not enough good quality information to correct anything.

In all cases, it just improved the look of the blue waves, not the sound. There’s no good way to correct sound once it’s missing. You should stop clipping if you can.

<<<
5 - Save changes by overwriting the original file

That’s insanely dangerous. Many Audacity tools will save corrected work to a “Patched” or “Corrected” folder separate from the original work. It is my opinion that’s what you should do.

You want to create a Macro. That’s Audacity-Speak for “Batch” or a file that runs collections of other files.

I went through this once recently. Looking.

Koz

https://manual.audacityteam.org/man/macros.html

Koz

I’m remembering pieces. The Macro service in Audacity 3.0.2 is greatly improved over earlier versions and is recommended. I know nothing about the Linux services.

Koz

Have some backed-up content on a timeline.

Go through your process manually and Audacity will “remember” the settings and adjustments for later.

Tools > Macros… > New > Name it > Insert effects as needed > Save > Close.

Tools > Apply Macro > Choose from the list and it just goes.

I don’t know any way to stop one once it launches, so having it destroy original work as it goes is a terrible idea. Also, there is no way to proof the action of a Macro other than observing the finished work.

I don’t know how to “Loop” a macro, have a Macro call itself multiple times. The problem with looping is getting it to stop. Macros can’t make decisions. There is no “see if this is the last file and if it is, stop.” That’s a decision and Macros can’t do that.

You don’t want a Macro to crash. Audacity instabilities are not good.

Koz

In Audacity 2.2.1, “Macros” are called “Chains”.

It would be worth updating Mint to version 20.1 LTS when convenient. That will give you a more recent version of Audacity (2.3.3 I believe).

I’m going to have holes here. Macros are little ordinary text files. I wrote one for automatic audiobook volume control.

You should comment it. This is my comment. This is the first line of the Macro.

Screen Shot 2021-05-08 at 11.34.53 AM.png
I don’t remember how I got it there, but that’s good programming practices. That’s not a big deal if you only ever write one, but it doesn’t work like that. The first time you come to two macros and you don’t remember which one is current…

Or send one to somebody and they send it back…

Koz

I’m fuzzy remembering not all versions accept comments… Lot of holes.

Koz

Dear kozikowsky, I got great results by applying “Clip Fix” to the soundtrack of an old film, “L’âge D’or” from 1930, but I did not notice any auditory difference in other files, although, as you alert, I could notice visual change in the blue waves. I believe that clips caused by using too strong signal during the generation of the sound file are more difficult to correct than clips that were already in the original file.

For example, when I ripped the film above, I took care to leave the volume as small as possible. It was a surprise to find clips in the ripped sound and I could only conclude that the waves were clipped in the original. In this case Audacity managed to get a better sound file (more … “soft”, “audible”, say) than what was on the DVD.

Well… when I begin to “queuing” the commands for automation, I intend to use the “Reduce amplitude to allow for restored peaks” feature instead of decreasing the volume to a maximum of -9dB with “Amplify”. So I can use “Normalize” (which saves the last set for volume) and not '“Amplify” after “Clip Fix”. Anyway, they are very old music files and it has DC offset because of the not-too-good quality of the record equipment. If after all they don’t get better, I just keep the original files, really. Or rather, the ones that get better - processed or not - I keep them.

Now as for overwriting files, you’re right. However, I always take care to copy the original files in a separate folder before doing anything with them. For those who are not very familiar with operations like “read from one folder and write to another” this is the option that saves.

As for “Macros” (or, as colleague Steve said, “Chains” in version 2.2.1), I will study by the manual you indicated. Or, if it is more convenient, I will ask a granddaughter to, first of all, update Linux Mint to 20.1 LTS and then maybe also update Audacity to version 3.0.2, before touching these “Macros”. In fact, in the version I have installed, it doesn’t even have the “Tools” menu. In the top bar of this version, after “Analyze” comes “Help”, it doesn’t even have “Extra” …

But I already took a look at the manual and from what little I saw, it doesn’t seem impossible to learn.

Dear kozikowsky and dear steve, it may be that after the updates and the study, I will need a little more of your guidance. But I want to thank you for the guidance you have given me so far.

Thanks.

Updating to Audacity 3.0.2 may be a problem (unless your granddaughter can build from source), however, just updating to Mint 20.1 should automatically give you a more recent version of Audacity (2.3.3 I think), which is recent enough for macros.