A Sample script for the not-things TimeSeq module.
A clock signal in VCV Rack can be created using a consistent gate signal. And since segments in TimeSeq can be looped and can have gate actions, a basic clock signal can be created easily. But because TimeSeq supports multiple timelines that can have different time-scales and one or more looping lanes, it’s also possible to set up a complex combination of clock signals in a TimeSeq script.
This page will give an example of simple script setup using a couple of bpms and beat subdivisions. It will output the different clock signals using different channels of the same polyphonic output port. While this is not really needed here since there are only a couple of clock signals, it is likely that in real-life scenarios, the script will also contain other output signals outside of the clock signals. Combining the clock signals into one output port frees up the other outputs for other usages in the script.
Since we want to send the clock outputs as polyphonic channels on the first output port, we’ll have to set up this polyphony first. We’ll do this using using the global-actions
property of the TimeSeq script. Actions in the global-actions
list are executed when a script is loaded or reset, so setting up the polyphony here will initialize that port and make polyphony on it available throughout the rest of the script:
"global-actions": [
{
"set-polyphony": {
"index": 1,
"channels": 5
}
}
]
The set-polyphony action specifies that the first output port should contain five polyphonic channels, which is how many clock signals we’ll generate in this sample.
The first timeline we’ll set up is one that will use a 120 Beats per Minutes (bpm
) time scale, with 4 Beats per Bar (bpb
):
{
"time-scale": { "bpm": 120, "bpb": 4 },
"lanes": [
]
}
This time-scale definition will set how beats
and bars
will be interpreted in all lanes that are part of that timeline.
For the first lane in this timeline, we’ll create a clock signal that fires on every beat of the 120 bpm. Just like all other lanes that will be added to this script, it will be set to auto-start
and loop
so that the clock is always running:
{
"auto-start": true, "loop": true,
"segments": [
{
"duration": { "beats": 1 },
"actions": [
{
"timing": "gate",
"output": { "index": 1, "channel": 1 } }
]
}
]
}
The gate action in this segment will generate a clock signal on the first channel of the output port, with the gate being high for the first half of the segment duration, and low for the second half.
The beat
property of the segment duration can also be set to decimal numbers. In the second lane we’ll set the beats
to a value of 1.75
:
{
"auto-start": true, "loop": true,
"segments": [
{
"duration": { "beats": 1.75 },
"actions": [
{
"timing": "gate",
"gate-high-ratio": 0.66,
"output": { "index": 1, "channel": 2 }
}
]
}
]
}
This lane will create a clock beat that lasts one and three quarters of the 120 bpm that is specified on the timeline (so slower then the previous lane, but not quite double as long). The clock signal will be sent to the second channel of the first output port.
The gate-high-ratio
property will control how long the clock signal will remain high (as a value between 0
and 1
). The 0.66
value used here will cause it to remain high for 66% of the segment duration, and low for 44% of the segment duration. This can be useful in certain scenarios, like when the clock signal is used for generating an ADSR envelope, and the sustain section of the envelope should be longer or shorter.
Since both a bpm
and a bpb
is specified on the time-scale of this timeline, a slow clock signal can also be expressed in bars
:
{
"auto-start": true, "loop": true,
"segments": [
{
"duration": { "beats": 0, "bars": 4 },
"actions": [
{
"timing": "gate",
"gate-high-ratio": 0.25,
"output": { "index": 1, "channel": 5 }
}
]
}
]
}
This clock will trigger every 4 bars on channel 5 of the first output port. When left on its default setting, this clock signal would remain high for 2 bars, and low for 2 bars. But with the gate-high-ratio
of 0.25
that is used here, it will only remain high for a quarter for the duration, and low for the remainder of the segment.
Because a script can have multiple timelines, the clock signals in a script don’t all have to use the same bpm
. This second timeline will use 90 Beats per Minute, and contain a segment that triggers the clock once for each of these 90 beats
. The output is sent to third channel of output port 1:
{
"time-scale": { "bpm": 90 },
"lanes": [
{
"auto-start": true, "loop": true,
"segments": [
{
"duration": { "beats": 1 },
"actions": [
{
"timing": "gate",
"output": { "index": 1, "channel": 3 }
}
]
}
]
}
]
}
Since the segment in this timeline doesn’t use a bars
time unit, we don’t specify a bpb
on the timeline time-scale.
The third timeline will be a bit more off-beat compared to the other timelines: the others were a multiple of 30, while this final timeline will use a bpm
of 70. It will again trigger on every beat of these 70 Beats per Minute, and send that clock signal to the fourth channel of the first output port.
{
"time-scale": { "bpm": 70, "bpb": 4 },
"lanes": [
{
"auto-start": true, "loop": true,
"segments": [
{
"duration": { "beats": 1 },
"actions": [
{
"timing": "gate",
"output": { "index": 1, "channel": 4 }
}
]
}
]
}
]
}
The full clock script can be found in clock.json.
The clock.vcv patch will split up the five clock signals from the polyphonic output port and use each of the clock signals to generate a separate ADSR Envelope. This Envelope will be used to control the volume of five VCOs (each playing a different note).
The clock signals themselves will also be shown on oscilloscopes: the four shorter clocks are combined on the Count Modula Oscilloscope, and the slow clock on a VCV Scope.