Not Sure if [Bug] or [Feature]: Pattern Length Resets When Changing Away from Empty Pattern

Hi, i’ve run across a problem while writing my recent Push script, which i thought at first must be due to my script and poor coding of it. But i have disabled all the tools on my laptop and can reproduce the behaviour there also. What happens is this:

Select any empty pattern higher than pattern 0 (1,2,3,4 + etc)
Change its length but do not add any notes.
On the same sequence position change pattern to another one, probably the next higher empty pattern.
Change back to the pattern whose length you just changed, it is now set at the default.

This happens reliably whenever a pattern length has been changed but no longer has an active instance on a sequencer position.

Looks like there’s some over-efficient garbage collection happening, or am i doing something wrong? Is this expected behavior?

I only noticed it when i was adding controls to my script to change pattern length and pattern number from encoders. If i set the pattern length but then changed pattern again the changed length on the previous pattern would reset if i went back past it by whizzing the encoder about.

Actually it only resets to 64 if:
-your pattern is empty
-you change the pattern number back one (does not happen by changing the number to higher value)
-then return it to what it was (it happens on any empty pattern with changed length, that is also the last pattern in the sequence)
-it does not happen for empty patterns that are not the last one in the sequence
-it does not happen if you have an empty effect parameter (i.e. 0 01) entered in track one, row one

So, until this is fixed, likely you can work around this by either writing the 0 01 parameter in each new pattern you have or possibly by always keeping a dummy pattern at the end of the song (and have it ignored by Renoise by setting the sequencer loop).

…If this helps at all.

I don’t understand very well the problem you describe. But I have never had any problem with the length of the pattern. I am on Windows 10, R3.2.1.

Renoise has a predetermined number of lines (Default pattern length) to add new patterns in the sequence, no matter what position. The number of lines is set in Menu Song / Song Options / Highlighting & Defaults: Default pattern Length. By default it is always on 64 lines. This is a feature that is saved in the song (xrns). For example, set this value to 128, and each time you add a new pattern in the sequence, it will appear with 128 lines.
image

Regarding the use of tools, you can force to change this value every time you add a new pattern from the tool.

-- Number of lines the pattern currently has. 64 by default. Max is
-- renoise.Pattern.MAX_NUMBER_OF_LINES, min is 1.
renoise.song().patterns[].number_of_lines, _observable
  -> [number]

A song can have up to 1000 patterns (0 to 999). Each pattern has a unique number of lines. If you repeat a pattern in the sequence, it will have the same characteristics (same name, same number of lines …). Finally, in the slots of the sequence, you can deposit any pattern.

Yes, completely empty patterns which are not referenced anywhere in the sequence are recycled or removed when auto-sorting the sequence, cause it’s assumed that they are unused.

This can be disabled by disabling the “Keep Sequence Sorted” option.

Thanks taktik. Pretty much as i assumed. Good to know that:
(a) it’s not my poor programming skills at fault
and
(b) it can be disabled.

Would something as simple as writing an instrument number into an empty pattern prevent it from being ‘sorted’?