Question about commandline/scripting possibilities

Hi all,
I am new here and looking at Ardour to see if it can do something I need.
Here is what I want to achieve:
I want to record two stereo (or one 4channel) audio track plus a MIDI track. I know that is not a problem.
I want to be able to launch Ardour from another program, have it automatically start the recording of the three tracks with “standard” settings stored in a session template, save the result to a file and stop recording and exit the program again from the controlling program. The filename/foldername whatever to store the session files should be supplied by the launching program (ideally), I could live with it being automatically created in case it contains date and time stamps.

Does this seem possible?

Many thanks
Reiner

Programs with a graphical user interface are not easily “automated”. You should look at some commandline programs, there probably is some that can do what you want. Sorry I don’t have a solution for you, but you can check these: sox, ecasound, arecord, even FFmpeg should be able to record audio. Recording midi in sync with audio might be a challenge though.

It’s unclear what you mean. Do you want an ardour session as result? or the raw audio+MIDI files?

If the latter, then you might be better off with a simple recording app, not a fully fledged DAW
(although you could grab the raw files directly from ardour’s session folder).

Yes, Ardour comes with a commandline Lua interpreter ardour6-lua that can run interactively, or execute predefined scripts. for example to setup the audio-system and play a session:

#!/opt/Ardour-6.2.0/bin/ardour6-lua

backend = AudioEngine:set_backend("ALSA", "", "")
backend:set_buffer_size(256)
backend:set_peridod_size(3)
backend:set_device_name("UA-25")

session = load_session ("/tmp/TestSession", "TestSession")
assert (session)

-- rewind then start playback at speed 1.0
session:goto_start()
session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI)

-- play for 4 minutes
ARDOUR.LuaAPI.usleep (4 * 1000000) 
close_session()
quit()

You can create new sessions, add tracks, rec-arm them … and record. The following example may come in handy to piece things together: https://github.com/Ardour/ardour/blob/master/tools/split_benchmark.lua (also other example scripts https://github.com/Ardour/ardour/tree/master/share/scripts).

but for a simpler headless hard-disk recorder this may all be overkill. YMMV

2 Likes

many thanks for your responses! Looks promising!
Does the lua scripting also work in Windows environment?

Yes. The Ardour6 binary also comes with ardour6-lua.exe (Usually: C:\Program Files\Ardour6\bin\ardour-6-lua.exe

I’ve tested this to run interactively in a cmd.exe terminal, but I don’t know if of how it can be used as script-file interpreter (there’s probably no shebang (#!) equivalent).

Maybe you can simply pipe commands into it from your controlling app?!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.