Rhythm by Code

The third episode in my Teletype series. This time, I will create a simple rhythm machine with a bit of Grids-like density control on the hat. Easy to learn, lots of fun!

Here’s the code with some explanations.

Intitialization Script I
PARAM.SCALE 0 100
M 2000

In plain English:
Set the parameter knob scale to a range between 0 and 100
Set the metronome to 2 seconds (2000 msec)

Metronome Script M
This script executes every 2 seconds

CV 2 V RRND 1 8
CV 3 V RRND 1 8
CV 4 V RRND 1 8

So the metronome generates three random values between integer values between 1 and 8, kind of like octaves. They’re used for dramatic modulation of timbre and the modulation is not related to any clock.

SCRIPT 1
Script 1 is triggered by any clock, but expects 16th notes. So for every trigger, the following code gets executed:

EVERY 4: TR.PULSE 1
EVERY 8: TR.PULSE 2
DEL RRND 20 35: TR.PULSE 3
PROB PARAM: TR.PULSE 4
PROB PARAM: CV 1 V RRND 1 5
EVERY 13: TR.PULSE 1

For every fourth trigger, fire a pulse to trigger 1 – the kick
For every eighth trigger, fire a pulse to trigger 2 – the snare
So these two lines are clock dividers creating a four on the floor.
Wait a few milliseconds. The number of milliseconds is random between 20 and 35. Then, fire trigger 3 – the ‘human’ hat.
The parameter knob can be read with the PARAM keyword. We’ll use it to set a probability between 0 and 100 for firing off Trigger 4.
We’ll use the same probability to send CV to CV output 1, a voltage of 1, 2, 3, 4 or 5 volt (integer values).
Every 13th trigger we’ll fire another kick, creating polyrhythmic variations in the kick pattern.

You May Also Like