shift sequence startingpoint, wraparound?

dibek's icon

Hi,

i´m driving a sequencer with a counter and a coll which stores 16 values, each value a step.

i use a dial to shift the start of the sequence but of course this shifts the whole sequence out of the 1-16 steps for the number of shifted steps.

how could i wraparound the numbers so it becomes for example 5 .... 5 rather then 5 ... 21.

Hope this makes sense :)

thanks!

double_UG's icon

pong @mode warp

Max Patch
Copy patch and select New From Clipboard in Max.

dibek's icon

Great, thanks!

Roman Thilenius's icon

.

expr (($i1%16)!=0)*($i1%16) + (($i1%16)==0) * 16


or, if you want it to work with negative shifting, too,

expr ((($i1%16) + (16)*(($i1%16)==0))*($i1>=0)) + ((((($i1%16)+16) + (-16)*((($i1%16)+16)==0))*($i1<0)))



dibek's icon

Thank you, Roman!