tur/temporal
slow
(slow [factor p])
play a pattern slower by a given factor.
| factor | slowdown factor (> 1 = slower) | |
| p | pattern to slow down |
Pattern<T> that plays at 1/factor speed. ((slow 2 my-pat) 1.0) ; same as (my-pat 0.5)
fast
(fast [factor p])
play a pattern faster by a given factor.
| factor | speedup factor (> 1 = faster) | |
| p | pattern to speed up |
Pattern<T> that plays factor times faster. ((fast 2 my-pat) 1.0) ; same as (my-pat 2.0)
stretch
(stretch [factor p])
stretch time within a cycle (alias for slow).
| factor | stretch factor | |
| p | pattern to stretch |
Pattern<T> with stretched time.
compress
(compress [factor p])
compress time within a cycle (alias for fast).
| factor | compression factor | |
| p | pattern to compress |
Pattern<T> with compressed time.
shift
(shift [offset p])
shift a pattern forward or backward in time.
| offset | time offset in beats (positive = later, negative = earlier) | |
| p | pattern to shift |
Pattern<T> shifted in time. ((shift 0.5 my-pat) 1.0) ; same as (my-pat 1.5)
rot
(rot [amount p])
rotate a pattern's phase (alias for shift).
| amount | rotation amount in beats | |
| p | pattern to rotate |
Pattern<T> with shifted phase.
mirror
(mirror [p])
mirror a pattern within each 2-beat window.
| p | pattern to mirror |
Pattern<T> that plays forward in [0,1) then backward in [1,2). ((mirror my-pat) 1.5) ; reads from time 0.5
rev
(rev [p])
reverse a pattern within each 1-beat cycle.
| p | pattern to reverse |
Pattern<T> with reversed time within each cycle. ((rev my-pat) 0.25) ; same as (my-pat 0.75)
repeat
(repeat [n p])
repeat a pattern n times within its cycle.
| n | repetition count | |
| p | pattern to repeat |
Pattern<T> playing n times faster. ((repeat 4 my-pat) 0.0)
once
(once [p & [zero 0])
play a pattern only during the first beat, then return zero.
| p | pattern to play | |
| zero | value after the first cycle (default: 0) |
Pattern<T> that silences after time >= 1.0.
for-beats
(for-beats [duration p & [zero 0])
play a pattern for a fixed number of beats, then return zero.
| duration | duration in beats | |
| p | pattern to play | |
| zero | value after duration (default: 0) |
Pattern<T> active for duration beats.
loop-cycles
(loop-cycles [cycles p & [zero 0])
loop a pattern for a fixed number of cycles then stop.
| cycles | number of cycles to loop | |
| p | pattern to loop | |
| zero | value after looping ends (default: 0) |
Pattern<T>.
loop-range
(loop-range [start end p & [zero 0])
loop a pattern between two time points.
| start | start time in beats | |
| end | end time in beats | |
| p | pattern to loop | |
| zero | value outside [start, end) (default: 0) |
Pattern<T> looping within the window.
warp
(warp [warp-fn p])
remap time using an arbitrary function.
| warp-fn | Beats -> Beats transformation applied to time before evaluation | |
| p | pattern to warp |
Pattern<T> evaluated at warped time.
warp-by
(warp-by [warp-pat p])
remap time by multiplying with values from another pattern.
| warp-pat | NumPattern producing a time-scaling factor | |
| p | pattern to warp |
Pattern<T> evaluated at time * warp-pat(time).
quantize-beat
(quantize-beat [p])
snap pattern evaluation to the nearest beat boundary.
| p | pattern to quantize |
Pattern<T> that only changes on whole-beat boundaries.
quantize
(quantize [n p])
snap pattern evaluation to multiples of n beats.
| n | quantization grid size in beats | |
| p | pattern to quantize |
Pattern<T> quantized to n-beat intervals. (quantize 0.25 my-pat) ; 16th-note grid
quantize-subdiv
(quantize-subdiv [subdivisions p])
snap pattern evaluation to a subdivision grid.
| subdivisions | number of subdivisions per beat (e.g., 4 = 16th notes) | |
| p | pattern to quantize |
Pattern<T> quantized to 1/subdivisions-beat steps.
time-mod
(time-mod [period p])
wrap time into a [0, period) window before evaluation.
| period | period in beats | |
| p | pattern to wrap |
Pattern<T> evaluated with time mod period.
time-switch
(time-switch [period & patterns])
cycle through a list of patterns, each lasting period beats.
| period | duration per pattern in beats | |
| patterns | patterns to cycle through |
Pattern<T> switching to the next pattern every period beats. ((time-switch 4 pat-a pat-b pat-c) 5.0) ; uses pat-b
transform-time
(transform-time [p & transformations])
apply a sequence of temporal transformations to a pattern.
| p | base pattern | |
| transformations | list of [transform-fn args...] pairs to apply in order |
Pattern<T> with all transformations applied. (transform-time (cycle 1 2 3) [slow 2] [shift 0.5] [repeat 2])
backwards
(backwards [p & [duration 1.0])
play a pattern in reverse within each cycle.
| p | pattern to reverse | |
| duration | cycle duration in beats (default: 1.0) |
Pattern<T> playing backwards.
palindrome
(palindrome [p & [duration 1.0])
play a pattern forwards then backwards (ping-pong).
| p | pattern to palindrome | |
| duration | half-period in beats (default: 1.0) |
Pattern<T> playing forward then backward in a 2*duration window. ((palindrome my-pat) 1.5) ; reads from time 0.5 (backwards half)
stutter
(stutter [subdivisions p])
repeat each value of a pattern subdivisions times.
| subdivisions | how many times to repeat each value | |
| p | pattern to stutter |
Pattern<T> with stuttered output. ((stutter 4 my-pat) 0.5) ; reads from floor(0.5/4) = 0
time-window
(time-window [start end p & [zero 0])
gate a pattern to a specific time window.
| start | window start in beats | |
| end | window end in beats | |
| p | pattern to window | |
| zero | value outside the window (default: 0) |
Pattern<T> active only in [start, end).
fade-in
(fade-in [fade-duration p])
produce a linear ramp from 0 to 1 over fade-duration beats.
| fade-duration | duration of the fade in beats | |
| p | pattern (currently unused, ramp only) |
NumPattern rising linearly to 1.0 then holding at 1.0.
fade-out
(fade-out [fade-duration start-time p])
produce a linear ramp from 1 to 0 starting at start-time.
| fade-duration | duration of the fade in beats | |
| start-time | beat at which the fade begins | |
| p | pattern (currently unused, ramp only) |
NumPattern holding 1.0 before start-time, then falling to 0.0.