# Time Modifiers

The following functions modify a pattern temporal structure in some way. Some of these have equivalent operators in the Mini Notation:

functionmini
`"x".slow(2)``"x/2"`
`"x".fast(2)``"x*2"`
`"x".euclid(3,8)``"x(3,8)"`
`"x".euclidRot(3,8,1)``"x(3,8,1)"`

## slow

Synonyms: `sparsity`

Slow down a pattern over the given number of cycles. Like the "/" operator in mini notation.

• factor (number|Pattern): slow down factor
`s("<bd sd> hh").slow(2) // s("[<bd sd> hh]/2")`

## fast

Synonyms: `density`

Speed up a pattern by the given factor. Used by "*" in mini notation.

• factor (number|Pattern): speed up factor
`s("<bd sd> hh").fast(2) // s("[<bd sd> hh]*2")`

## early

Nudge a pattern to start earlier in time. Equivalent of Tidal's <~ operator

• cycles (number|Pattern): number of cycles to nudge left
`"bd ~".stack("hh ~".early(.1)).s()`

## late

Nudge a pattern to start later in time. Equivalent of Tidal's ~> operator

• cycles (number|Pattern): number of cycles to nudge right
`"bd ~".stack("hh ~".late(.1)).s()`

## legato

Multiplies the hap duration with the given factor.

`note("c3 eb3 g3 c4").legato("<.25 .5 1 2>")`

## euclid

Changes the structure of the pattern to form an euclidean rhythm. Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers. They were described in 2004 by Godfried Toussaint, a canadian computer scientist. Euclidian rhythms are really useful for computer/algorithmic music because they can describe a large number of rhythms with a couple of numbers.

• pulses (number): the number of onsets / beats
• steps (number): the number of steps to fill
```// The Cuban tresillo pattern.
note("c3").euclid(3,8)```

### euclidRot

Like `euclid`, but has an additional parameter for 'rotating' the resulting sequence.

• pulses (number): the number of onsets / beats
• steps (number): the number of steps to fill
• rotation (number): offset in steps
```// A Samba rhythm necklace from Brazil
note("c3").euclidRot(3,16,14)```

### euclidLegato

Similar to `euclid`, but each pulse is held until the next pulse, so there will be no gaps.

`n("g2").decay(.1).sustain(.3).euclidLegato(3,8)`

## rev

Reverse all haps in a pattern

`note("c3 d3 e3 g3").rev()`

## palindrome

Applies `rev` to a pattern every other cycle, so that the pattern alternates between forwards and backwards.

`note("c d e g").palindrome()`

## iter

Divides a pattern into a given number of subdivisions, plays the subdivisions in order, but increments the starting subdivision each cycle. The pattern wraps to the first subdivision after the last subdivision is played.

`note("0 1 2 3".scale('A minor')).iter(4)`

### iterBack

Synonyms: `iterback`

Like `iter`, but plays the subdivisions in reverse order. Known as iter' in tidalcycles

`note("0 1 2 3".scale('A minor')).iterBack(4)`

## ply

The ply function repeats each event the given number of times.

`s("bd ~ sd cp").ply("<1 2 3>")`

## segment

Samples the pattern at a rate of n events per cycle. Useful for turning a continuous pattern into a discrete one.

• segments (number): number of segments per cycle
`note(saw.range(0,12).segment(24)).add(40)`

## compress

Compress each cycle into the given timespan, leaving a gap

```cat(
s("bd sd").compress(.25,.75),
s("~ bd sd ~")
)```

## zoom

Plays a portion of a pattern, specified by the beginning and end of a time span. The new resulting pattern is played over the time period of the original pattern:

```s("bd*2 hh*3 [sd bd]*2 perc").zoom(0.25, 0.75)
// s("hh*3 [sd bd]*2") // equivalent```

## linger

Selects the given fraction of the pattern and repeats that part to fill the remainder of the cycle.

• fraction (number): fraction to select
`s("lt ht mt cp, [hh oh]*2").linger("<1 .5 .25 .125>")`

## fastGap

Synonyms: `fastgap`

speeds up a pattern like fast, but rather than it playing multiple times as fast would it instead leaves a gap in the remaining space of the cycle. For example, the following will play the sound pattern "bd sn" only once but compressed into the first half of the cycle, i.e. twice as fast.

`s("bd sd").fastGap(2)`

## inside

Carries out an operation 'inside' a cycle.

```"0 1 2 3 4 3 2 1".inside(4, rev).scale('C major').note()
// "0 1 2 3 4 3 2 1".slow(4).rev().fast(4).scale('C major').note()```

## outside

Carries out an operation 'outside' a cycle.

```"<[0 1] 2 [3 4] 5>".outside(4, rev).scale('C major').note()
// "<[0 1] 2 [3 4] 5>".fast(4).rev().slow(4).scale('C major').note()```

## cpm

Plays the pattern at the given cycles per minute.

`s("<bd sd>,hh*2").cpm(90) // = 90 bpm`

## ribbon

Loops the pattern inside at `offset` for `cycles`.

• offset (number): start point of loop in cycles
• cycles (number): loop length in cycles
```// Looping a portion of randomness
note(irand(8).segment(4).scale('C3 minor')).ribbon(1337, 2)```

Apart from modifying time, there are ways to Control Parameters.