LUA: Open a midi region in musescore

This is a follow up to another topic I made about launching an external program from within Ardour (Launch an external application with LUA)

My whole goal there was to have Ardour open up a midi region in musescore.

Well I have achieved that, although, in not the most ideal way. In the original post I was having trouble executing musescore directly, so I found a workaround of having the script create a cron job and opening it that way.

I now have a fully working script, I have only tested it with my machine setup ( Debian Bookworm) and with musescore 2

The way it works is it gets the direct file path of the region on the disk, creates a temporary cronjob then erases the cronjob after a delay. There is also some dialog boxes that gives the user some tips if musescore is not opening up and let’s them know to wait up to 1 minute before musescore opens up since it’s a cron job.

Here is a video demonstrating the script:

Here is the script if you want to try it out yourself: https://github.com/jmantra/Ardour-scripts/blob/main/mscoreex.lua

Feedback, suggestions, and PRs are welcome though I ask that if you are going to provide feedback, please go easy as I am still kind of newish at programming.

Hopefully someone finds this useful.

3 Likes

Updated version of this script, now uses musescore in the background to convert to PDF then open said PDF in Firefox. Still working why I can’t launch the file directly from within the LUA script (can launch musescore by itself with no file specified) or why this script won’t work at all in Wayland. (Not that I am currently fan of Wayland, but I know that is where things are headed right now).

In case anyone cares, I now have it so it launches Musescore directly. :grinning:

Edit: This now also works in Wayland.

2 Likes