How would you design a clock in order to play triplets?

If you take a master clock (e.g. 1 Hz) it is easy to get the quarter notes (every pulse), the half notes (every two pulses), and the whole notes (every four pulses) to build a simple drum machine.

What would I need to do in order to create a steady stream of triplets1 from a master clock?

1 A triplet is when three notes of a type take up the same duration as two regular notes of the same type. E.g. three triplet quarter notes are the same 'length' as two quarter notes.

• What's the difficulty in dividing by 3 ? – Soldersmoke Sep 12 at 4:41
• You're clocking off an oscillator many orders of magnitude faster. You won't notice if each beat is is off by a few millionths unless you have two unsyncrhonized machines playing tens or hundreds of thousands of beats alongside each other. Just divide and round unless there is some reason you need it to be exact. – DKNguyen Sep 12 at 5:03

6 has factors 2 and 3. So if you start with a clock that is 6× your quarter note rate, you can divide by 2 to get eighth-note triplets and by 3 to get eighth notes.

The MIDI system clock messages are transmitted at a rate of 24 per quarter note (2×2×2×3), which allows 64th-note triplets to be generated directly.

• Every clock → 64th triplets
• Every 2nd clock → 32nd triplets
• Every 3rd clock → 32nd notes
• Every 4th clock → 16th triplets
• Every 6th clock → 16th notes
• Every 8th clock → 8th triplets
• Every 12th clock → 8th notes
• Every 16th clock → quarter triplets
• Every 24th clock → quarter notes

... and so on.

• Could you clarify what the master frequency be or is that arbitrary and selected by the designer. – Ben Madison Sep 12 at 17:20
• What "master frequency" are you talking about? – Dave Tweed Sep 12 at 17:42
• I mean what clock frequency should be used to derive the required stuff or is the clock chosen in relation to the tempo set – Ben Madison Sep 12 at 18:10
• The clocks that I'm talking about are set according to the tempo. They would normally be synthesized from a crystal timebase, perhaps using something like DDS. See previous questions here relating to dds. – Dave Tweed Sep 12 at 18:52