With renoise.song():render() an unwanted situation occurs. Forces the start of pos line number to be less than the end of pos line number. This restriction causes that it is not possible to render a single line pattern, because the number_of_lines of the pattern is 1 (pattern_length), which coincides with the minimum number, therefore it cannot be less.
*** std::logic_error: 'invalid start_pos or end_pos 'line'. line must be [1 - pattern_length].'
*** std::logic_error: 'invalid 'song_start' or 'song_end' render option. expected start_pos < end_pos.'
The possible solution would be for the condition to be less than or equal to startpos.line and endpos.line.
Renoise’s “Render Song To Disk” does allow rendering in this case, with “Save each pattern into a separate file”. It seems to be an API issue.
What values are you using for the start and end? Something that has tripped me up in Renoise code is that while Lua uses 1-based indexing, some things in Renoise use -based indexing (pretty sure).
I would think then rendering a 1-line pattern would go from 0 to 1, but maybe that’s what’s failing.
Regardless of the number (0 or 1), the minimum number of lines value is one line. In either case, the range should be 0 to 0 or 1 to 1, invalid range because start value must be less than pattern_length, as the API currently stands.
Also, if we take another range of lines like, 3-4, I would expect the rendering of line 3 and line 4.
In short, the starting value cannot be the same as the value of the number of lines (or pattern_length).
Lastly, the range of lines is “from 1 to pattern_length”. It doesn’t start at 0.
I have a tool that will save the current song with a date-stamp added to the name, and it will save a rendered version as well. It does the whole song by default, but will render a selection of patterns if there is one. It indeed fails if the selection is a pattern of 1 line. Same error.
What’s interesting is I can still use the built-in Renoise song render option, even if the whole song is just one pattern of one line. Also works if I choose “render a selection” .
I think this is just an API bug, namely a condition (“less than”, should be “less than or equal to”). It would only be necessary to update the API correcting this error and that’s it.
If you build a tool that renders individual patterns, the error may occur. An example would be the song “DemoSong - Medievil Music - Access Pwd.xrns”. The first pattern is a single line. With the current API it is not possible to render that pattern, but it is possible from the native Renoise tool, “Render Song To Disk”.