Forums > Max For Live

Cycles of 8

September 30, 2012 | 8:43 pm

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?


September 30, 2012 | 8:59 pm

[%]


September 30, 2012 | 9:25 pm

Thank you so much. I have been thinking about this for days (!)
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!


September 30, 2012 | 9:27 pm

[% 8] -> [+ 1]


September 30, 2012 | 9:36 pm

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


September 30, 2012 | 10:01 pm

expr ($i1-1)%8+1


September 30, 2012 | 10:02 pm

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


ak
September 30, 2012 | 10:02 pm

let me join this chain of genius:

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


September 30, 2012 | 10:03 pm

WE’RE ALL MATHLETES HERE


September 30, 2012 | 10:48 pm

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.


Viewing 10 posts - 1 through 10 (of 10 total)