Skip to content

Latest commit

 

History

History
62 lines (39 loc) · 2.07 KB

sc-differences.org

File metadata and controls

62 lines (39 loc) · 2.07 KB

Differences between cl-patterns and SuperCollider patterns

This document is a WIP.

Terminology

  • SuperCollider requires you to coerce a pattern into a Stream in order to get results from it. Common Lisp already has the notion of a stream, so a pattern stream is known as a pstream.

New features

This section lists new features relative to SuperCollider’s patterns system. For more, and for a complete listing of notable cl-patterns features, see features.org.

  • coercion of patterns into pstreams is done automatically for you if you call next on a pattern:
Pseq([1,2,3]).next;
// => a Pseq
(next (pseq '(1 2 3)))
;; => 1
  • pwrand / pwxrand - weights are automatically normalized.
  • pdurstutter - works on event streams as well as number streams. (as do any duration-based patterns)
  • play-quant / end-quant - instead of just quant, a play-quant can be set to specify when a pattern can start playing, while end-quant sets when a pattern can end or swap to a new definition. setting quant sets both play-quant and end-quant at the same time.

Changed behaviors

  • non-patterns converted to pstreams only return one value:
(defparameter *foo* (as-pstream 1))

(next-n *foo* 3) ;=> (1 NIL NIL)
  • pbeat is the pattern that returns the number of beats elapsed in the pstream (in SuperCollider it’s known as Ptime).
  • pdefs loop by default when played.

This is because their loop-p slot defaults to t. Set it to nil to prevent this.

  • pfin, pfindur, pstutter, pdurstutter, etc, have their source pattern as the first input instead of the second, for consistency.
  • pchain overwrites pattern data from first to last.
Pchain(Pbind(\foo,1),Pbind(\foo,2)).asStream.next(())
// => (\foo:1)
(next (pchain (pbind :foo 1) (pbind :foo 2)))
;; => (event :foo 2)
  • pindex does not have a repeats argument.