Batch Processing on CLI


I want to set up an effects stack on the master bus (I think is the terminology), and then use bash to write a script to import a wav file and then just export it (with the effects stack doing it’s modifications). I need to do this to hundreds of wav files, so I need to automate this. But, since a lot of the other parts of my automation pipeline also use bash, I don’t really want to have to open Ardour manually and run a Lua script, since that breaks the bash CLI pipeline.

Is there any way to do this only from the CLI, or is there a way to execute a Lua script from the CLI that imports audio and exports and allows me to set the file paths for importing/exporting?

Thank you

So the actual goal is to apply some FX with fixed settings on files? Perhaps Ardour is overkill for that, to begin with.

Since you mention bash, I assume you’re using GNU/Linux. In that case FX are likely LV2 and you could use lv2file to directly apply them.

Another options is ecasound : (but that has only LV1 support, not LV2) or perhaps sox.

Are any of these an option?

Some brainstroming about using Ardour for this:

I’d probably use the headless Lua interpreter (arlua). You can write complete scripts (e.g. ). However this interpreter is not usually included with releases and also only evolved recently (after 5.12). You’ll likely have to compile Ardour from source.

You might be able to script this with Ardour’s GUI in 5.12 with existing releases: Auto-start engine, execute a script on load, but that’s likely rather fragile.

If you have to use Ardour, at this point in time I expect modifying the session-file XML directly is easiest:

Create a session, add the FX, import an external-file (don’t copy to session), save, quit.
Then sed search/replace the filename in the XML (using absolute path) as well as duration of the file (use sndfile-info) from your bash script. Finally use the /opt/Ardour-5.12.0/bin/ardour5-export commandline tool to export the session.

Hello Robin,

This is very helpful information! Let me try these suggestions first and get back to you if these will work for me.

I have already tried sox, but found the effects to be rather low quality, which is why I turned back to trying to figure out how to use Ardour to do what I need.

I didn’t know about the lv2file, ecasound, or the ardour5-export, so think trying these first is the best route before diving into something more complicated. I think the ardour5-export route is the most interesting though, so I will probably try this first!

Thank you!!