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.

Logitech G522 Lightspeed Wireless Gaming Headset, Full-Band Mic, Advanced Audio, Tri-Connect (Lightspeed, Bluetooth, USB A to C), LIGHTSYNC RGB, for PC & Nintendo Switch/Switch 2 – Black

Logitech G522 Lightspeed Wireless Gaming Headset, Full-Band Mic, Advanced Audio, Tri-Connect (Lightspeed, Bluetooth, USB A to C), LIGHTSYNC RGB, for PC & Nintendo Switch/Switch 2 – Black

Own Your Look: Experience the bold, sleek design of this RGB gaming headset, featuring customizable side-facing lighting powered...

As an affiliate, we earn on qualifying purchases.

Logitech G535 Lightspeed Wireless Gaming Headset - Lightweight on-Ear Headphones, flip to Mute mic, Stereo, USB Rechargeable - Black

Logitech G535 Lightspeed Wireless Gaming Headset - Lightweight on-Ear Headphones, flip to Mute mic, Stereo, USB Rechargeable - Black

LIGHTSPEED Wireless: Pro-grade LIGHTSPEED wireless technology provides 33 hours of battery life(1) and up to 12 meters of...

As an affiliate, we earn on qualifying purchases.

Corsair Void v2 Wireless Gaming Headset with Bluetooth for PC, PS5, PS4, Switch, Mobile – Dolby Atmos, 70 Hr Battery, Dual Wireless, Lightweight, Fast Charging – Carbon

Corsair Void v2 Wireless Gaming Headset with Bluetooth for PC, PS5, PS4, Switch, Mobile – Dolby Atmos, 70 Hr Battery, Dual Wireless, Lightweight, Fast Charging – Carbon

Ultra-fast 2.4GHz wireless or Bluetooth: Stay connected with low-latency 2.4GHz wireless* for high-performance gaming and Bluetooth for added...

As an affiliate, we earn on qualifying purchases.

HyperX Cloud Alpha Wireless - Gaming Headset for PC, 300-hour battery life, DTS Headphone:X Spatial Audio, Memory foam, Dual Chamber Drivers, Noise-canceling mic, Durable aluminum frame,Red

HyperX Cloud Alpha Wireless - Gaming Headset for PC, 300-hour battery life, DTS Headphone:X Spatial Audio, Memory foam, Dual Chamber Drivers, Noise-canceling mic, Durable aluminum frame,Red

Up to 300 hours of wireless gaming: Play knowing you’ll get weeks of gaming out of a single...

As an affiliate, we earn on qualifying purchases.

You May Also Like