## Cycles of 8

Sep 30, 2012 at 8:43pm

# Cycles of 8

Hello,
I really want to be able to count in cycles of 8. Currently I have a number box which shows what (absolute) bar I am on in an Ableton live track. I want to know what this means in a cycle of 8, so that the number box would start at 1 every 8 numbers. Therefore number 9 would equal 1, 10 would equal 2, 11 would equal three……….then 17 would equal 1, 18 would equal 2, etc. Is there a way this could be done?

#64559
Sep 30, 2012 at 8:59pm

[%]

#232954
Sep 30, 2012 at 9:25pm

One more question.
When I have it set up, If I make the right operand 9, (so that that the result goes as high as 8), on the 9th, 17th, 25th, etc. count the remainder is 0. I would like this to start at 1.
I am counting bars in cycles of 8, so I want the cycle to go 1, 2, 3, 4, 5, 6, 7, 8, (THEN) 1,2,3,4,5,6,7,8. Right now it goes
1,2,3,4,5,6,7,8 THEN 0,1,2,3,4,5,6,7,8 etc. Anyway to do this.
Thanks!

#232955
Sep 30, 2012 at 9:27pm

[% 8] -> [+ 1]

#232956
Sep 30, 2012 at 9:36pm

Also thank you for your help.
But wont that add 1 to every number?

All I need is that instead of the result equaling 0 when the incoming number is 8, or 16, I need it to actually say 8, then on the following number start at 1 again.
Thank you

#232957
Sep 30, 2012 at 10:01pm

expr (\$i1-1)%8+1

#232958
Sep 30, 2012 at 10:02pm

Okay, I’ll spell it out for you. %9 will give you a set of 9 numbers (0…8) – you only want 8, so you need %8. This will give you a cycle of 0-7. If your first incoming number is 1, and not zero, you should subtract 1 on the input on your modulo – and then add it back at the end. [- 1] -> [%8] -> [+ 1]

Given a series of numbers from 1…N, this will give you cycles of 1…8 mapped correctly. IE, the first bar (1) is now labelled 0, into modulo (the %), that stays 0, and then gets 1 added to it to become number 1. Your 7th bar is now a ’6′ before it gets to a modulo, stays 6 inside the modulo, and becomes 7 again on the output. The 9th bar is now ’8′ before it gets to modulo, which modulo will wrap down to ’0′ – and then you add 1.

So yes, it will add 1 to all the numbers. That’s what you want.

– Pasted Max Patch, click to expand. –
#232959
Sep 30, 2012 at 10:02pm

let me join this chain of genius:

[- 1] -> [% 8] -> [+ 1]

#232960
Sep 30, 2012 at 10:03pm

WE’RE ALL MATHLETES HERE

#232961
Sep 30, 2012 at 10:48pm

Seriously, thank you guys. I had to laugh at my own dumbass, but you helped a lot.
I am clearly not as well versed as you are all in MAX so it is great that you guys take the time to help. @MuShoo @Andrzej I was really laughing hard, but you seriously taught me what’s up.

#232962

You must be logged in to reply to this topic.