[Solved] How-To Duplicat Ptn To New & Keep Orderlist

i have a 1 patternorderlist track with pattern 00 playing. i press duplicate pattern. i now have a 2 patterns on my orderlist.

how instead of this do i change the current order list pattern 00 to pattern 01 and duplicate content of pattern 00 to pattern 01, please?

is there already some method of doing this?

If I understood correctly what you mean: Pattern editor focused: CMD+K (Clone current pattern), CMD+UP (Move up in order list), CMD+BACKSPACE (Delete pattern from oderlist). Or do you mean you have to do this WHILE playing, with a single command?

while playing, with a single command. not multiple shortcuts.

To Duplicate Pattern I assume you must already have Focus in the Sequencer, yeah? If so just press Left/Right to change the number of the current Pattern.

no, absolutely not. my cursor focus is on the pattern editor.
pressing left&right still requires one to select the whole pattern, copy the whole pattern, press left-right and then paste the whole pattern. if your default pattern length is 64, and you are pasting a 256 row pattern to a new pattern, you will only paste the 64 rows to the new pattern, then you have to, yet again, move the mouse cursor to resize the pattern, and then paste.

How did you Duplicate Pattern then? With the Little + button using the Mouse? Thought you wanted to be 100% keyboard? If willing to reach for the mouse for that why not use it to click on the <> arrows to change Pattern Number?

Or what you say pattern00/01 in your first post do you mean Seq00/01?

Maybe a clearer writeup of what you actually want, as I think I’m getting my wires crossed as I reread you initial post.

with this:
.

i mean “the currently selected sequence”. in the orderlist. this orderlist contains a pattern, which i wish to duplicate, but not by creating a new sequence in the orderlist, instead by having the seq00 change to seq01 and be an identical copy of seq00. if you like, we can talk of seq00 instead of patterns in the orderlist. to me they’re interchangeable. orderlist entry<->seq entry.

Ahh, I searched Duplicate so missed that shortcut.

Do you not see the contradiction in that statement?

Sequence position IS the orderlist. It always starts at 00 and increments with added patterns, whether they are new patterns or repeats of old one.

From what I now believe I understand you want to only ever see Seq00. But from here you want to copy the full contents of the pattern to a new pattern and have it replace this in the sequence. With one single button combination.

I don’t think that is possible and I doubt it will ever be so as it sounds quite a specific request for something that is unlikely to be in most people’s workflows. Obviously scriptable though.

Three button presses can do it though, if this isn’t too much work.

Ctrl+F4
Ctrl+Right
Ctrl+F5

The Lua way:

  
local rs=renoise.song()  
rs.selected_pattern_index = rs.selected_pattern_index + 1  
rs.selected_pattern:copy_from(rs:pattern(rs.selected_pattern_index - 1))  
  

This is just a testpad script. This also won’t take into consideration if the next pattern is in use et cetera et cetera…

EDIT:
This one shouldn’t overwrite existing patterns. Sorry, It was simpler than I thought…

  
local rs=renoise.song()  
local n_patterns = #rs.patterns  
local src_pat_i = rs.selected_pattern_index  
local src_pat = rs:pattern(src_pat_i)  
  
rs.selected_pattern_index = n_patterns + 1  
  
rs.selected_pattern:copy_from(src_pat)  
  

Objective: maintain cursor focus on pattern editor at all times.

problem: have edited 512 row pattern for a long time. wish to create clone of said 512 row pattern (from now on referred to as PTN). with one keyboard shortcut. while maintaining cursor focus on pattern editor at all times.
details: PTN is at SEQ00 (first row of the orderlist/pattern sequencer).
when clone is made, the PTN-clone is not added to SEQ01, instead, SEQ00 PTN changes to SEQ00 PTN-Clone.

“create clone of current pattern to currently selected SEQ-number”. ← does this uncross your wires?

EDIT#2:
now it retains the previous selected_line_index. thx heaps KMaki!

function clonePTN()  
local rs=renoise.song()  
local currline=rs.selected_line_index  
  
rs.selected_pattern_index = rs.selected_pattern_index + 1  
rs.patterns[rs.selected_pattern_index].number_of_lines=renoise.song().patterns[rs.selected_pattern_index-1].number_of_lines  
rs.selected_pattern:copy_from(rs:pattern(rs.selected_pattern_index - 1))  
rs.selected_line_index=currline  
end  
  
renoise.tool():add_keybinding {name = "Global:Paketti:Clone Current Pattern to Current Sequence", invoke = function() clonePTN() end}  
  

No problem. You did the heavy lifting. I updated the snippet a bit. The problem with the original is that it can trash patterns in use.

awesome, updated my bit of code (to retain the number of lines and to set the cursor row to the “current one”). and it works! and doesn’t overwrite anything.
thank you very much!

  
  
--Clone Current Pattern to Current Sequence and maintain pattern line index.  
function clonePTN()  
local rs=renoise.song()  
local currline=rs.selected_line_index  
local n_patterns = #rs.patterns  
local src_pat_i = rs.selected_pattern_index  
local src_pat = rs:pattern(src_pat_i)  
rs.selected_pattern_index = n_patterns + 1  
rs.patterns[rs.selected_pattern_index].number_of_lines=renoise.song().patterns[rs.selected_pattern_index-1].number_of_lines  
rs.selected_pattern:copy_from(src_pat)  
rs.selected_line_index=currline  
end  
  
renoise.tool():add_keybinding {name = "Global:Paketti:Clone Current Pattern to Current Sequence", invoke = function() clonePTN() end}  
  

will add this to Paketti after I’m done with ViZiON’s mess.