cl-patterns

Introduction

cl-patterns is a library for conveniently(?) writing patterns to generate or process (a)musical sequences of mathematically (un)related (non-)compound values in Lisp.

Put more simply, cl-patterns is a system for sequencing and composing music and noise via Lisp code.

Its code is primarily hosted on GitHub, which is also the best place to find its documentation currently; see the README for the overview, or the doc directory for additional help and information.

It is also more conveniently available via Common Lisp's Quicklisp package manager simply by calling (ql:quickload :cl-patterns).

Examples

Amen break

It should be fairly easy to write the amen break based on textual notation. For example, the page here provides drum tabs. There's no reason a computer couldn't read these as easily as a human can.

(tempo 136/60) ;; set the tempo of the primary clock to 136 BPM.

(pb :hat
  :instrument :hat
  :dur 1/2 ;; play the hihat every 1/2 beat
  :pfindur 4 ;; limit the pattern to 4 beats in length (it loops automatically)
  :quant 4)

(pb :snare
  :embed (pcycles "----o--o-o--o--o") ;; using the snare tab from the page linked above
  :instrument :snare
  :dur 1/4
  :quant 4)

(pb :kick
  :embed (pcycles "o-o-------oo----")
  :instrument :kick
  :dur 1/4
  :quant 4)

;; play the patterns we've defined:
(mapc 'play (list :hat :snare :kick))

...etc

See the cl-patterns cookbook for more recipes and inspiration.

See also