R3.5.4, W11
The documentation;
---Replace the scheduled sequence list with the given sequence.
---@param sequence_pos integer
function renoise.Transport:set_scheduled_sequence(sequence_pos) end
I think this topic is very old and intricate…
If you use :set_scheduled_sequence(4) at any point during the playback of the current pattern, this function will cause it to immediately change upon completion of the current pattern, jumping to the assigned sequence index 4.
As far as I know, when a note column plays a note from instrument 02 in the current pattern, if another pattern in line 00 of the assigned pattern in sequence 4 has a note from a different instrument than 02, calling it with set_scheduled_sequence() will cause the Renoise audio engine to clear the audio buffer allocated to that note column for the previous instrument. Once it’s free, the new note from the different instrument can then play.
It’s as if it internally assigns to that column of notes the instrument of the note that has sounded.
The problem is that this clearing process can cause the playback of the note in the first line of the pattern assigned by set_scheduled_sequence(4) to be lost.
The sequence of events would be as follows:
- A current pattern is played in sequence 00, with an instrument note. 02 in note column 01.
- From the API,
:set_scheduled_sequence(04)(jump to 04) is invoked. This pattern has a note from instrument 07 in line 00, in the same note column 01. - When the pattern assigned to sequence 00 finishes playing and the pattern from sequence 04 starts playing, the audio buffer assigned to the previous instrument 02 is emptied.
- After emptying it, the new notes from the new instrument 07 can be played.
- The problem is that emptying the buffer takes a few milliseconds, which prevents the note on the first line from playing correctly. We can say that it can be skipped.
This small discrepancy prevents the reliable use of set_scheduled_sequence() in specific cases like this one.
The composer’s solution is to never mix different instruments on the same track, or, more precisely, to never mix different instruments in the same note column of a specific track.
But this forces the composer to do things they may not know how to do. And the Lua tool developer can go crazy trying to fix a problem they have no control over.
Is there a way in the Renoise API to release that buffer in the specific note column so that these instances of note playback failures on the first line of the trigger pattern don’t occur?
I’m not entirely sure if everything I’ve described is correct. Can we discuss this further? The goal is to be able to use :set_scheduled_sequence(sequence_pos) safely even in these cases…
It seems the buffer is emptied when a new instrument’s note is read. But this should be handled beforehand, at least when there are jumps between patterns.
It occurs to me that when invoking :set_scheduled_sequence(), there should be a way to empty that audio buffer before jumping to the next pattern, at least if nothing is playing. Another scenario would be if the previous note is still playing.
How is this usually solved technically? Is there some kind of preload buffer before real-time playback where everything is prepared beforehand, and where things can be manipulated so as not to affect the sound during playback?
I suppose this is an old issue that was never resolved. Would now be a good time to revisit these things?

