Edit Step Questions

A function to call

to skip lines in the pattern
(the number of set block jump lines)

relative from the current cursor

with internal boundary checking and skipping to the next pattern…

and a notification how to access this function (to add to ChordLord)?


You have renoise.song().transport.edit_step and renoise.song().transport.edit_pos. Why not just write it?

Well, all code is already present in Renoise itself…
(assumed such a function is triggered on keypress in the pattern editor).
I do not want to re-write all code already present in Renoise.
I would have to code bounds-checking that is already present in Renoise itself.
I looked at the TweakEditStep tool and it is a lot of code (that I can not just borrow).

It’s very simple to expand the API yourself. Here is one property (getter/setter) that I made that I hope works.

You can similarly expand the SongPos class with things like a :goto() method, a .total_number_of_song_lines property, or whatever your specific needs are.

renoise.SongPos.global_line_index = property(
    local lines_amt, song = 0, renoise.song()
    local pat_seq = song.sequencer.pattern_sequence
    for seq_idx = 1, obj.sequence do
      lines_amt = (seq_idx == obj.sequence) and lines_amt + obj.line or
      lines_amt + song:pattern(pat_seq[seq_idx]).number_of_lines
    return lines_amt

  function(obj, val)
    assert(val > 0, "global_line_index must be larger than 0.")
    local line_inc, song = 0, renoise.song()
    local pat_seq = song.sequencer.pattern_sequence
    for seq_idx = 1, #pat_seq do
      local pattern_lines = song:pattern(pat_seq[seq_idx]).number_of_lines
      line_inc = line_inc + pattern_lines
      if (val <= line_inc) then
        obj.sequence = seq_idx
        obj.line = pattern_lines - line_inc + val
    error("Global line (" .. tostring(val) .. ") is out of bounds.")



I do not understand how to call your code.

I tried to read the value
add the renoise.song().transport.edit_step
and then i could not assign a value to a function

what is obj? what is song?

obj is the songpos object. song is renoise.song(), as declared on the third line.

If you want to do a normal song-wide editstep of 2 lines, you would just add the following lines below:

local tmp_pos = renoise.song().transport.edit_pos
tmp_pos.global_line_index = tmp_pos.global_line_index + 2
renoise.song().transport.edit_pos = tmp_pos

Just as an example. You can manipulate the songpos values any way you want. Use it for edit stepping, or use it for pattern iteration and manipulation.

PS. note that the renoise.Song.transport.edit_pos object is a bit obnoxious in that it requires you to feed it a new songpos object to set the edit position.

I need the set edit step from Renoise.

That’s available as renoise.song().transport.edit_step

Thank you so much! I fixed it. I will update.

@joule you are mentioned in the “Special Thanks To” section in the ChordLord options.

Don’t forget to make the check when reaching the end of the song, otherwise it will fire an error. You probably need a total_number_of_songlines var/property for that.

I deleted the error message. It stays on the last possible line.

1 Like

I have added a check with the jump up for if you jump above the first line and then to set it to the first line

                local tmp_pos = renoise.song().transport.edit_pos
                if tmp_pos.global_line_index > renoise.song().transport.edit_step then
                  tmp_pos.global_line_index = tmp_pos.global_line_index - renoise.song().transport.edit_step
                  tmp_pos.global_line_index = 1