First time here? Check out the FAQ!

O bpm: !BPM nextIndexMod: n

0 votes
Hello everybody, This is more like a "metaphysical " question... Building up my own sequencers, I found out that the result of the expression: (0 bpm: !BPM) nextIndexMod: 16 is 15 Can somebody explain to me why?
asked Jan 18 in Capytalk & Smalltalk by domenico-cipriani (Practitioner) (640 points)

1 Answer

+2 votes
Best answer

Hello everybody, This is more like a "metaphysical " question... 

To give a metaphysical answer...

Since the first triggered value of nextIndexMod: is 0, its value just before it is triggered should be one smaller than zero or (0 - 1).  Since you've asked for the result mod 16, the indexes count up from zero and, when the index gets to 15, the next value is not 16 but 0.  So the number just prior to 0 is actually 15.

answered Jan 18 by ssc (Savant) (46,190 points)
selected Jan 18 by domenico-cipriani