How to get the path of currently running lua script

I made a mobile app that produces wav files and text files. Each wav has an associated text file containing its lyrics.

I need to make a simple way for users on any platform to import that data into Ardour. I implemented this for Reaper but there is no way to get the location of the currently running script in Python (actually I did find a terrible hack, but it is too fragile to ship in production). Your Lua API looks pretty big, so I’m hoping there is something that can tell me where the current script file came from, because that’s how I can automatically find the files I need to import.

So far it looks like the current directory is set to the Ardour.exe location. The debug module can’t be imported with require, and there is no arg list to access from inside Ardour Lua. Since require doesn’t exist I can’t import luafilesystem. I don’t know much about Lua, but it looks like I can’t find out where the script is in the filesystem when using Ardour Lua. Is that the case?


Correct. Ardour evaluates the script and the uses the lua-bytecode as part of the session.

The idea is for the session to be independent of the original script. That way you can move or copy the session to a different system or platform. This is also the main reason why no external lua libs are allowed.

Where would you import the lyrics to? At this point in time Ardour does not offer meta-data tracks.

Thanks for your reply. I played around with Ardour a little bit and the closest thing to a lyrics track I could find was the range markers. I could make the names of the markers super long, and the software didn’t complain. These won’t work for lyrics because they show the marker name at the beginning and at the end.

One crazy idea is to export a video using ffmpeg to draw text on a black background. I’ll have to think about that. It sounds like a hassle, but might be easier than making import scripts for every DAW.

Reaper has these empty media items that you can put text notes in. That text is what displays in track view instead an audio waveform.