Difference between revisions of "seqP"

From TidalCycles userbase
Jump to: navigation, search
Line 2: Line 2:
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>seqP :: [(Time, Time, Pattern a)] -> Pattern a</syntaxhighlight>
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>seqP :: [(Time, Time, Pattern a)] -> Pattern a</syntaxhighlight>
  
'''seqP''' allows you to define when a list of patterns starts and ends. The code below contains three separate patterns in a “stack”, but each has different start times (zero cycles, eight cycles, and sixteen cycles, respectively). In the example, all patterns stop after 12 cycles:
+
'''seqP''' allows you sequence patterns, with start and end times. The code below contains three separate patterns in a “stack”, but each has different start times (zero cycles, eight cycles, and sixteen cycles, respectively). In the example, all patterns stop after 12 cycles:
  
 
<source>
 
<source>

Revision as of 21:47, 2 December 2018

Type: seqP :: [(Time, Time, Pattern a)] -> Pattern a

seqP allows you sequence patterns, with start and end times. The code below contains three separate patterns in a “stack”, but each has different start times (zero cycles, eight cycles, and sixteen cycles, respectively). In the example, all patterns stop after 12 cycles:

d1 $ seqP [ 
  (0, 12, sound "bd bd*2"), 
  (4, 12, sound "hh*2 [sn cp] cp future*4"), 
  (8, 12, sound (samples "arpy*8" (run 16)))
]

If you run the above, you probably won’t hear anything. This is because cycles start ticking up as soon as you start Tidal, and you have probably already gone part cycle 12.

You can reset the cycle clock back to zero by running cps (-1) followed by cps 1 (nb: at the time of writing, this doesn't yet work in version 1.0.0 of tidal), or whatever tempo you want to restart at. Alternatively, you can shift time for the seqP pattern back to zero like this:

d1 $ (pure now) ~> seqP [ 
  (0, 12, sound "bd bd*2"), 
  (4, 12, sound "hh*2 [sn cp] cp future*4"), 
  (8, 12, sound (samples "arpy*8" (run 16)))
]

seqPLoop

Type: seqPLoop :: [(Time, Time, Pattern a)] -> Pattern a

A third option is to use seqPLoop instead, which will keep looping the sequence when it gets to the end:

d1 $ (pure now) ~> seqPLoop [ 
  (0, 12, sound "bd bd*2"), 
  (4, 12, sound "hh*2 [sn cp] cp future*4"), 
  (8, 12, sound (samples "arpy*8" (run 16)))
]