As best I can tell this is not possible, but I’m not new to being wrong, and I hope I’m wrong now.
I want to build a self-modifying song. The idea is that as the song plays it sends messages to itself (OSC, or perhaps MIDI) which triggers Lua functions to alter the songs tracks/patters/instruments. You could the play the piece in a loop and it would evolve over time.
However I know of no way to bundle a script or tool with a song such that when you load the song the script is also loaded and active.
(Yes, I can imagine assorted security issue with this. Still, I like the idea.)
Is this possible?
no it is not possible to do so. I have also thought about this way ago.
What is stopping you from simply creating a tool that does this thing, and then the song contains some “special info” that the script will look for.
Basically, all that’s needed is to define a “trigger” somewhere.
The underlying problem is that lua is powerful enough to make changes to the filesystem on the computer playing the song.
So, bundling a script with a song is sort of analogous to the security disaster called “autoplay” on windows />
Given that a user must at least have a script installed that supports encoding and decoding other scripts into the song its data, because getting scripts installed out of the blue sky is not possible indeed:
You can write a script that reads a song its specific contents (sample titles or instrument titles, i believe sample titles allowed infinite data) after the song has been loaded triggered by the document loaded notifiers, extract the script its contents and install it. the function would pack the tool to an xrnx file which you can then uuencode and stuff into a sample title or somewhere similar. When the song is reloaded the scripts recognizes the uuencoded material, decodes it and then calls the install instruction to install the decoded xrnx:
Renoise Lua has a few install instructions that allow you to install a script once you have decoded it from your song contents, you have to steal the techniques from the script updater tool though, it is not thoroughly documented.
Nothing, but that’s different from a self-modifying song.