Rotate stepnote patterns

Discuss Lemur and share techniques.
ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51
Rotate stepnote patterns

Post by ChiLam » 02 Dec 2014 18:59

Hi,

I'm wondering if it is possible to shift/rotate the stepnote patterns using a script?

I'm looking to add a button which will move the entire stepnote pattern one step to the right/left but don't seem to find a way to achieve this - any ideas guys? ;)

I'm guessing that the StepNote object is built as an array but I can't find any details in the editor relating to this!

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: Rotate stepnote patterns

Post by ndivuyo » 02 Dec 2014 20:55

Here is one solution. Take from the code, there are other ways to do it too.
hope it helps

Also you can add additional scripts to store the array so you won't lose the pattern if it goes too far left or right
Attachments
move stepnote.jzml
here!
(6.92KiB)Downloaded 43 times

ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51

Re: Rotate stepnote patterns

Post by ChiLam » 02 Dec 2014 21:23

Wow, thank you so much! I shall study this immediatley - i'm guessing from your advice that I will need to modify to allow the pattern to "wrap-around" without falling off?

Again, thank you very much!

Ok! Have tested and understood - great work - unfortunatley I cannot seem to fathom the way to "rotate" the steps so they don't dissappear!?

ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51

Re: Rotate stepnote patterns

Post by ChiLam » 03 Dec 2014 02:49

OOf - I tried all night to find a way to make the pattern wrap-around on itself with no joy :cry:

Its pretty darn hard for a total newb to understand all the programming jargon. Thanks to ndivuyo i'm tantalisingly close to realising the step-sequencer I desire but I need to get this wrap-around business done - desperatley! Hey, i'd be more than happy to pay for someone to help me out on this - I realise that it takes time and effort and brains to be good at this programming lark and i'm failing miserably.

I found this script posted by another Lemur master called Macciza but cannot for the life of me make it work!


Heres a script for shifting
shift(array, val) Manual Trigger

decl len = sizeof(array);
val = val % len;
if(val>0) array={subarray(array,len-val,val),subarray(array,0,len-val)};
if(val<0) array={subarray(array,abs(val),len-abs(val)),subarray(array,0,abs(val))};
return array;

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: Rotate stepnote patterns

Post by ndivuyo » 03 Dec 2014 20:29

Hey ,
I'll take a look at it in a bit, so you need the pattern to repeat starting at the opposite end it moves off of (wrapping around)?
Unless another kind user helps you out, I'll see if I can put something together later, I'm not sure but if the StepNote object had a 'z' value it would probably be easier, I haven't thought about it much yet.
expect to hear back..

ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51

Re: Rotate stepnote patterns

Post by ChiLam » 03 Dec 2014 20:35

Hey big thanks for helping!

I have nearly managed - would you believe it! It works but only when going to the left! I can't seem to make it work going to the right though, which is strange since the script for both is identical apart from one plus/minus sign?

here is the template - massive thanks again, this is killing me it is so close!
Attachments
RotateStepNote.jzml
(6.18KiB)Downloaded 41 times

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: Rotate stepnote patterns

Post by ndivuyo » 03 Dec 2014 21:28

AA
well I almost got the right to work. It works except for the last value doesn't go through and they pop out at the start 1 space too far ahead.
It's almost there, so maybe you, or a greater mind, or me later when I have time will figure it out!
Good luck
Attachments
RotateStepNote.jzml
(5.63KiB)Downloaded 46 times

ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51

Re: Rotate stepnote patterns

Post by ChiLam » 03 Dec 2014 21:36

Thanks - much appreciated! Ill take a look and see but I doubt ill be able to solve this puzzler alone, Im too much of a newb unfortunately but ill give it a go.

Seems odd that it goes ok in one direction but not the other?

Thanks again kind sir!

ChiLam
Newbie
Posts:42
Joined:02 Dec 2014 18:51

Re: Rotate stepnote patterns

Post by ChiLam » 03 Dec 2014 22:07

Nice one! Solved!

Thanks so much for your help - I enjoyed seeing the template come back noticeably more streamlined and of a smaller size he he!

It all got fixed by changing the line from:

StepNote.x = subarray(vals,1-i,N);

to:

StepNote.x = subarray(vals,abs(1-i),N);

I have no idea what this means but it worked and I am a happy happy man! Could not have done it without your help so thanks a million! :D


AAAArghhh! No it doesn't work! I should have tested more - back to it then :cry:

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Rotate stepnote patterns

Post by Macciza » 03 Dec 2014 22:21

Hi
Here is a version using the above shift script,
Just read through the logic of the script
If it larger then 0 the script subarrays the array one way ,if less then 0 it does it differently
If you look at the subarray stuff you will see it is merely reassembling the original array based on the input number
In the switches i have merely used 1 and -1 but it could be any number to shift larger amounts ..

Cheers
RotateStepNote_mac.jzml
(8.81KiB)Downloaded 55 times
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

Post Reply