New Tool (2.8) Auto Clone Patterns

Too long, didn’t read:

Download: http://www.renoise.com/tools/auto-clone-patterns

-=-=-

Pseudo-code:

  
while   
 record && current_pattern == last_pattern;   
do   
 clone last_pattern;  
 clear current_track;  
end  
  

Other variations:

Clone last X patterns.
This way you could lay down 4 patterns, then record with a backing track that last 4 patterns,

Oh hell yes. I’ve been wanting something like this for years. +1

Would be great, but I’m afraid it will be a cpu hog on songs with lots of input in tracks, am curious if it will work good through scripting.

Like Cie’s step sequencer now automatically filling in the steps in his tool for every pattern, which seems to fetch the note data at the last step in the pattern editor(?). Try scrolling around in the pattern editor through moving the cursor and you’ll notice the transition between patterns feels sluggish on big tunes. And this is just for getting input out of 8 tracks in the pattern, or maybe my computer just sucks? :)

What about scripting it so that you’re recording across a looped section and each pass of the loop creates and saves to a new sample?

(Spelling)

I will work on this at the Renoise workshop this Saturday.

I did some preliminary testing last night. I don’t think it will be slow.

Cie’s step sequencer is far more complex.

What I am describing is a very simple concept using clone_pattern and clear_track; which are internal to Renoise and very fast.

All this script will do is +1 a pattern if you are recording and on the last pattern. Nothing fancy.

Hmmm, this is also a good idea. On the todo, for sure.

Edit: replace “new sample” with “new pattern”.

Sounds good.

For a future update it would also be great if it could auto-insert a cloned pattern when starting recording notes in the middle of a song. So instead of adding notes in a cloned pattern at the end, it inserts wherever you start recording between patterns.

I like this idea so much that I couldn’t help writing this script! So here it is…

It’s a bit different than your first idea, though. It overides the looping feature of the pattern matrix, when edit mode is enabled. First enable the script, via the tool menu or via keybinding, and loop the patterns you want to play with in the pattern matrix. If edit mode is on, the script will clone the loop as soon as the last pattern of the loop is played, then clear the current track in the clone and shift the pattern loop.
It may sound complicated, but IMO it’s more flexible and more integrated in Renoise (no script dialog, preferences etc…).

And of course, all bug reports and comments are welcome!

EDIT : this version is not up to date, please download the latest release on the tools page.

Haha, awesome! Will check it out tonight.

brilliant!

:drummer:

EDIT:

encountered a bug;

I opened an existing song of mine, enabled your script and loop-marked the first 2 patterns in the pattern sequencer. This gave me the following message:

Looking at the error, then the code, are you sure you didn’t do “AutoClonePatterns Disable” instead of enable? How can a menu entry be triggered by selecting a loop in the PM?

Anyway, the easy fix is to check for the notifier before removing it, like in auto_cloning()

Speaking of which, I’m not near an instance of Renoise 2.6 at the moment, but maybe the code could also be optimized? Looking at auto_cloning(), seems it’s constantly checking to see if it can remove a notifier? Maybe break that into two functions, start and stop? Something like (WARNING, UNTESTED)

  
... redacted ...  
  

Code updated (but still not tested…)

I tested my version, works fine.

Cut and paste into bystrano’s main.lua?

I uploaded a new version, in which it’s fixed.

@Conner_Bw :

I am not convinced your version is more optimized. As I see it, in your version, the not necessary useful code executed each idle time is ```lua
if (enabled and (
not renoise.song().transport.edit_mode or
not renoise.song().transport.playing
))
then

while in my version it'slua
local loop_start = renoise.song().transport.loop_sequence_start
local loop_end = renoise.song().transport.loop_sequence_end
local new_loop_start = loop_end + 1
local new_loop_end = new_loop_start + (loop_end - loop_start)

if renoise.song().transport.playback_pos.sequence == loop_end then

Hi bystrano,

I didn’t mean optimized for efficiency, i was more aiming for readability. I believe both versions will have negligible differences. Especially since the user is supposed to enable/disable this manually. No worries if you think I’m wrong. Your version is fine too.

Some comments about your v.02

  • I think clones should only happen if both transport.edit_mode and transport.play are true, not just edit_mode. This combination is “recording” in renoise.
  • Would be nice to update the menu with a checkmark next to enabled/disabled, kind of how duplex does it.

Hope to see your script on the tools page soon!

Regards,

Hehe yeah, what’s up with that? Did I catch some special Renoise that just throws out these notifier messages? :)

Thanks m8, works perfect!

Done in v0.3!
I kept my version because I think it’s better to use the app_idle notifier only when it’s really needed. It’s kind of a hack which lead to a lot of unuseful code execution. Best thing would be to have an observable on the currently played pattern. Could be an addition for future betas? This would alllow to make it optimized for reading and execution, making us both happy! :)

I’ll wait a few days to see if anybody finds any problems, and I’ll upload it then.

yay²! , thanks.

yeah, really cool stuff, something that has been requested a lot of times before, finally made happen through scripting and the brilliant Bystrano! Another item scratched from Taktiks to-do list, but let me add another request :slight_smile: :

Would be great if overwriting input, instead of always overdubbing could also be achieved for us time-challenged keyboard players, but this probably deserves a separate script and shouldn’t be incorporated in auto-clone? With overwriting enabled, recording notes in a pattern should overwrite the notes already present in the track, not add in between what was already present, but it should only overwrite for the time you’re playing / recording in the pattern, so the rest of the previous input remains. Great if you want to replay a certain section, but keep the rest.

Maybe there is already a modifier key that can be hold when inputting notes, that’ll automatically overwrites the notes that I’m not aware off?

I uploaded a new version. I removed a debug print that shouldn’t be here and made a small readability fix…

I have tried to do something like this, but I think it crosses the “realtime” line, and is above current scripting possibilities. The thing is that we miss some realtime notifiers, like the pattern being played and the playback position. I circumvented this in AutoClonePatterns by using the idle notifier, which is called when renoise has some spare CPU time. IMO this is a safe bet, because you can be pretty sure that by the time the last pattern is played through, it will happen. Your idea requires the same hack, but this time you hope renoise will have some spare CPU time each line, which is less likely to happen.
Anyway here is the tool I wrote, but it should be treated as highly experimental. I know it can skip some lines sometimes… Maybe someone has an idea on how to make it work better?
Another problem is that it always overwrites one line too far. This could be fixed with sone work, but I won’t bother doing it till the rest works properly.