Pattern Effect Observer

Hi!

I would like to create a custom pattern effect which calls back a lua function. Is it possible to do this, perhaps with the observer pattern?

i.e.: I would like to create a function that gets called back whenever a pattern line containing a certain effect number gets played. Custom pattern effect handler.

Alternatively, a function that gets called whenever a certain instrument or certain sample gets played. It must be possible somehow, but I can’t seem to find it.

We don’t have notifiers for when a particular instrument is played, or when a particular pattern line gets played. So, AFAIK, not possible, or at least not with an acceptable timing precision.
It’s obvious that a lot of cool stuff could be achieved with such observables, but they are not part of the current Renoise API.

However, the sample/instrument triggering-sensing would be possible if notes were triggered through a script. But that would allow only external MIDI/OSC control, excluding the QWERTY…

Okay. Why not? Is it a design decision, or is it just not done yet?

My best guess (as I’m not a core developer, but only an enthusiastic producer of tools) is that it’s because the Renoise API is modeled after how Renoise works.
Meaning, we can access the document, instruments etc. and change all manner of stuff in the user interface - for example, we could attach a listener to a pattern and detect when someone has just written “your” special command. Or we could write notes to the pattern, which would then get played with as much precision as Renoise has to offer.
But, when we are talking about this special effect command flying past the playback position, this is no longer a UI action, but rather, something which is handled by Renoise’s audio engine. And, as it has been mentioned, such ‘realtime’ methods are not yet part of the API.
But obviously, it’s going to happen somewhen, and when it does one could for example write a sequencer which act upon such custom commands, triggering notes in realtime without having to write the notes into the pattern (like the current crop of Renoise sequencer tools do).