Title pretty much says it all. I’d like to be able to set the number of lines in a pattern by script.
I found these docs (am I barking up the right tree?):
The userdata type “renoise.PatternTrack” looks useful, but I don’t see a documented method for setting line count.
Moreover, renoise.song().transport.song_length seems to report useful-ish data, but is read-only.
As a n00b, I’m very likely missing something obvious.
Thanks in advance for your time,
-- get a valid pattern index
local index = renoise.song().selected_pattern_index
-- get pattern length
local num_lines = renoise.song().patterns[index].number_of_lines
-- process num_lines in some way
-- set to a random number of lines from 1 to 512
num_lines = 1 + math.floor(math.random() * 511)
-- set pattern length
renoise.song().patterns[index].number_of_lines = num_lines
I see it’s on the pattern and not the patternTrack.
renoise.song().selected_pattern.number_of_lines = 8
Yep. PatternTrack refers to a single track within a pattern. If you want to access automations or note data, then you can find these within the PatternTrack object.
If you want to access properties of the entire pattern, such as the number of lines, pattern name, the track objects within the pattern, etc., then you can find these within the Pattern object.
You can use the oprint() function to inspect each object and find out what properties and methods it has.