kyma•tweaky . Learn . OneClockToRuleThemAll

One Clock to Rule Them All

Free running clocks can drift out of sync with each other. Better to use one (faster) clock and trigger everything off submultiple of that one clock.

Suppose you wanted to trigger several different Sounds at different multiples of the same BPM. In other words, say you would like to trigger Sound A once per beat, Sound B twice per beat (like eighth notes), Sound C three times per beat (like triplets), and Sound D four times per beat (like sixteenth notes).

It's tempting to synchronize them by using a different BPM clock in each trigger field, for example:

1 bpm: !BPM

in the Sound A's trigger field,

1 bpm: !BPM * 2

in Sound B's trigger field

1 bpm: !BPM * 3


1 bpm: !BPM * 4

in Sound D's trigger field. This is like giving each Sound its own, free-running clock; over time, these clocks can start to drift apart from one another.

A better practice is to use one BPM clock and to trigger each of the Sounds off a submultiple of this one clock using the triggerEvery: message. For example,

(1 bpm: !BPM) triggerEvery: 4

would trigger on every fourth beat of the metronome. Since this expression has the effect of dividing down the !BPM rate, you have to start with the fastest common multiple of all the rates as your common clock.

To translate the example into one using a single clock:

  1. Use a common multiple of all the rates as the master BPM clock rate
  2. Divide down this rate using the triggerEvery:

In our example, the rates are: 1, 2, 3, and 4. To come up with a common multiple of the rates, just multiply them:

1 * 2 * 3 * 4 = 24

You might have noticed that there is a smaller common multiple of these numbers: 12. You can use 12 or 24 in the example; either one works. All of the trigger expressions can now be based on a common BPM clock:

1 bpm: !BPM * 12

The once per beat clock becomes:

(1 bpm: !BPM * 12) triggerEvery: 12

The twice per beat clock becomes:

(1 bpm: !BPM * 12) triggerEvery: 6

The three times per beat clock becomes:

(1 bpm: !BPM * 12) triggerEvery: 4

and the four times per beat clock is:

(1 bpm: !BPM * 12) triggerEvery: 3

Since all four of the Sounds share a common BPM clock, they will stay synchronized with each other.

-- CarlaScaletti - 27 Aug 2004

----- Revision r1.1 - 27 Aug 2004 - 01:38 GMT - CarlaScaletti
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.