# 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?

[%]

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!

[% 8] -> [+ 1]

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

expr ($i1-1)%8+1

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.

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
496.3ocyVtsaiBCDF9Z3ovxR8pkFgM3.6d29bTspx.yl5JhcjwzlsU8cewlC
McURwIJhtWDi7g7O+yGyXwqgA3B0dnAi9A5NTPvqgAAtkrKDLLO.ukuurl23
NF1n1roFvQ8asiaJePH2buFJM8xPyhWEGgV6FoSineM7WjsaUslZv3ziLIjl
uELf9dPxK5BP2dwC60ebye1A8Q.KjcwZTOQkyWphGukDieOHB4TLrq8VXncH
xyzTBO2o3nbFXuK6vcVTqPr334Av26w.yS.7akzzHdwkhD5pSl6Eb4lil743
CTR1AS2N+TK30GkJzqGUJUsxtWcHBJgNOXH8EEYYyPlzyjL1phHDd72oJRxN
SNwtDN0ts.zyihgGr45RneNJN6lmnOoNZ8js0PCHMbiPIOl0swGEOLLojmT8
J1S9MDwCRm5djPWwtpsimpJi800MdCJ2CdPVVdj90wia8o9fjur7HYI3gm2B
QX++cKDEe42m3zCWKj+6W13Pfc8OBsFUqtbzXieGA5cJTAMFgzcO3AGJ+Cm4
AQUEHOLkqDMVJ3Ro3i91yW6j6gaxVL2j4ganKlaXd3l0KlaR8vMrEyMId3lz
EyMTObSxE5l9Nd9tcOA5lAIcFo6BwGUZ6z0QtoBY+TmhXM7jX77YgV0dK7u.
x9D.S.
-----------end_max5_patcher-----------
```

let me join this chain of genius:

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

WE’RE ALL MATHLETES HERE

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.