How do I update GUI whire a Lua script is running?

I’m trying to write a script which would automate exporting all regions under a track to .wav sample files. Since I couldn’t find any way to trigger region export from within the script I’ve made it iterate over all regions on a selected track and run bash script to emulate keyboard/mouse inputs (xdotool/ydotool) and sleep for a certain time (until the export is finished). The problem is whenever you do something like os.execute('sleep 10') Ardour GUI just freezes until sleep is finished.

Is there some kind of method you can call from scripts to refresh editor GUI? Is it possible to do multi-threading within these scripts? Or maybe you can simply call some method to export a region into a wav file?

This is probably not the best way, but one way you could get what you’re trying to do to work is to daemonize the shell process. In python, it looks like this

def daemonize_process():
    signal.signal(signal.SIGCHLD, signal.SIG_IGN)
    signal.signal(signal.SIGHUP, signal.SIG_IGN)

    pid = os.fork()
    if (pid != 0):


since these are system calls, I think you can accomplish the same thing in a bash script without anything lost in translation.

That said, maybe there’s a better way.

edit after re-reading your question, I realize this wouldn’t help, unless your shell script is doing all of the heavy lifting. E.g., just using the Ardour Lua script to provide some metadata as CLI arguments that the script uses to find the source files and do everything in its own process.

Why not just add ranges to each region and use the stem export option? That’s what I do for exporting 1000s of samples.

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