Loading an instrument via script


(rangarajan) #1

Hi,

As part of my script execution, I would like to load a few instruments to the Instruments window so that I can assign one or more of them to a song (track, specifically). How do I load instruments via a script?

(Sorry for repeating this question here. I posted it in the other section, but there is no reply.)

Regards,

Rangarajan


(danoise) #2

Short answer: you can’t.

You can load samples and plugins, but not an entire instrument (xrni).

A big +1 from (as well as saving instruments, which is what I have personally needed)

This is just one of those things that should obviouslybe in the API.

You can add it to the API wishlist, a topic which is monitored by the Renoise-devs.


(rangarajan) #3

I agree with you, it should be in the API (of course along with Saving instruments, as you have pointed out). I guess there is a workaround (for me anyway): I can create an empty song with some instruments loaded in, save the song, and then when I need, load that song in a script.

By the way, I thought of doing this in a song template, but it appears there is just one default song template! It would be nice if we can define many templates and open them by the respective names.

Regards,

Rangarajan


(Beatslaughter) #4

Well, it’s a bit hacky but you can actually open a XRNI in Renoise under certain conditions. At least on Windows you can execute a XRNI file directly on a command line, if it’s set / assigned to open with Renoise. Calling this should load the instrument in the currently selected instrument slot. Make sure to replace \ as \ in the path. In the popen call surround the path with " or it will fail with path names which have spaces in. os.execute() always seems to open a new Renoise instance, but io.popen() worked just fine. Only downside is, you don’t know when the instrument has finished loading, but there might be a way around it.

io.popen('"' .. path_to_xrni .. '"')