Jump to content


Photo

New Tool (2.8) Auto Clone Patterns


  • Please log in to reply
66 replies to this topic

#1 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 16 September 2010 - 21:07

Too long, didn't read:

Download: http://www.renoise.c...-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,

Edited by Conner_Bw, 31 May 2012 - 02:31.
This tool exists now, and has for a while.

  • mr_mark_dollin, Djeroek, maes and 1 other like this

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#2 mr_mark_dollin

mr_mark_dollin

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2823 posts
  • Gender:Male
  • Location:In the Pattern Matrix.
  • Interests:Quiet Revolutions.

Posted 17 September 2010 - 01:57

Oh hell yes. I've been wanting something like this for years. +1
Posted Image

#3 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 17 September 2010 - 09:25

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? :)

#4 kazakore

kazakore

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6140 posts
  • Gender:Male

Posted 17 September 2010 - 09:32

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)

Edited by kazakore, 17 September 2010 - 09:32.


#5 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 15:29

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.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#6 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 15:34

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?


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

Edit: replace "new sample" with "new pattern".

Edited by Conner_Bw, 17 September 2010 - 15:34.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#7 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 17 September 2010 - 17:10

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.


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.

#8 bystrano

bystrano

    Advanced Member

  • Normal Members
  • PipPipPip
  • 72 posts

Posted 17 September 2010 - 17:21

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.

Attached Files


Edited by bystrano, 26 September 2010 - 09:24.

  • Conner_Bw and Djeroek like this

#9 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 17:25

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


Haha, awesome! Will check it out tonight.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#10 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 17 September 2010 - 19:07

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!


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:

'C:\Users\plugexpert\AppData\Roaming\Renoise\V2.6.0\Scripts\Tools\com.bystrano.AutoClonePatterns.xrnx\' failed to execute in one of its menu entry functions.

Please contact the author (bystrano) for assistance...

std::logic_error: 'remove notifier: the given notifier function was not added.'
stack traceback:
[C]: in function 'remove_notifier'
main.lua:20: in function 'disable_auto_clone'
main.lua:89: in function <main.lua:88>


Edited by Jonas, 17 September 2010 - 19:10.


#11 Guest_Bantai_*

Guest_Bantai_*
  • Guests

Posted 17 September 2010 - 19:30

Heh, Jonas, don't you love dem notifiers ;)

#12 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 19:52

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)

[lua]
--[[============================================================================
com.bystrano.AutoClonePatterns.xrnx/main.lua
============================================================================]]--

----------------------------------------------------
--Functions
----------------------------------------------------

local enabled = false

function toggle()
if enabled then
stop()
else
start()
end
end

function start()
if not renoise.tool().app_idle_observable:has_notifier(update_pattern_sequencer) then
renoise.tool().app_idle_observable:add_notifier(update_pattern_sequencer)
end
enabled = true
end

function stop()
if renoise.tool().app_idle_observable:has_notifier(update_pattern_sequencer) then
renoise.tool().app_idle_observable:remove_notifier(update_pattern_sequencer)
end
enabled = false
end

function update_pattern_sequencer()

if (enabled and (
not renoise.song().transport.edit_mode or
not renoise.song().transport.playing
))
then
return
end

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

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)

-- clone sequences
local sequencer = renoise.song().sequencer
sequencer:clone_range(loop_start, loop_end)

-- clear current track
local index = new_loop_start
while index <= new_loop_end do
local row = renoise.song().sequencer.pattern_sequence[index]
renoise.song().patterns[row].tracks[renoise.song().selected_track_index]:clear()
index = index + 1
end

-- update loop sequence
renoise.song().transport.loop_sequence_range = {new_loop_start, new_loop_end}
end
end

----------------------------------------------------
--Menu Items
----------------------------------------------------

renoise.tool():add_menu_entry {
name = "Main Menu:Tools:AutoClonePatterns:enable",
invoke = function()
start()
end
}

renoise.tool():add_menu_entry {
name = "Main Menu:Tools:AutoClonePatterns:disable",
invoke = function()
stop()
end
}

----------------------------------------------------
--Keybindings
----------------------------------------------------

renoise.tool():add_keybinding {
name = "Pattern Matrix:Tools:AutoClonePatterns Enable",
invoke = function()
start()
end
}

renoise.tool():add_keybinding {
name = "Pattern Matrix:Tools:AutoClonePatterns Disable",
invoke = function()
stop()
end
}

renoise.tool():add_keybinding {
name = "Pattern Matrix:Tools:AutoClonePatterns Toggle On/Off",
invoke = function()
toggle()
end
}
[/lua]

Edited by Conner_Bw, 17 September 2010 - 20:16.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#13 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 20:16

Code updated (but still not tested...)

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#14 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 17 September 2010 - 22:31

I tested my version, works fine.

Cut and paste into bystrano's main.lua?

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#15 bystrano

bystrano

    Advanced Member

  • Normal Members
  • PipPipPip
  • 72 posts

Posted 18 September 2010 - 00:19

encountered a bug;

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
[/lua] while in my version it's [lua] 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[/lua] and is executed every idle time only if edit mode is on. The notifier checks are called when edit mode is toggled, not every idle time. So I agree, your version requires less API calls, but does that really make a difference at that point? In my opinion, the fact that my version uses the app_idle notifier only when edit mode is on makes a bigger difference.

#16 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 18 September 2010 - 00:58

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,

Edited by Conner_Bw, 18 September 2010 - 01:39.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#17 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 18 September 2010 - 09:06

Heh, Jonas, don't you love dem notifiers ;)


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

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


Thanks m8, works perfect!

#18 bystrano

bystrano

    Advanced Member

  • Normal Members
  • PipPipPip
  • 72 posts

Posted 18 September 2010 - 10:35

* 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.

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! :)

Hope to see your script on the tools page soon!

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

#19 silverwings

silverwings

    Advanced Member

  • Normal Members
  • PipPipPip
  • 102 posts
  • Gender:Male
  • Location:up in the dutch skies

Posted 18 September 2010 - 11:05

yay²! , thanks.

#20 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 18 September 2010 - 12:07

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 :-) :

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?

#21 bystrano

bystrano

    Advanced Member

  • Normal Members
  • PipPipPip
  • 72 posts

Posted 18 September 2010 - 14:51

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

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.

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.

Attached Files



#22 Djeroek

Djeroek

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6763 posts
  • Gender:Male
  • Location:Borneo

Posted 18 September 2010 - 15:18

Anyway here is the tool I wrote, but it should be treated as highly experimental.


Nice! Seems to work here fine :) , thanks!

Am trying to push it to generate possible bugs, and thus far had a crash trying to undo all recorded input with your script enabled, crash gave the following notice in Renoises log:

CrashLog: Handling Exception! Code : C0000005
CrashLog: 0082ACCF: xmlUCSIsCat +490FF

Application: Caught an unhandled exception (Thread: GUI)!
Application: Saving a backup...

Error Message: A fatal error or crash occurred (unhandled exception in thread: GUI).
Error Message: A backup of the current document was saved at
Error Message: 'C:\Users\plugexpert\AppData\Roaming\Renoise\V2.6.0\CrashBackups\Untitled_9_18_2010__16_8_crash.xrns'...
Error Message: This either happened because of a bug in Renoise, or because of a bug in one of its loaded components (plugins). Please contact <bug@renoise.com> and report this problem, so that it can be fixed.
Error Message: Note: It's very important that we know exactly what has happened (what you were doing before this message popped up), or the problem cannot be replicated/analyzed. Please include a description of what you were doing and which components were being used...

Application: Terminating...



#23 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 18 September 2010 - 15:47

IMHO, a variation of the Auto Add Pattern concept could be used to build something, here's a simple spec:

1) Set up a loop in the pattern matrix with the mouse

2) Activate script, start recording

3) The script creates 6 tracks, bright red (like, a rectangle where Y is the loop and X are the tracks) in the pattern matrix, puts Xs on them for good measure. This is to distinguish them from normal tracks

4) As the user records, takes are shifted to the red tracks.

That's it.

It implies that the user has 6 "punch in tracks" that will be overridden as time goes on, but at least it gives you 6 takes you can use. Change 6 to X if it's a variable.

It also means idle cpu would be enough to handle this.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#24 bystrano

bystrano

    Advanced Member

  • Normal Members
  • PipPipPip
  • 72 posts

Posted 18 September 2010 - 16:46

@ Jonas :
Looks like a new bug report thread is born.. I can't reproduce it though, and I have no idea what could have caused this. Anyway, buggy scripts can trigger error messages, but if renoise crashes, it's a bug in renoise.

@ Conner_Bw :
Don't you think step 4 will be a problem to implement? It should happen when the end of the pattern is reached, and I can't think of a reliable way to "observe" this...

#25 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7167 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 18 September 2010 - 16:55

@ Conner_Bw :
Don't you think step 4 will be a problem to implement? It should happen when the end of the pattern is reached, and I can't think of a reliable way to "observe" this...


Minimum 2 patterns?

Shift previous track at any time the current track is playing.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »