The cl-patterns Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-patterns Reference Manual

This is the cl-patterns Reference Manual, version 0.6, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 15:09:21 2021 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

#+TITLE: cl-patterns

A library for 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 making music and noise via Lisp code.

It is heavily inspired by [[https://supercollider.github.io/][SuperCollider]]'s [[http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_01_Introduction.html][patterns system]], with aims to implement much of it, but in a more robust, expressive, consistent, reflective, and lispy way:

- robust: prefer coercing values into something "correct" rather than failing or giving an error. if you're "in the zone" and writing music, you probably want your compositional tools to "do what you mean" and allow you to take as many sensible shortcuts as possible, rather than forcing you to waste time manually declaring and setting up everything.
- expressive: make writing music as easy and "natural" as possible, so that patterns can be built in real-time, in performance settings, without having to think so hard about how to bend the library to your will. I feel this is a weakness of SuperCollider.
- consistent: edge cases minimized, arguments for the various functions in an intuitive order, thus resulting in less cognitive load for the user.
- reflective: store more data about the stream state and more metadata about the patterns. make it easier for a pattern to access the values of another pattern, for patterns to affect other patterns, etc.
- lispy: prefer lisp idioms rather than direct translations of the SuperCollider way of doing things (while still keeping things relatively similar so it's not a huge adjustment for SC users to make).

In addition to emulating most of SuperCollider's patterns system, another goal is to further extend it with more tools and more ways to write patterns/sequences. The most obvious example being a "drum sequence" notation like ~k - - - k - - - k - - - k - - -~ for a four-to-the-floor beat. The idea is that Lisp's macros should make it possible to more expressively write music with code.

* Intro

Make sure you have [[https://www.quicklisp.org/beta/][Quicklisp]] installed and working with your Lisp implementation, then load cl-patterns:

#+BEGIN_SRC lisp
  (ql:quickload :cl-patterns)
  (in-package #:cl-patterns)
#+END_SRC

Create a pattern like so:

#+BEGIN_SRC lisp
  (defparameter *pat* (pbind :foo (pseq '(1 2 3))
                             :bar (prand '(9 8 7) 5)))
#+END_SRC

Since patterns are basically "templates", you need to turn them into ~pstream~ objects in order to actually get output from them:

#+BEGIN_SRC lisp
  (defparameter *pstream* (as-pstream *pat*))
#+END_SRC

Then, you can get results from the pstream one at a time with ~next~, or many at a time with ~next-n~ or ~next-upto-n~:

#+BEGIN_SRC lisp
  (next-n *pstream* 3)
  ;; => ((EVENT :FOO 1 :BAR 8) (EVENT :FOO 2 :BAR 9) (EVENT :FOO 3 :BAR 8))
#+END_SRC

To actually hear sound output, you'll need to start an audio server. Right now, SuperCollider is the main audio server that cl-patterns is tested against, but there is also preliminary support for [[http://incudine.sourceforge.net/][Incudine]] as well as MIDI output through ALSA.

To use the SuperCollider backend, simply load the ~cl-patterns/supercollider~ system with quicklisp. This will automatically take care of loading the required [[https://github.com/byulparan/cl-collider][cl-collider]] library for you:

#+BEGIN_SRC lisp
  (ql:quickload :cl-patterns/supercollider)
#+END_SRC

From here, you can take a look at the code in the [[file:doc/supercollider-example.lisp][supercollider-example.lisp]] file for a short example of how to define your own synths and play them with patterns. You may also be interested in [[https://defaultxr.github.io/cl-collider-tutorial/][my cl-collider tutorial]] for a more in-depth introduction to cl-collider.

For more information on how to use cl-patterns, refer to [[file:doc/tutorial.org][tutorial.org]] for an introduction.

You can get a list of all defined patterns using ~(all-patterns)~. Every pattern should have usage information and examples in its docstring, which of course can be accessed using the standand ~describe~ or ~documentation~ functions.

* Features

This library isn't just a copy of SuperCollider's patterns - I wanted to improve upon them as well. For a list of notable features in cl-patterns, see [[file:doc/features.org][features.org]].

If you're familiar with SuperCollider, you may also want to look at [[file:doc/sc-differences.org][sc-differences.org]] for a listing of differences between this library and SC's patterns, or [[file:doc/sc.org][sc.org]] for a listing of patterns in SuperCollider and their equivalent (and implementation status) in cl-patterns.

* Current Status

Right now, the library may be described as being in a "alpha" state, as major changes (which may break code you write) are still very likely to happen. However, these changes should be documented in commit messages, so check those if you have any issues after updating.

Despite that, lots of functionality is already written and the library should be stable enough for normal usage in most cases.

Many [[file:t/][tests]] have already been written to help guard against regressions.

Much documentation is still being written, but there is already a good amount of information in the [[file:doc/][doc]] directory, and in the docstrings for the patterns, functions, etc.

See [[file:doc/TODO.org][TODO.org]] and [[file:doc/roadmap.org][roadmap.org]] for a listing of tasks that need to be completed and ideas for future features. The code itself is also littered with comments marked "FIX" noting various known issues and possible changes and optimizations that could be made.

** Backends

The SuperCollider backend is the primary backend that cl-patterns is tested against so it should generally work the best and should be usable for most purposes.

The Incudine backend should work for most purposes, though currently multichannel expansion does not work.

The ALSA MIDI backend has some functionality complete and should be usable for basic tasks, but is still very much a work in progress.

** Rough Edges

Don't cut yourself on these. These are the weaker parts of the library; they're still very much WIPs and are even less likely to be correct :^)

- scales/tunings - calculations may be wrong sometimes; sometimes throw errors
- ~pcycles~ - still needs work, API may change
- sc-compatibility patterns - hardly anything written for these!
- multichannel expansion - still somewhat new, might not work with all backends

* Tour

- [[file:README.org][README.org]] - this file. self-expanatory, I'd hope.
- [[file:LICENSE][LICENSE]] - the MIT license.
- [[file:cl-patterns.asd][cl-patterns.asd]] - cl-patterns systems definition file.

** doc

- [[file:doc/backends.org][backends.org]] - information about cl-patterns backends, including how to write your own.
- [[file:doc/cookbook.org][cookbook.org]] - a cookbook of ideas and inspiration for your cl-patterns hacking.
- [[file:doc/features.org][features.org]] - listing of notable features of cl-patterns.
- [[file:doc/other-libraries.org][other-libraries.org]] - listing of other libraries that have similar goals or may be useful in conjunction with cl-patterns.
- [[file:doc/patterns.org][patterns.org]] - organized index of the pattern classes included in cl-patterns.
- [[file:doc/roadmap.org][roadmap.org]] - general overview of major goals for the future development of cl-patterns.
- [[file:doc/sc.org][sc.org]] - a list of pattern classes in SuperCollider and their cl-patterns implementation status.
- [[file:doc/sc-differences.org][sc-differences.org]] - listing of things that differ between cl-patterns and SuperCollider.
- [[file:doc/special-keys.org][special-keys.org]] - description of keys that have special effects when used in an event or pbind.
- [[file:doc/supercollider-example.lisp][supercollider-example.lisp]] - short example of how to use cl-patterns with cl-collider.
- [[file:doc/TODO.org][TODO.org]] - a list of things and ideas that have not yet been implemented into cl-patterns, but may be in the future.
- [[file:doc/tutorial.org][tutorial.org]] - explanation of the basic concepts of cl-patterns, meant for people who have never used SuperCollider's patterns.
- [[file:doc/writing-your-own.org][writing-your-own.org]] - information about how to write your own pattern classes.

** src

- [[file:src/package.lisp][package.lisp]] - the package definition file.
- [[file:src/utility.lisp][utility.lisp]] - general utility functions and special variable definitions.
- [[file:src/conversions.lisp][conversions.lisp]] - functions to convert between units (i.e. midinote to frequency, decibels to amplitude, etc.).
- [[file:src/scales.lisp][scales.lisp]] - musical pitch (scales/tuning) data and structs.
- [[file:src/event.lisp][event.lisp]] - code to represent and deal with events. includes the ~event~ class, information about special keys (i.e. ~freq~, ~amp~...), etc.
- [[file:src/eseq.lisp][eseq.lisp]] - event sequence class and functionality.
- [[file:src/backend.lisp][backend.lisp]] - code to handle "backends"; i.e. how cl-patterns will actually "play" events.
- [[file:src/clock.lisp][clock.lisp]] - the scheduling functionality to make sure that each event is played at the proper time.
- [[file:src/sugar.lisp][sugar.lisp]] - additional syntax sugar and utility functions, accessible via the ~cl-patterns/sugar~ subsystem.

*** patterns

- [[file:src/patterns/patterns.lisp][patterns.lisp]] - general pattern macros and functionality + the standard set of patterns; includes the ~pattern~ superclass, ~pbind~, ~pseq~, ~pk~, etc.
- [[file:src/patterns/bjorklund.lisp][bjorklund.lisp]] - Euclidean pattern functionality such as ~pbjorklund~, etc.
- [[file:src/patterns/cycles.lisp][cycles.lisp]] - TidalCycles-inspired patterns and notation, i.e. ~pcycles~, etc.
- [[file:src/patterns/tracker.lisp][tracker.lisp]] - tracker-inspired patterns and notation, i.e. ~ptracker~ and associated functions, macros, reader macros, etc.
- [[file:src/patterns/sc-compatibility.lisp][sc-compatibility.lisp]] - patterns intended to be fully compatible with SuperCollider's patterns system.
- [[file:src/patterns/export.lisp][export.lisp]] - export all defined patterns in the ~*patterns*~ list.

*** backends

- [[file:src/backends/supercollider.lisp][supercollider.lisp]] - code to interface cl-patterns with [[https://supercollider.github.io/][SuperCollider]] via the [[https://github.com/byulparan/cl-collider][cl-collider]] library.
- [[file:src/backends/incudine.lisp][incudine.lisp]] - code to interface cl-patterns with [[https://github.com/titola/incudine][Incudine]].
- [[file:src/backends/debug.lisp][debug.lisp]] - basic debug backend. responds to all events, printing and storing them without any audio output.
- [[file:src/backends/alsa-midi.lisp][alsa-midi.lisp]] - code to interface cl-patterns with [[https://github.com/defaultxr/cl-alsaseq][cl-alsaseq]].

*** formats

- [[file:src/formats/midifile.lisp][midifile.lisp]] - functionality to interact with MIDI files (load the ~cl-patterns/midifile~ system to use this).
- [[file:src/formats/supercollider-score.lisp][supercollider-score.lisp]] - functionality to interact with [[http://doc.sccode.org/Classes/Score.html][SuperCollider Score]] files (load the ~cl-patterns/supercollider/score~ system to use this).

*** extensions

- [[file:src/extensions/sequence.lisp][sequence.lisp]] - additional methods for implementations that support [[http://www.sbcl.org/manual/#Extensible-Sequences][extensible sequences]].
- [[file:src/extensions/swank.lisp][swank.lisp]] - creature comforts for slime/swank users.
- [[file:src/extensions/slynk.lisp][slynk.lisp]] - creature comforts for sly/slynk users.

** t

contains the files for the [[https://github.com/sionescu/fiveam][FiveAM]]-based test suite for the library.

* Community

As far as I'm aware there isn't a huge community of people using this library to make music yet. However, if you need support or just want to chat, the "official" room is on [[https://matrix.to/#/#cl-patterns:struct.ws][Matrix: #cl-patterns:struct.ws]].

Any bugs, feature requests, suggestions, etc should be submitted to the GitHub [[https://github.com/defaultxr/cl-patterns/issues][issue tracker]]. Please feel free to submit issues even if they might already be known as it helps to figure out what parts of the library to prioritize development on. It's also nice to hear that people are using the library. :)


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-patterns

Author

modula t.

Contact

defaultxr at gmail dot com

Home Page

https://w.struct.ws/cl-patterns/

Source Control

(:git "git@github.com:defaultxr/cl-patterns.git")

Bug Tracker

https://github.com/defaultxr/cl-patterns/issues

License

MIT

Description

Pattern library for algorithmic music composition and performance in Common Lisp

Version

0.6

Dependencies
Source

cl-patterns.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 cl-patterns/patterns

Dependency

event.lisp (file)

Parent

cl-patterns (system)

Location

patterns/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-patterns.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/cl-patterns-20210411-git/cl-patterns.asd

Systems

cl-patterns (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-patterns/package.lisp

Parent

cl-patterns (system)

Location

package.lisp

Packages

cl-patterns


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-patterns/utility.lisp

Dependency

package.lisp (file)

Parent

cl-patterns (system)

Location

utility.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 cl-patterns/conversions.lisp

Dependency

utility.lisp (file)

Parent

cl-patterns (system)

Location

conversions.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 cl-patterns/scales.lisp

Dependency

conversions.lisp (file)

Parent

cl-patterns (system)

Location

scales.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.6 cl-patterns/event.lisp

Dependency

scales.lisp (file)

Parent

cl-patterns (system)

Location

event.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.7 cl-patterns/patterns/patterns.lisp

Parent

patterns (module)

Location

patterns/patterns.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.8 cl-patterns/patterns/bjorklund.lisp

Parent

patterns (module)

Location

patterns/bjorklund.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.9 cl-patterns/patterns/cycles.lisp

Parent

patterns (module)

Location

patterns/cycles.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.10 cl-patterns/patterns/tracker.lisp

Parent

patterns (module)

Location

patterns/tracker.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.11 cl-patterns/patterns/export.lisp

Parent

patterns (module)

Location

patterns/export.lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.12 cl-patterns/eseq.lisp

Dependency

patterns (module)

Parent

cl-patterns (system)

Location

eseq.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.13 cl-patterns/backend.lisp

Dependency

eseq.lisp (file)

Parent

cl-patterns (system)

Location

backend.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.14 cl-patterns/clock.lisp

Dependency

backend.lisp (file)

Parent

cl-patterns (system)

Location

clock.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

4.1.15 cl-patterns/extensions/sequence.lisp

Dependency

clock.lisp (file)

Parent

cl-patterns (system)

Location

extensions/sequence.lisp


Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 cl-patterns

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *cl-patterns-temporary-directory*

The default directory to store ‘render’ed files in.

Package

cl-patterns

Source

utility.lisp (file)

Special Variable: *clock*

The default clock to run tasks on.

Package

cl-patterns

Source

utility.lisp (file)

Special Variable: *event*

The event special variable. Can be referenced inside a pattern’s code.

Package

cl-patterns

Source

utility.lisp (file)

Special Variable: *max-pattern-yield-length*

The default maximum number of events or values that will be used by functions like ‘next-n’ or patterns like ‘pshift’, in order to prevent hangs caused by infinite-length patterns.

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *note-names*

List of note names in the equal temperament 12-tone tuning.

Package

cl-patterns

Source

scales.lisp (file)

Special Variable: *performance-errors*

A list of tasks’ errors caught by the clock while ‘*performance-mode*’ is enabled. Each entry in the list is a plist containing the task, the error, and the stack trace.

Package

cl-patterns

Source

clock.lisp (file)

Special Variable: *performance-mode*

Set to true to enable "performance mode". In performance mode, all errors signaled within a task will be caught and a restart invoked automatically to prevent other tasks on the clock from pausing. REMOVE-TASK is the default restart, but another can be specified by setting this variable to its name. When an error occurs in performance mode, a warning is printed, and the task and its stack trace are saved to ‘*performance-errors*’.

Package

cl-patterns

Source

clock.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Macros

Macro: cycles SPEC MAP &rest LIST

Convenience macro to specify a rhythm or melody using symbols. Outputs a list of events with :type, :dur, and another parameter which is specifiable. Usually used to :embed into a pattern.

SPEC is a symbol representing the type of output you’re going to send. It can be midinote, freq, note, instrument, or buffer/bufnum. It can also be a list, which provides the spec as the first element, and keywords (such as :dur for the total dur) for the rest.

MAP is a plist specifying the mapping from symbols to SPEC’s parameter. It can be blank if you’re just making a melody. By default, the map includes keys that map - and _ to rests.

LIST is the actual pattern to generate.

Package

cl-patterns

Source

cycles.lisp (file)

Macro: defpattern NAME SUPERCLASSES SLOTS &key DOCUMENTATION DEFUN

Define a pattern. This macro automatically generates the pattern’s class, its pstream class, and the function to create an instance of the pattern, and makes them external in the cl-patterns package.

NAME is the name of the pattern. Typically a word or two that describes its function, prefixed with p.

SUPERCLASSES is a list of superclasses of the pattern. Most patterns just subclass the ’pattern’ class.

SLOTS is a list of slots that the pattern and pstreams derived from it have. Each slot can either be just a symbol, or a slot definition a la ‘defclass’. You can provide a default for the slot with the :default key, and you can set a slot as a state slot (which only appears in the pattern’s pstream class) by setting the :state key to t.

DOCUMENTATION is a docstring describing the pattern. We recommend providing at least one example, and a "See also" section to refer to similar pattern classes.

DEFUN can either be a full defun form for the pattern, or an expression which will be inserted into the pattern creation function prior to initialization of the instance. Typically you’d use this for inserting ‘assert’ statements, for example.

Package

cl-patterns

Source

patterns.lisp (file)

Macro: pb KEY &body PAIRS

pb is a convenience macro, wrapping the functionality of ‘pbind’ and ‘pdef’. KEY is the name of the pattern (same as pbind’s :pdef key or ‘pdef’ itself), and PAIRS is the same as in regular pbind. If PAIRS is only one element, pb operates like ‘pdef’, otherwise it operates like ‘pbind’.

See also: ‘pbind’, ‘pdef’

Package

cl-patterns

Source

patterns.lisp (file)

Macro: pf &body BODY

Convenience macro for ‘pfunc’ that automatically wraps BODY in a lambda.

Package

cl-patterns

Source

patterns.lisp (file)

Macro: ppc &body PAIRS

Syntax sugar for ‘pparchain’ that automatically splits PAIRS by :- symbols.

Example:

;; (ppc :foo (pseq (list 1 2 3) 1)
;; :-
;; :bar (p+ (pk :foo) 2))
;; ;=> (((EVENT :FOO 1) (EVENT :FOO 1 :BAR 3))
;; ((EVENT :FOO 2) (EVENT :FOO 2 :BAR 4))
;; ((EVENT :FOO 3) (EVENT :FOO 3 :BAR 5)))

See also: ‘pparchain’

Package

cl-patterns

Source

patterns.lisp (file)

Macro: pt HEADER &rest ROWS

Syntax sugar for ‘ptracker’. Avoids the need to quote or use ‘list’.

Example:

;; (pt (:foo 1 :bar (pseries) :dur 1/4)
;; (2) ;; (:foo 2 :bar 0 :dur 1/4)
;; () ;; (:foo 1 :bar 1 :dur 1/4)
;; (9 :bar 90) ;; (:foo 9 :bar 90 :dur 1/2)
;; (-) ;; extends the previous note by 1/4 beat
;; :r ;; (:foo 1 :bar 4 :dur 1/4 :type :rest)
;; )

See also: ‘ptracker’

Package

cl-patterns

Source

tracker.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Functions

Function: all-backends ()

Get a list of all registered backends.

See also: ‘enabled-backends’

Package

cl-patterns

Source

backend.lisp (file)

Function: all-chords ()

Get a list of all defined chords.

Package

cl-patterns

Source

scales.lisp (file)

Function: all-patterns ()

Get a list of the names of all defined pattern classes.

See also: ‘all-pdefs’

Package

cl-patterns

Source

patterns.lisp (file)

Function: all-pdefs &optional PACKAGE

Get a list of all pdefs. With PACKAGE, get all pdefs whose key is in that package.

See also: ‘all-patterns’

Package

cl-patterns

Source

patterns.lisp (file)

Function: all-scales ()

Get a list of all defined scales.

Package

cl-patterns

Source

scales.lisp (file)

Function: all-tunings ()

Get a list of all defined tunings.

Package

cl-patterns

Source

scales.lisp (file)

Function: amp-db AMP

Convert amplitude to decibels.

Package

cl-patterns

Source

conversions.lisp (file)

Function: bipolar-1-to-midi NUMBER

Convert the range -1..1 to 0..127.

Package

cl-patterns

Source

conversions.lisp (file)

Function: bjorklund PULSES &optional STEPS OFFSET

Generate a list representing a Euclidean rhythm using the Bjorklund algorithm. PULSES is the number of "hits" in the sequence, STEPS is number of divisions of the sequence, and OFFSET is the number to rotate the sequence by. This function returns a list, where 1 represents a note and 0 represents a rest. If you want to use bjorklund in a pattern, you may be more interested in ‘pbjorklund’ instead, which returns events with the correct duration and type.

Example: (bjorklund 3 7) ;=> (1 0 1 0 1 0 0)

See also: ‘pbjorklund’

Package

cl-patterns

Source

bjorklund.lisp (file)

Function: chord-midinotes CHORD &optional ROOT OCTAVE

Get a list of the midi note numbers in the specified chord.

Package

cl-patterns

Source

scales.lisp (file)

Function: chord-notes CHORD

Return a list consisting of the note numbers for CHORD.

Package

cl-patterns

Source

scales.lisp (file)

Function: clock-loop CLOCK &key GRANULARITY

Convenience method for processing a clock’s tasks in a loop.

To run the clock in a new thread, you can call ‘start-clock-loop’.

See also: ‘start-clock-loop’, ‘clock-process’

Package

cl-patterns

Source

clock.lisp (file)

Function: clock-process CLOCK BEATS

Process tasks on CLOCK for the next BEATS beats.

See also: ‘clock-loop’, ‘clock-tasks’, ‘make-clock’

Package

cl-patterns

Source

clock.lisp (file)

Function: clock-tasks &optional CLOCK

Get a list of all tasks running on CLOCK.

See also: ‘pattern-tasks’

Package

cl-patterns

Source

clock.lisp (file)

Writer

(setf clock-tasks) (function)

Function: (setf clock-tasks) VALUE &optional CLOCK
Package

cl-patterns

Source

clock.lisp (file)

Reader

clock-tasks (function)

Function: combine-events &rest EVENTS

Get a new event that inserts all the items in each event of EVENTS. Keys from the events listed first will be overwritten by later events.

See also: ‘copy-event’, ‘split-event-by-lists’, ‘combine-events-via-lists’

Package

cl-patterns

Source

event.lisp (file)

Function: combine-events-via-lists &rest EVENTS

Combine EVENTS together to produce one event. Any keys that differ between the events will have be set to lists containing all the values from each event (unless the value is null). This is the opposite of ‘split-event-by-lists’.

Example:

;; (combine-events-via-lists (event :foo 1 :bar 2 :qux 4) (event :foo 1 :bar 3 :baz 5))
;; => (EVENT :FOO 1 :BAR (2 3) :QUX 4 :BAZ 5)

See also: ‘split-event-by-lists’, ‘combine-events’

Package

cl-patterns

Source

event.lisp (file)

Function: copy-event EVENT

Get a new event that is a copy of EVENT.

See also: ‘combine-events’

Package

cl-patterns

Source

event.lisp (file)

Function: db-amp DB

Convert decibels to amplitude.

Package

cl-patterns

Source

conversions.lisp (file)

Function: define-chord NAME INDEXES SCALE &optional ALIASES

Define a musical chord.

See also: ‘scale’, ‘define-tuning’, ‘define-scale’

Package

cl-patterns

Source

scales.lisp (file)

Function: define-scale NAME NOTES &optional TUNING ALIASES

Define a musical scale.

See also: ‘scale’, ‘define-tuning’, ‘define-chord’

Package

cl-patterns

Source

scales.lisp (file)

Function: define-tuning NAME PITCHES OCTAVE-RATIO &optional ALIASES

Define a musical tuning.

See also: ‘tuning’, ‘define-scale’, ‘define-chord’

Package

cl-patterns

Source

scales.lisp (file)

Function: degree-freq DEGREE &key ROOT OCTAVE SCALE

Get the frequency of DEGREE, based on the ROOT, OCTAVE, and SCALE, if provided.

Package

cl-patterns

Source

conversions.lisp (file)

Function: degree-midinote DEGREE &key ROOT OCTAVE SCALE

Get the midi note number of DEGREE, taking into account the ROOT, OCTAVE, and SCALE, if provided.

Package

cl-patterns

Source

conversions.lisp (file)

Function: degree-note DEGREE &optional SCALE

Get the relative note number in the tuning of SCALE based on the DEGREE provided.

Package

cl-patterns

Source

conversions.lisp (file)

Function: disable-backend NAME &key STOP

Disable a registered backend and stop it if STOP is true.

See also: ‘enable-backend’, ‘stop-backend’

Package

cl-patterns

Source

backend.lisp (file)

Function: dur-time DUR &optional TEMPO

Convert duration in beats to time in seconds according to TEMPO in beats per second.

Package

cl-patterns

Source

conversions.lisp (file)

Function: e KEY

Syntax sugar; like ‘event-value’, but always gets the value from ‘*event*’.

See also: ‘event-value’, ‘event’, ‘*event*’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf e) (function)

Function: (setf e) VALUE KEY
Package

cl-patterns

Source

event.lisp (file)

Reader

e (function)

Function: enable-backend NAME

Enable a registered backend.

See also: ‘disable-backend’, ‘start-backend’, ‘enabled-backends’

Package

cl-patterns

Source

backend.lisp (file)

Function: enabled-backends ()

Get a list of all enabled backends.

See also: ‘all-backends’, ‘enable-backend’

Package

cl-patterns

Source

backend.lisp (file)

Function: eseq &optional EVENTS &key SOURCE METADATA

Create an eseq containing the specified events and metadata.

Package

cl-patterns

Source

eseq.lisp (file)

Function: eseq-length ESEQ

Get the number of events in ESEQ.

Package

cl-patterns

Source

eseq.lisp (file)

Function: eseq-p OBJECT

True if OBJECT is an eseq.

See also: ‘eseq’

Package

cl-patterns

Source

eseq.lisp (file)

Function: event &rest PARAMS

Create an event, using the PARAMS as its keys/values.

See also: ‘event-value’, ‘event-p’, ‘e’, ‘*event*’

Package

cl-patterns

Source

event.lisp (file)

Function: event-equal EVENT-1 EVENT-2

Test if EVENT-1 and EVENT-2 are equivalent.

See also: ‘every-event-equal’

Package

cl-patterns

Source

event.lisp (file)

Function: event-p OBJECT

True if OBJECT is an event.

See also: ‘event’, ‘event-value’

Package

cl-patterns

Source

event.lisp (file)

Function: event-value EVENT KEY

Get the value of KEY in EVENT, running any necessary conversion functions.

Returns 2 values: the value of the key, and the name of the key the value was derived from (or t if the default value of the key was used, or nil if no value or default was provided).

See also: ‘event’, ‘e’, ‘raw-event-value’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf event-value) (function)

Function: (setf event-value) VALUE EVENT KEY

Set the value of KEY to VALUE in EVENT, running any conversion functions that exist.

Package

cl-patterns

Source

event.lisp (file)

Reader

event-value (function)

Function: events-differing-keys &rest EVENTS

Get a list of keys that differ between EVENTS.

See also: ‘every-event-equal’, ‘events-lists-differing-keys’

Package

cl-patterns

Source

event.lisp (file)

Function: events-lists-differing-keys &rest LISTS

Get a list of the keys that differ between respective event in LISTS.

Example:

;; (events-lists-differing-keys (list (event :foo 1 :bar 2) (event :bar 3) (event :foo 1 :bar 3)) ;; (list (event :foo 1 :bar 2) (event :foo 1 :bar 3) (event :foo 2 :bar 3))) ;; => (NIL (:FOO) (:FOO))

See also: ‘every-event-equal’

Package

cl-patterns

Source

event.lisp (file)

Function: every-event-equal &rest LISTS

Test if all the events in LISTS are equivalent. Similar to (every #’event-equal LIST-1 LIST-2...) except that it will fail if the lists are not the same length.

See also: ‘event-equal’, ‘events-differing-keys’

Package

cl-patterns

Source

event.lisp (file)

Function: find-pdef KEY &optional ERRORP

Get the pdef named KEY. If one by that name doesn’t exist, return nil, or raise an error if ERRORP is true.

See also: ‘pdef’, ‘all-pdefs’

Package

cl-patterns

Source

patterns.lisp (file)

Function: freq-degree FREQ &key ROOT OCTAVE SCALE

Convert a frequency to a scale degree.

Package

cl-patterns

Source

conversions.lisp (file)

Function: freq-midinote FREQ

Convert a frequency to a midi note number.

Package

cl-patterns

Source

conversions.lisp (file)

Function: freq-note FREQ &key ROOT OCTAVE SCALE

Get the note number relative to the root from the frequency provided.

Package

cl-patterns

Source

conversions.lisp (file)

Function: freq-octave FREQ

Get the octave number that the frequency FREQ occurs in.

Package

cl-patterns

Source

conversions.lisp (file)

Function: freq-rate FREQ &optional BASE-FREQ

Convert the frequency FREQ to a playback rate, based on BASE-FREQ. Useful to convert musical pitch information to a number usable for sample playback synths.

Package

cl-patterns

Source

conversions.lisp (file)

Function: frequency-to-midi FREQUENCY

Convert FREQUENCY to a MIDI note number (rounding to ensure it’s an integer).

Note that this function is meant for use with the MIDI backend; for frequency-to-midinote conversion without rounding, see ‘freq-midinote’ instead.

Package

cl-patterns

Source

conversions.lisp (file)

Function: load-scala-scale FILE &optional ALIASES

Load a Scala (.scl) scale file and define a tuning and scale from it.

Note that Scala refers to these as "scales" but in cl-patterns they are known as tunings.

Package

cl-patterns

Source

scales.lisp (file)

Function: make-clock &optional TEMPO &key PLAY-EXPIRED-EVENTS

Create a clock with a tempo of TEMPO in beats per second (Hz).

To make and start the clock, run ‘clock-loop’ on a new thread, like so:

;; (bt:make-thread (lambda () (clock-loop *clock*)) :name "cl-patterns clock-loop")

Alternatively, you can call ‘clock-process’ manually to process N beats on the clock.

See also: ‘clock-loop’, ‘clock-process’

Package

cl-patterns

Source

clock.lisp (file)

Function: midi-ratio MIDI

Convert a MIDI note number difference to a frequency ratio.

Package

cl-patterns

Source

conversions.lisp (file)

Function: midi-truncate-clamp NUMBER &optional MAX

Truncate NUMBER and clamp it to the range 0..MAX (default 127).

Package

cl-patterns

Source

conversions.lisp (file)

Function: midinote-degree MIDINOTE &key ROOT OCTAVE SCALE

Get the degree of MIDINOTE, taking into account the ROOT, OCTAVE, and SCALE, if provided.

Package

cl-patterns

Source

conversions.lisp (file)

Function: midinote-freq MIDINOTE

Convert a midi note number to a frequency.

Package

cl-patterns

Source

conversions.lisp (file)

Function: midinote-note MIDINOTE

Get the note of MIDINOTE. Currently just returns the note name.

Package

cl-patterns

Source

conversions.lisp (file)

Function: midinote-octave MIDINOTE

Get the octave number that MIDINOTE occurs in.

Package

cl-patterns

Source

conversions.lisp (file)

Function: midinote-rate MIDINOTE &optional BASE-NOTE

Convert a midinote to a playback rate.

Package

cl-patterns

Source

conversions.lisp (file)

Function: multi-channel-funcall FUNCTION &rest ARGS

Call FUNCTION on the provided arguments. If one or more of the arguments is a list, funcall for each element of the list(s). The length of the resulting list will be the same as the longest input list.

Example:

;; (multi-channel-funcall #’+ 1 (list 1 2 3))
;; => (2 3 4)

See also: ‘mapcar-longest’, ‘split-event-by-lists’

Package

cl-patterns

Source

utility.lisp (file)

Function: next-beat-for-quant &optional QUANT BEAT DIRECTION

Get the next valid beat for QUANT after BEAT. If DIRECTION is negative, finds the previous valid beat for QUANT.

See also: ‘quant’

Package

cl-patterns

Source

utility.lisp (file)

Function: next-n PATTERN N

Get the next N results of a pattern stream, function, or other object, advancing the pattern stream forward N times in the process.

See also: ‘next’, ‘next-upto-n’, ‘peek’, ‘peek-n’

Package

cl-patterns

Source

patterns.lisp (file)

Function: next-upto-n PATTERN &optional N

Get a list of up to N results from PATTERN. If PATTERN ends after less than N values, then all of its results will be returned.

See also: ‘next’, ‘next-n’, ‘peek’, ‘peek-upto-n’

Package

cl-patterns

Source

patterns.lisp (file)

Function: note-degree NOTE &optional SCALE

Get the degree of a note in the provided scale. If the note is not in the provided scale, truncate to the nearest note that is.

Package

cl-patterns

Source

conversions.lisp (file)

Function: note-freq NOTE &key ROOT OCTAVE

Given a note, return its frequency in hertz, taking into account the ROOT and OCTAVE if provided.

See also: ‘note-midinote’, ‘note-number’

Package

cl-patterns

Source

conversions.lisp (file)

Function: note-midinote NOTE &key ROOT OCTAVE

Given a note, return its midi note number, taking into account the ROOT and OCTAVE if provided.

See also: ‘note-freq’, ‘note-number’

Package

cl-patterns

Source

conversions.lisp (file)

Function: note-name NOTE-NUMBER

Given a note number, return its note name.

Note that this function is not aware of context and thus always returns the first known name of each note, not necessarily the one that is "correct".

See also: ‘note-number’, ‘note-midinote’

Package

cl-patterns

Source

scales.lisp (file)

Function: note-number NOTE

Given a note name or note number, return the note number.

See also: ‘note-name’, ‘note-name-and-octave’, ‘note-midinote’

Package

cl-patterns

Source

scales.lisp (file)

Function: p* &rest NUMBERS

Multiply NUMBERS, where NUMBERS can be any object that responds to the ‘next’ method. This function is simply a shortcut for (apply #’pnary #’* numbers).

Package

cl-patterns

Source

patterns.lisp (file)

Function: p+ &rest NUMBERS

Add NUMBERS, where NUMBERS can be any object that responds to the ‘next’ method. This function is simply a shortcut for (apply #’pnary #’+ numbers).

Package

cl-patterns

Source

patterns.lisp (file)

Function: p- &rest NUMBERS

Subtract NUMBERS, where NUMBERS can be any object that responds to the ‘next’ method. This function is simply a shortcut for (apply #’pnary #’- numbers).

Package

cl-patterns

Source

patterns.lisp (file)

Function: p/ &rest NUMBERS

Divide NUMBERS, where NUMBERS can be any object that responds to the ‘next’ method. This function is simply a shortcut for (apply #’pnary #’/ numbers).

Package

cl-patterns

Source

patterns.lisp (file)

Function: paccum &optional OPERATOR START STEP LENGTH &key LO HI BOUND-BY

Numeric accumulator. Each output and STEP is used as the input for OPERATOR to generate the next output. When LO, HI, and BOUND-BY are provided, outputs that fall outside the range LO..HI are wrapped back inside with the BOUND-BY function; the value is provided as its first argument, and LO and HI are provided as its second and third.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-upto-n (paccum #’+ 0 1) 5) ;; same as (pseries 0 1)
;; ;=> (0 1 2 3 4)

;; (next-upto-n (paccum #’+ 0 1 :inf :lo 0 :hi 3 :bound-by #’wrap) 9) ;; same as above, wrapping between 0 and 3.
;; ;=> (0 1 2 0 1 2 0 1 2)

See also: ‘pseries’, ‘pgeom’, ‘pwalk’

Package

cl-patterns

Source

patterns.lisp (file)

Function: paclump PATTERN

Automatically group outputs of the source pattern into lists of up to N items each. Unlike ‘pclump’, clump size is automatically set to the length of the longest list in the values of ‘*event*’, or 1 if there are no lists.

Example:

;; (next-upto-n (pbind :foo (pseq ’((1) (1 2) (1 2 3)) 1) :bar (paclump (pseries))))
;; ;=> ((EVENT :FOO (1) :BAR (0)) (EVENT :FOO (1 2) :BAR (1 2)) (EVENT :FOO (1 2 3) :BAR (3 4 5)))

See also: ‘pclump’

Package

cl-patterns

Source

patterns.lisp (file)

Function: parp PATTERN ARPEGGIATOR

Arpeggiator pattern; each event yielded by PATTERN is bound to ‘*event*’ and then the entirety of the ARPEGGIATOR pattern is yielded.

Example:

;; (next-n (parp (pbind :foo (pseq ’(1 2 3))) (pbind :bar (pseq ’(4 5 6) 1))) 9)
;; ;=> ((EVENT :FOO 1 :BAR 4) (EVENT :FOO 1 :BAR 5) (EVENT :FOO 1 :BAR 6)
;; (EVENT :FOO 2 :BAR 4) (EVENT :FOO 2 :BAR 5) (EVENT :FOO 2 :BAR 6)
;; (EVENT :FOO 3 :BAR 4) (EVENT :FOO 3 :BAR 5) (EVENT :FOO 3 :BAR 6))

See also: ‘psym’, ‘pmeta’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pattern-as-pstream THING

Like ‘as-pstream’, but only converts THING to a pstream if it is a pattern.

Package

cl-patterns

Source

patterns.lisp (file)

Function: (setf pattern-metadata) VALUE PATTERN KEY
Package

cl-patterns

Source

patterns.lisp (file)

Reader

pattern-metadata (generic function)

Function: pattern-p OBJECT

True if OBJECT is a pattern.

See also: ‘pattern’, ‘defpattern’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pattern-tasks PATTERN &optional CLOCK

Attempt to get the tasks on CLOCK that are playing PATTERN.

See also: ‘task-pattern’, ‘clock-tasks’

Package

cl-patterns

Source

clock.lisp (file)

Function: pbeat ()

Yield the number of beats elapsed since the pbeat was embedded in the pstream.

Example:

;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 2 :FOO 1) (EVENT :DUR 3 :FOO 3))

See also: ‘pbeat*’, ‘beat’, ‘prun’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pbeat* ()

Yield the number of beats on the ‘*clock*’ of the current pattern. In other words, pbeat* is clock-synced, unlike ‘pbeat’, which is pattern-synced.

Example:

;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat*)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 200) (EVENT :DUR 2 :FOO 201) (EVENT :DUR 3 :FOO 203))

See also: ‘pbeat’, ‘beat’, ‘prun’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pbind &rest PAIRS

pbind yields events determined by its PAIRS, which are a list of keys and values. Each key corresponds to a key in the resulting events, and each value is treated as a pattern that is evaluated for each step of the pattern to generate the value for its key.

Example:

;; (next-n (pbind :foo (pseq ’(1 2 3)) :bar :hello) 4)
;;
;; ;=> ((EVENT :FOO 1 :BAR :HELLO) (EVENT :FOO 2 :BAR :HELLO) (EVENT :FOO 3 :BAR :HELLO) NIL)

See also: ‘pmono’, ‘pb’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pbjorklund PULSES STEPS &key OFFSET DUR REPEATS

pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, and STEPS is number of steps in the sequence. Additionally, OFFSET is the number to rotate the sequence by, DUR is the total duration one repeat of the sequence should be, and REPEATS is the number of repeats that should be yielded. This pattern outputs events which can be embedded into another pattern. Each pulse is a note, and each subdivision of the sequence that is not a pulse is a rest. If you just want the raw output from the Bjorklund algorithm (not in pattern form), use ‘bjorklund’ instead.

Example:

;; (next-upto-n (pbjorklund 3 7))
;; => ((EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7))

See also: ‘bjorklund’

Package

cl-patterns

Source

bjorklund.lisp (file)

Function: pbrown &optional LO HI STEP LENGTH

Brownian motion within a range; each output randomly a maximum of STEP away from the previous. LO and HI define the lower and upper bounds of the range. STEP defaults to 1 if LO and HI are integers.

Example:

;; (next-upto-n (pbrown 0 10 1 10))
;; ;=> (2 3 3 3 4 3 4 5 6 5)

See also: ‘pwhite’, ‘pexprand’, ‘pgauss’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pchain &rest PATTERNS

Combine multiple patterns into one event stream.

Example:

;; (next-n (pchain (pbind :foo (pseq ’(1 2 3))) (pbind :bar (pseq ’(7 8 9) 1))) 4) ;;
;; ;=> ((EVENT :FOO 1 :BAR 7) (EVENT :FOO 2 :BAR 8) (EVENT :FOO 3 :BAR 9) NIL)

See also: ‘pbind”s :embed key

Package

cl-patterns

Source

patterns.lisp (file)

Function: pclump PATTERN &optional N

Group outputs of the source pattern into lists of up to N items each.

Example:

;; (next-upto-n (pclump (pseries 0 1 5) 2))
;; ;=> ((0 1) (2 3) (4))

See also: ‘paclump’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pcycles LIST &optional MAP

pcycles yields values from LIST as events whose dur is (/ 1 list-length) and whose value is the original value in the list. This process recurses into sublists, subdividing their durs equally among the sublist’s contents to be a fraction of what their dur originally would be. The total dur yielded by pcycles is always equal to 1. pcycles repeats the whole LIST once.

Package

cl-patterns

Source

cycles.lisp (file)

Function: pdef KEY &optional PATTERN

Define a named pattern, with KEY being the name of the pattern and PATTERN the pattern itself. Named patterns are stored by name in a global dictionary and can be referred back to by calling ‘pdef’ without supplying PATTERN. The global dictionary also keeps track of the pdef’s pstream when ‘play’ is called on it. If a pdef is redefined while it is being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘end-quant’ time is reached (if non-nil). Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).

Example:

;; (pdef :foo (pbind :degree (pseries 0 1 4)))
;;
;; (play (pdef :foo))
;; ;; redefine the pdef’s pattern... note that the redefinition doesn’t become audible until the current loop finishes playing:
;; (pdef :foo (pbind :degree (pseries 4 -1 4)))

See also: ‘find-pdef’, ‘all-pdefs’, ‘pb’, ‘pmeta’, ‘ps’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pdelta PATTERN &optional CYCLE

Output the difference between successive outputs of PATTERN, assuming PATTERN restarts every CYCLE outputs.

Unlike ‘pdiff’, pdelta is written with its use as input for ‘pbind”s :delta key in mind. If PATTERN’s successive values would result in a negative difference, pdelta instead wraps the delta around to the next multiple of CYCLE. This would allow you to, for example, supply the number of the beat that each event occurs on, rather than specifying the delta between each event. This is of course achievable using pbind’s :beat key as well, however that method requires the pbind to peek at future values, which is not always desirable.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-n (pdelta (pseq ’(0 1 2 3)) 4) 8)
;;
;; ;=> (1 1 1 1 1 1 1 1)
;;
;; (next-n (pdelta (pseq ’(0 1 2 5)) 4) 8)
;;
;; ;=> (1 1 3 3 1 1 3 3)

See also: ‘pdiff’, ‘pbind”s :beat key

Package

cl-patterns

Source

patterns.lisp (file)

Function: pdiff PATTERN

Output the difference between successive outputs of PATTERN.

Example:

;; (next-n (pdiff (pseq ’(3 1 4 3) 1)) 4)
;;
;; ;=> (-2 3 -1 NIL)

See also: ‘pdelta’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pdrop PATTERN &optional N

Drop the first N outputs from PATTERN and yield the rest. If N is negative, drop the last N outputs from PATTERN instead.

Example:

;; (next-n (pdrop (pseq ’(1 2 3 4) 1) 2) 4)
;;
;; ;=> (3 4 NIL NIL)

See also: ‘pshift’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pdurstutter PATTERN N

Yield each output from PATTERN N times, dividing it by N. If the output from PATTERN is an event, its dur is divided; if it’s a number, the number itself is divided instead of being yielded directly.

Example:

;; (next-n (pdurstutter (pseq ’(1 2 3 4 5)) (pseq ’(3 2 1 0 2))) 9)
;; ;=> (1/3 1/3 1/3 1 1 3 5/2 5/2 NIL)
;;
;; (next-n (pdurstutter (pbind :dur (pseq ’(1 2 3 4 5)))
;; (pseq ’(3 2 1 0 2)))
;; 9)
;; ;=> ((EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1) (EVENT :DUR 1) (EVENT :DUR 3) (EVENT :DUR 5/2) (EVENT :DUR 5/2) NIL)

See also: ‘pr’

Package

cl-patterns

Source

patterns.lisp (file)

Function: peek-n PSTREAM N

Peek at the next N results of a pstream, without advancing it forward in the process.

See also: ‘peek’, ‘peek-upto-n’, ‘next’, ‘next-n’

Package

cl-patterns

Source

patterns.lisp (file)

Function: peek-upto-n PSTREAM &optional N

Peek at up to the next N results of a pstream, without advancing it forward in the process.

See also: ‘peek’, ‘peek-n’, ‘next’, ‘next-upto-n’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pexprand &optional LO HI LENGTH

Exponentially-distributed random numbers between LO and HI. Note that LO and HI cannot be 0, and that LO and HI must have the same sign or else complex numbers will be output.

Example:

;; (next-upto-n (pexprand 1.0 8.0 4))
;; ;=> (1.0420843091865208d0 1.9340168112124456d0 2.173209129035095d0 4.501371557329618d0)

See also: ‘pwhite’, ‘pbrown’, ‘pgauss’, ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pfin PATTERN COUNT

Yield up to COUNT outputs from PATTERN.

Example:

;; (next-n (pfin (pseq ’(1 2 3) :inf) 3) 5) ;; ;=> (1 2 3 NIL NIL)

See also: ‘pfindur’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pfindur PATTERN DUR &optional TOLERANCE

Yield events from PATTERN until their total duration is within TOLERANCE of DUR, or greater than DUR. Any events that would end beyond DUR are cut short. If PATTERN outputs numbers, their total sum is limited instead.

Example:

;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) NIL)
;;
;; (next-upto-n (pfindur (pwhite 0 4) 16))
;; ;=> (1 3 0 1 2 2 1 3 0 1 2)
;; (reduce #’+ *)
;; ;=> 16

See also: ‘pfin’, ‘psync’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pfunc FUNC &optional LENGTH

Yield the result of evaluating FUNC. Note that the current event of the parent pattern is still accessible via the ‘*event*’ special variable.

Example:

;; (next-upto-n (pfunc (lambda () (random 10)) 4))
;; ;=> ((5 2 8 9))
;;
;; (next-upto-n (pbind :foo (pwhite 0 10 4) :bar (pfunc (lambda () (if (> (event-value *event* :foo) 5) :greater :lesser)))))
;; ;=> ((EVENT :FOO 0 :BAR :LESSER) (EVENT :FOO 6 :BAR :GREATER)
;; (EVENT :FOO 7 :BAR :GREATER) (EVENT :FOO 8 :BAR :GREATER))

See also: ‘pf’, ‘pnary’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pgauss &optional MEAN DEVIATION LENGTH

Random numbers distributed along a normal (gaussian) curve. MEAN is the "center" of the distribution, DEVIATION is the standard deviation (i.e. the higher the value, the further the outputs are spread from MEAN).

Example:

;; (next-n (pgauss) 4)
;; ;=> (0.08918811646370092d0 0.1745957067161632d0 0.7954678768273173d0 -1.2215823449671597d0)

See also: ‘pwhite’, ‘pexprand’, ‘pbrown’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pgeom &optional START GROW LENGTH

Yield START, then generate subsequent outputs by multiplying by GROW, for a total of LENGTH outputs.

Example:

;; (next-upto-n (pgeom 1 2 4))
;; ;=> (1 2 4 8)

See also: ‘pseries’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pgeom* &optional START END LENGTH

Syntax sugar to generate a ‘pgeom’ whose values go from START to END exponentially over LENGTH steps. LENGTH cannot be infinite since delta calculation requires dividing by it.

Based on the Pgeom extension from the ddwPatterns SuperCollider library.

Example:

;; (pgeom* 1 100 8)
;; ;=> (pgeom 1 1.9306977 8)
;;
;; (next-upto-n *)
;; ;=> (1 1.9306977 3.7275934 7.196856 13.894953 26.826954 51.79474 99.999985)
;; ;; Note that due to floating point rounding errors the last output may not always be exactly END.

See also: ‘pgeom’, ‘pseries’, ‘pseries*’

Package

cl-patterns

Source

patterns.lisp (file)

Function: phistory PATTERN STEP-PATTERN

Refer back to PATTERN’s history, yielding the output at the index provided by STEP-PATTERN.

Note that PATTERN is still advanced once per event, and if STEP-PATTERN yields a number pointing to an event in PATTERN that hasn’t been yielded yet (i.e. if PATTERN has only advanced once but STEP-PATTERN yields 3 for its output), phistory yields nil.

Example:

;; (next-n (phistory (pseries) (pseq ’(0 2 1))) 3)
;; ;=> (0 NIL 1)

See also: ‘pscratch’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pif TEST TRUE FALSE

"If" expression for patterns. TEST is evaluated for each step, and if it’s non-nil, the value of TRUE will be yielded, otherwise the value of FALSE will be. Note that TRUE and FALSE can be patterns, and if they are, they are only advanced in their respective cases, not for every step. Also note that pif will continue to advance even if TEST yields nil; pif only yields nil if TRUE or FALSE do.

Example:

;; (next-n (pif (pseq ’(t t nil nil nil)) (pseq ’(1 2)) (pseq ’(3 nil 4))) 5)
;; ;=> (1 2 3 NIL 4)

Package

cl-patterns

Source

patterns.lisp (file)

Function: pindex LIST-PAT INDEX-PAT &optional WRAP-P

Use INDEX-PAT to index into the list returned by LIST-PAT. WRAP-P is whether indexes that are out of range will be wrapped (if t) or will simply return nil.

Example:

;; (next-n (pindex (list 99 98 97) (pseq (list 0 1 2 3))) 4)
;;
;; ;=> (99 98 97 NIL)
;;
;; (next-upto-n (pindex (list 99 98 97) (pseries 0 1 6) t))
;;
;; ;=> (99 98 97 99 98 97)

See also: ‘pwalk’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pk KEY &optional DEFAULT

Yield the value of KEY in the current ‘*event*’ context, returning DEFAULT if that value is nil.

Example:

;; (next-upto-n (pbind :foo (pseq ’(1 2 3) 1) :bar (pk :foo)))
;; ;=> ((EVENT :FOO 1 :BAR 1) (EVENT :FOO 2 :BAR 2) (EVENT :FOO 3 :BAR 3))

See also: ‘pbind’, ‘event-value’, ‘*event*’

Package

cl-patterns

Source

patterns.lisp (file)

Function: place LIST &optional REPEATS

Yield each value from LIST in sequence. If the value is a list, the first element of that list is yielded. The second time that sub-list is encountered, its second element will be yielded; the third time, the third element, and so on. REPEATS controls the number of times LIST is repeated.

Example:

;; (next-upto-n (place (list 1 2 (list 3 4 5)) 3))
;; ;=> (1 2 3 1 2 4 1 2 5)

See also: ‘ppatlace’

Package

cl-patterns

Source

patterns.lisp (file)

Function: play-or-end OBJECT

‘play’ an object, or ‘end’ it if it’s already playing. Returns the task if the object will start playing, or NIL if it will end.

Package

cl-patterns

Source

utility.lisp (file)

Function: play-or-stop OBJECT

‘play’ an object, or ‘stop’ it if it is already playing. Returns the task if the object will start playing, or NIL if it will stop.

Package

cl-patterns

Source

utility.lisp (file)

Function: playing-nodes &optional BACKEND

Get a list of all nodes on BACKEND that are currently playing. Without BACKEND, get all playing nodes on all backends.

See also: ‘playing-pdefs’, ‘playing-p’

Package

cl-patterns

Source

clock.lisp (file)

Function: playing-pdefs &optional CLOCK

Get a list of the names of all pdefs playing on CLOCK.

See also: ‘playing-nodes’, ‘playing-p’

Package

cl-patterns

Source

clock.lisp (file)

Function: plazy FUNC &optional REPEATS

Evaluates FUNC to generate a pattern, which is then yielded from until its end, at which point FUNC is evaluated again to generate the next pattern. The pattern is generated a total of REPEATS times.

Example:

;; (next-n (plazy (lambda () (if (= 0 (random 2)) (pseq ’(1 2 3) 1) (pseq ’(9 8 7) 1)))) 6)
;; ;=> (9 8 7 1 2 3)

See also: ‘pfunc’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pmeta &rest PAIRS

Meta-control patterns using the events output by PATTERN. In other words, instead of triggering synths directly, the events output by PATTERN are used to embed patterns into the pmeta’s pstream.

The following keys are supported:

- :pattern or :instrument - name of the source pattern for this "step".
- :dur - set the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).
- :findur - limit the duration of the embedded pattern.
- :sync - sync the duration of the embedded pattern to a multiple of the provided value, similar to ‘psync’
- :stretch - multiply the duration of each of the source pattern’s events.
- :ts or :fit - timestretch a pattern so its total duration is the number specified, a la ‘pts’.
- :r or :repeat - repeat each event the number of times returned by the function when the event is applied to it, similar to ‘pr’.
- :inject - inject key/value pairs from the output of this value into the source pattern.
- :step-inject or :sinject - inject one output from this value per step.

The following keys are planned for future implementation:

- :start or :end - adjust the start or end points of the source pattern (i.e. to skip the first half, set :start to 0.5).
- :start-beat or :end-beat - adjust the start or end points of the source pattern in number of beats (i.e. to end the pattern 2 beats early, set :end-beat to -2).
- :start-nth or :end-nth - adjust the start or end points of the source pattern by skipping the first or last N events.
- :filter or :remove-if-not - skip all events from the source pattern that return nil when applied to the specified function or pattern.
- :mapcar or :nary - process each event from the source pattern with a function or another pattern.

See doc/special-keys.org for more information on these keys.

Example:

;; ;; define a few patterns...
;; (pdef :foo (pbind :x (pseq ’(1 2 3) 1) :dur 1))
;; (pdef :bar (pbind :y (pseries) :dur (pwhite 0.1 1.0 3)))
;;
;; ;; use pmeta to play pattern foo and then pattern bar, ensuring each are 2 beats long in total by way of pmeta’s sync key, which works similarly to ‘psync’
;; (next-upto-n (pmeta :pattern (pseq (list :foo :bar) 1) :sync 2))
;; ;=> ((EVENT :X 1 :DUR 1) (EVENT :X 2 :DUR 1) ;; from (pdef :foo)
;; (EVENT :Y 0 :DUR 0.76958686) (EVENT :Y 1 :DUR 0.94850993) (EVENT :Y 2 :DUR 0.28190327)) ;; from (pdef :bar)

See also: ‘psym’, ‘parp’, ‘pdef’, ‘pbind’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pmono INSTRUMENT &rest PAIRS

pmono defines a mono instrument event pstream. It’s effectively the same as ‘pbind’ with its :type key set to :mono.

See also: ‘pbind’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pn PATTERN &optional REPEATS

Embed the full PATTERN into the pstream REPEATS times.

Example:

;; (next-upto-n (pn (pwhite 0 5 1) 5))
;; ;=> (2 4 2 1 0)

See also: ‘pr’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pnary OPERATOR &rest PATTERNS

Yield the result of applying OPERATOR to each value yielded by each pattern in PATTERNS.

Example:

;; (next-upto-n (pnary (pseq (list ’+ ’- ’* ’/) 2) 2 2))
;; ;=> (4 0 4 1)

See also: ‘pfunc’, ‘p+’, ‘p-’, ‘p*’, ‘p/’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ppar LIST

Combine multiple event patterns into one pstream with all events in temporal order. LIST is the list of patterns, or a pattern yielding lists of patterns. The ppar ends when all of the patterns in LIST end.

Example:

;; (next-upto-n (ppar (list (pbind :dur (pn 1/2 4))
;; (pbind :dur (pn 2/3 4)))))
;;
;; ;=> ((EVENT :DUR 1/2 :DELTA 0) (EVENT :DUR 2/3 :DELTA 1/2)
;; (EVENT :DUR 1/2 :DELTA 1/6) (EVENT :DUR 2/3 :DELTA 1/3)
;; (EVENT :DUR 1/2 :DELTA 1/3) (EVENT :DUR 2/3 :DELTA 1/6)
;; (EVENT :DUR 1/2 :DELTA 1/2))

See also: ‘psym’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pparchain &rest PATTERNS

Combine multiple patterns into several event streams. The event yielded by the first pattern will be used as the input event to the second pattern, and so on. The events yielded by each pattern will be collected into a list and yielded by the pparchain. This pattern is effectively ‘ppar’ and ‘pchain’ combined.

Example:

;; (next-upto-n (pparchain (pbind :foo (pseries 0 1 3)) (pbind :baz (p+ (pk :foo) 1) :foo (p+ (pk :foo) 3))))
;; ;=> (((EVENT :FOO 0) (EVENT :FOO 3 :BAZ 1))
;; ((EVENT :FOO 1) (EVENT :FOO 4 :BAZ 2))
;; ((EVENT :FOO 2) (EVENT :FOO 5 :BAZ 3)))

See also: ‘ppc’, ‘ppar’, ‘pchain’, ‘pbind”s :embed key

Package

cl-patterns

Source

patterns.lisp (file)

Function: ppatlace LIST &optional REPEATS

Yield each value from LIST in sequence, or one output from each pattern in LIST per cycle of the list. If one of the patterns embedded in LIST ends sooner than the others, it is simply removed and the ppatlace continues to yield from the rest of the LIST. The entire LIST is yielded through a total of REPEATS times.

Example:

;; (next-upto-n (ppatlace (list (pseq (list 1 2 3) 1)
;; (pseq (list 4 5 6) 2))))
;; ;=> (1 4 2 5 3 6 4 5 6)

See also: ‘place’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pr PATTERN &optional REPEATS

Repeat each value from PATTERN REPEATS times. If REPEATS is 0, the value is skipped.

Example:

;; (next-upto-n (pr (pseries) (pseq ’(1 3 0 2) 1)))
;; ;=> (0 1 1 1 3 3)

See also: ‘pdurstutter’, ‘pn’, ‘pdrop’, ‘parp’

Package

cl-patterns

Source

patterns.lisp (file)

Function: prand LIST &optional LENGTH

Yield random values from LIST.

Example:

;; (next-n (prand ’(1 2 3) 5) 6)
;; ;=> (3 2 2 1 1 NIL)

See also: ‘pxrand’, ‘pwrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: prerange INPUT FROM-RANGE TO-RANGE

Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.

Note that this is effectively a convenience wrapper over ‘pnary’ and ‘rerange’; thus you should see ‘rerange’ for more information.

See also: ‘rerange’, ‘pnary’

Package

cl-patterns

Source

patterns.lisp (file)

Function: prs PATTERN &optional REPEATS

Syntax sugar for (pr (ps PATTERN) REPEATS). Useful, for example, to ensure that each cycle of a pattern only gets one value from the ‘ps’.

See also: ‘pr’, ‘ps’

Package

cl-patterns

Source

patterns.lisp (file)

Function: prun PATTERN &optional DUR

Run PATTERN "independently" of its parent, holding each value for DUR beats. Each of PATTERN’s outputs is treated as if it lasted DUR beats, being continuously yielded during that time before moving on to the next output.

Example:

;; (next-upto-n (pbind :foo (pseq ’(1 2 3 4 5))
;; :bar (prun (pseq ’(4 5 6 7 8))
;; (pseq ’(1 2 0.5 0.5 1)))))
;; ;=> ((EVENT :FOO 1 :BAR 4)
;; (EVENT :FOO 2 :BAR 5)
;; (EVENT :FOO 3 :BAR 5)
;; (EVENT :FOO 4 :BAR 6)
;; (EVENT :FOO 5 :BAR 8))

See also: ‘beat’, ‘pbeat’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ps PATTERN

Preserve pstream state across subsequent calls to ‘as-pstream’. To reset the pstream, simply re-evaluate the ps definition.

Based on the pattern originally from the miSCellaneous SuperCollider library.

Example:

;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
;;
;; (next-upto-n *pst* 4)
;; ;=> (4 5 6 7)
;;
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)

See also: ‘prs’, ‘pdef’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pscratch PATTERN STEP-PATTERN

"Scratches" across the values yielded by a pstream, similar in concept to how a DJ might scratch a record, altering the normal flow of playback. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-upto-n (pscratch (pseries) (pseq ’(0 1 1 -1 2) 2)))
;; ;=> (0 0 1 2 1 3 3 4 5 4)

See also: ‘phistory’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pseq LIST &optional REPEATS OFFSET

Sequentially yield items from LIST, repeating the whole list REPEATS times. OFFSET is the offset to index into the list.

Example:

;; (next-n (pseq ’(5 6 7) 2) 7)
;; ;=> (5 6 7 5 6 7 NIL)
;;
;; (next-upto-n (pseq ’(5 6 7) 2 1))
;; ;=> (6 7 5 6 7 5)

See also: ‘pser’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pser LIST &optional LENGTH OFFSET

Sequentially yield values from LIST, yielding a total of LENGTH values.

Example:

;; (next-n (pser ’(5 6 7) 2) 3)
;;
;; ;=> (5 6 NIL)

See also: ‘pseq’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pseries &optional START STEP LENGTH

Yield START, then generate subsequent outputs by adding STEP, for a total of LENGTH outputs.

Example:

;; (next-upto-n (pseries 1 2 4))
;; ;=> (1 3 5 7)

See also: ‘pseries*’, ‘pgeom’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pseries* &optional START END LENGTH

Syntax sugar to generate a ‘pseries’ whose values go from START to END linearly over LENGTH steps. If LENGTH is not provided, it is calculated such that the step will be 1. Note that LENGTH cannot be infinite since delta calculation requires dividing by it.

Based on the Pseries extension from the ddwPatterns SuperCollider library.

Example:

;; (pseries* 0 10 16)
;; ;=> (pseries 0 2/3 16)
;;
;; (next-upto-n *)
;; ;=> (0 2/3 4/3 2 8/3 10/3 4 14/3 16/3 6 20/3 22/3 8 26/3 28/3 10)

See also: ‘pseries’, ‘pgeom’, ‘pgeom*’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pshuf LIST &optional REPEATS

Shuffle LIST, then yield each item from the shuffled list, repeating it REPEATS times.

Example:

;; (next-upto-n (pshuf ’(1 2 3) 2))
;;
;; ;=> (3 1 2 3 1 2)

See also: ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pslide LIST &optional REPEATS LEN STEP START WRAP-AT-END

"Slide" across sections of LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP is the number to increment the start index by after each section, and START is the initial index into LIST that the first section starts from. WRAP-AT-END, when true, means that an index outside of the list will wrap around. When false, indexes outside of the list result in nil.

Example:

;; (next-upto-n (pslide (list 0 1 2 3 4 5 6) 3 3 2 1 t))
;; ;=> (1 2 3 3 4 5 5 6 0)

See also: ‘pscratch’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pstream-elt PSTREAM N

Get the Nth item in PSTREAM’s history. For negative N, get the -Nth most recent item.

Example:

;; (let ((pstream (as-pstream (pseq ’(1 2 3)))))
;; (next pstream) ;=> 1
;; (pstream-elt pstream 0) ;=> 1 ;; first item in the pstream’s history
;; (next pstream) ;=> 2
;; (pstream-elt pstream 1) ;=> 2 ;; second item in the pstream’s history
;; (pstream-elt pstream -1)) ;=> 2 ;; most recent item in the pstream’s history

See also: ‘pstream-elt-future’, ‘phistory’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pstream-elt-future PSTREAM N

Get the element N away from the most recent in PSTREAM’s history. Unlike ‘pstream-elt’, this function will automatically peek into the future for any positive N.

Example:

;; (let ((pstream (as-pstream (pseq ’(1 2 3)))))
;; (pstream-elt-future pstream 0) ;=> 1
;; (next pstream) ;=> 1
;; (pstream-elt-future pstream 1) ;=> 2
;; (next pstream)) ;=> 2

See also: ‘pstream-elt’, ‘phistory’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pstream-p OBJECT

True if OBJECT is a pstream.

See also: ‘pstream’, ‘as-pstream’

Package

cl-patterns

Source

patterns.lisp (file)

Function: psym PATTERN

Use a pattern of symbols to embed ‘pdef’s. PATTERN is the source pattern that yields symbols naming the pdef to embed.

Example:

;; (pdef :foo (pseq ’(1 2 3) 1))
;;
;; (pdef :bar (pseq ’(4 5 6) 1))
;;
;; (next-upto-n (psym (pseq ’(:foo :bar) 1)))
;;
;; ;=> (1 2 3 4 5 6)

See also: ‘pdef’, ‘ppar’, ‘pmeta’

Package

cl-patterns

Source

patterns.lisp (file)

Function: psync PATTERN SYNC-QUANT &optional MAXDUR TOLERANCE

Yield events from PATTERN until their total duration is within TOLERANCE of MAXDUR, cutting off any events that would extend past MAXDUR. If PATTERN ends before MAXDUR, a rest is added to the pstream to round its duration up to the nearest multiple of SYNC-QUANT.

Example:

;; (next-upto-n (psync (pbind :dur (pseq ’(5) 1)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :TYPE :REST :DUR 3))
;;
;; (next-upto-n (psync (pbind :dur (pseq ’(5) 5)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5 :DELTA 1))

See also: ‘pfindur’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ptime ()

Yield the number of seconds elapsed since ptime was embedded in the pstream.

Note: May give inaccurate results if the clock’s tempo changes occur more frequently than events in the parent pbind.

Example:

;; (setf (tempo *clock*) 1) ;; 60 BPM
;; (next-n (pbind :dur 1 :time (ptime)) 2)
;; ;=> ((EVENT :DUR 1 :TIME 0) (EVENT :DUR 1 :TIME 1.0))

See also: ‘pbeat’, ‘prun’, ‘beat’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ptrace &optional TRACE PREFIX STREAM

Print the PREFIX and each output of TRACE to STREAM. If TRACE is t, print ‘*event*’. If TRACE is a different symbol, print the value of that symbol in ‘*event*’. If TRACE is a pattern, ptrace yields its output unaffected. Otherwise, it yields t.

See also: ‘debug-recent-events’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ptracker HEADER ROWS

Defines an event pattern via a tracker-inspired notation. HEADER is a plist mapping the pattern’s "columns" (keys) to their default values or to patterns that are used to generate the key’s values for each output. ROWS is a list of lists, each sublist specifying the values for a step. Values can be specified on their own (in which case they’re matched in order to the columns specified in the header) or by using Lisp’s traditional key/value notation.

By default, the pattern repeats infinitely, however it can be limited by providing a :repeats argument in the header specifying the number of repeats.

Example:

;; (ptracker (list :freq 440 :dur 1/4)
;; ’((100) ;; play a note with a frequency of 100
;; :r ;; rest for 1/4 beat
;; (:midinote 70 :dur 1/2) ;; play a note at midinote 70 for 1/2 beat
;; (-) ;; continue previous note for an additional 1/4 beat
;; (600 3/4) ;; play a note with a frequency of 600 for 3/4 beat
;; :r ;; rest for 1/4 beat
;; (750 :foo 3) ;; play a note at frequency 750, dur 1/4, and additional :foo key with value 3
;; ))

See also: ‘pt’, ‘pcycles’, ‘pbind’

Package

cl-patterns

Source

tracker.lisp (file)

Function: pts PATTERN &optional DUR

Timestretch PATTERN so its total duration is DUR. Note that only the first ‘*max-pattern-yield-length*’ events from PATTERN are considered, and that they are calculated immediately at pstream creation time rather than lazily as the pstream yields.

Example:

;; (next-upto-n (pts (pbind :dur (pn 1 4)) 5))
;;
;; ;=> ((EVENT :DUR 5/4) (EVENT :DUR 5/4) (EVENT :DUR 5/4) (EVENT :DUR 5/4))

See also: ‘pfindur’, ‘psync’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pwalk LIST STEP-PATTERN &optional DIRECTION-PATTERN START-POS

"Walk" over the values in LIST by using the accumulated value of the outputs of STEP-PATTERN as the index. At the beginning of the pwalk and each time the start or end of the list is passed, the output of DIRECTION-PATTERN is taken and used as the multiplier for values from STEP-PATTERN. START-POS is the index in LIST for pwalk to take its first output from.

Example:

;; ;; using (pseq (list 1 -1)) as the DIRECTION-PATTERN causes the pwalk’s output to "ping-pong":
;; (next-n (pwalk (list 0 1 2 3) (pseq (list 1)) (pseq (list 1 -1))) 10)
;;
;; ;=> (0 1 2 3 2 1 0 1 2 3)

See also: ‘pindex’, ‘pbrown’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pwhite &optional LO HI LENGTH

Linearly-distributed random numbers between LO and HI, inclusive.

Example:

;; (next-upto-n (pwhite 0 10 16))
;; ;=> (7 2 4 5 7 10 4 8 10 2 3 5 9 2 5 4)

See also: ‘pexprand’, ‘pbrown’, ‘pgauss’, ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pwrand LIST &optional WEIGHTS LENGTH

Yield random elements from LIST weighted by respective values from WEIGHTS.

Example:

;; (next-upto-n (pwrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 1 2 2 2 1 2 1 1 3)

See also: ‘prand’, ‘pxrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pwxrand LIST &optional WEIGHTS LENGTH

Yield random elements from LIST weighted by respective values from WEIGHTS, never repeating equivalent values twice in a row. This is effectively ‘pxrand’ and ‘pwrand’ combined.

Example:

;; (next-upto-n (pwxrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 2 1 2 1 3 1 2 1 2)

See also: ‘prand’, ‘pxrand’, ‘pwrand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pxrand LIST &optional LENGTH

Yield random values from LIST, never repeating equal values twice in a row.

Example:

;; (next-upto-n (pxrand ’(1 2 3) 4))
;; ;=> (3 1 2 1)

See also: ‘prand’, ‘pwrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Function: rate-freq RATE &optional BASE-FREQ

Convert a playback rate RATE to a frequency, based on BASE-FREQ.

Package

cl-patterns

Source

conversions.lisp (file)

Function: rate-midinote RATE &optional BASE-NOTE

Convert a playback rate to a midinote.

Package

cl-patterns

Source

conversions.lisp (file)

Function: ratio-midi RATIO

Convert a frequency ratio to a difference in MIDI note numbers.

Package

cl-patterns

Source

conversions.lisp (file)

Function: register-backend NAME

Register a cl-patterns backend.

Package

cl-patterns

Source

backend.lisp (file)

Function: remove-event-value EVENT KEY

Removes KEY from EVENT.

Package

cl-patterns

Source

event.lisp (file)

Function: rerange INPUT FROM-RANGE TO-RANGE

Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.

Example:

;; (rerange 64 (list 0 127) (list 0 1)) ;; map from [0..127] to [0..1]
;; => 0.503937

See also: ‘to-range’, ‘from-range’, ‘prerange’

Package

cl-patterns

Source

utility.lisp (file)

Function: scale-midinotes SCALE &key ROOT OCTAVE

Given a scale, return its midi note numbers. OCTAVE can be a number, a 2-element list denoting an octave range, or :all, for the full octave range (0-9).

Package

cl-patterns

Source

scales.lisp (file)

Function: split-event-by-lists EVENT

Split an event up by any lists in its values. Also known as multichannel expansion.

Example:

;; (split-event-by-lists (event :foo 1 :bar (list 1 2) :baz (list 3 4 5)))
;;
;; => ((EVENT :FOO 1 :BAR 1 :BAZ 3)
;; (EVENT :FOO 1 :BAR 2 :BAZ 4)
;; (EVENT :FOO 1 :BAR 1 :BAZ 5))

See also: ‘multi-channel-funcall’, ‘combine-events-via-lists’, ‘combine-events’

Package

cl-patterns

Source

event.lisp (file)

Function: start-clock-loop &key TEMPO FORCE PLAY-EXPIRED-EVENTS

Convenience method to make a clock and start its loop in a new thread.

With FORCE, make a new clock and thread even if one already appears to be running.

See also: ‘clock-loop’

Package

cl-patterns

Source

clock.lisp (file)

Function: task-pattern TASK

Attempt to get the pattern that TASK is playing. Returns nil if the pattern couldn’t be found.

See also: ‘pattern-tasks’, ‘clock-tasks’

Package

cl-patterns

Source

clock.lisp (file)

Function: time-dur TIME &optional TEMPO

Convert TIME in seconds to duration in beats according to TEMPO in beats per second.

Package

cl-patterns

Source

conversions.lisp (file)

Function: unipolar-1-to-midi NUMBER

Convert the range 0..1 to 0..127.

Package

cl-patterns

Source

conversions.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Generic functions

Generic Function: amp OBJECT

Volume in amplitude, from 0 to 1.

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf amp) (generic function)

Methods
Method: amp (EVENT event)
Generic Function: (setf amp) VALUE EVENT
Package

cl-patterns

Reader

amp (generic function)

Methods
Method: (setf amp) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: as-eseq OBJECT

Convert OBJECT to an ‘eseq’.

See also: ‘as-pstream’

Package

cl-patterns

Source

eseq.lisp (file)

Methods
Method: as-eseq (PATTERN pattern)
Method: as-eseq (PSTREAM pstream)
Method: as-eseq (EVENT event)
Method: as-eseq (LIST list)
Method: as-eseq (SYMBOL symbol)
Generic Function: as-pstream THING

Return THING as a pstream object.

See also: ‘pattern-as-pstream’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: as-pstream (ESEQ eseq)
Source

eseq.lisp (file)

Method: as-pstream (PTRACKER ptracker)
Source

tracker.lisp (file)

Method: as-pstream (PCYCLES pcycles)
Source

cycles.lisp (file)

Method: as-pstream (PBJORKLUND pbjorklund)
Source

bjorklund.lisp (file)

Method: as-pstream (PS ps)
Method: as-pstream (PACCUM paccum)
Method: as-pstream (PPARCHAIN pparchain)
Method: as-pstream (PWALK pwalk)
Method: as-pstream (PTS pts)
Method: as-pstream (PMETA pmeta)
Method: as-pstream (PDROP pdrop)
Method: as-pstream (PDELTA pdelta)
Method: as-pstream (PCHAIN pchain)
Method: as-pstream (PSYM psym)
Method: as-pstream (PRUN prun)
Method: as-pstream (PINDEX pindex)
Method: as-pstream (PDURSTUTTER pdurstutter)
Method: as-pstream (PSYNC psync)
Method: as-pstream (PFINDUR pfindur)
Method: as-pstream (PFIN pfin)
Method: as-pstream (PARP parp)
Method: as-pstream (PIF pif)
Method: as-pstream (PSCRATCH pscratch)
Method: as-pstream (PHISTORY phistory)
Method: as-pstream (PSLIDE pslide)
Method: as-pstream (PRERANGE prerange)
Method: as-pstream (PNARY pnary)
Method: as-pstream (PPATLACE ppatlace)
Method: as-pstream (PLACE place)
Method: as-pstream (PTRACE ptrace)
Method: as-pstream (PGEOM pgeom)
Method: as-pstream (PSERIES pseries)
Method: as-pstream (PGAUSS pgauss)
Method: as-pstream (PEXPRAND pexprand)
Method: as-pstream (PBROWN pbrown)
Method: as-pstream (PWHITE pwhite)
Method: as-pstream (PSHUF pshuf)
Method: as-pstream (PN pn)
Method: as-pstream (PLAZY plazy)
Method: as-pstream (PDEF pdef)
Method: as-pstream (PR pr)
Method: as-pstream (PFUNC pfunc)
Method: as-pstream (PWXRAND pwxrand)
Method: as-pstream (PWRAND pwrand)
Method: as-pstream (PXRAND pxrand)
Method: as-pstream (PRAND prand)
Method: as-pstream (PK pk)
Method: as-pstream (PSER pser)
Method: as-pstream (PSEQ pseq)
Method: as-pstream (ITEM pbind-pstream)
Method: as-pstream (PBIND pbind)
Method: as-pstream (PSTREAM pstream) around
Method: as-pstream OBJECT around
Method: as-pstream (PATTERN pattern) around
Method: as-pstream (PATTERN pattern)
Method: as-pstream VALUE
Generic Function: beat OBJECT

Get the beat that OBJECT occurs on, relative to its context’s start. i.e. for an event, the beat is relative to the start of its source pattern, while for a pstream or clock object, the beat is the number of beats that have passed since its start.

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf beat) (generic function)

Methods
Method: beat (TASK task)
Source

clock.lisp (file)

Method: beat (CLOCK clock)

The number of beats that have elapsed since the creation of the clock.

Source

clock.lisp (file)

Method: beat (PSTREAM pstream)

The number of beats that have elapsed since the start of the pstream.

Source

patterns.lisp (file)

Method: beat (EVENT event)
Source

event.lisp (file)

Method: beat (NULL null)
Generic Function: (setf beat) VALUE EVENT
Package

cl-patterns

Reader

beat (generic function)

Methods
Method: (setf beat) NEW-VALUE (CLOCK clock)

The number of beats that have elapsed since the creation of the clock.

Source

clock.lisp (file)

Method: (setf beat) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: bsubseq OBJECT START-BEAT &optional END-BEAT

"Beat subseq" - get a list of all events from OBJECT whose ‘beat’ is START-BEAT or above, and below END-BEAT.

See also: ‘events-in-range’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: bsubseq (ESEQ eseq) START-BEAT &optional END-BEAT
Source

eseq.lisp (file)

Method: bsubseq (LIST list) START-BEAT &optional END-BEAT
Source

eseq.lisp (file)

Generic Function: chord OBJECT

Get a chord by name.

Package

cl-patterns

Source

scales.lisp (file)

Methods
Method: chord (OBJECT chord)
Method: chord (OBJECT string)
Method: chord (OBJECT symbol)
Method: chord (OBJECT list)
Generic Function: chord-indexes CHORD

The indexes of the notes from the scale that the chord is made up of.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf chord-indexes) (generic function)

Methods
Method: chord-indexes (THIS symbol)
Method: chord-indexes (CHORD chord)

The indexes of the notes from the scale that the chord is made up of.

Generic Function: (setf chord-indexes) NEW-VALUE OBJECT
Package

cl-patterns

Reader

chord-indexes (generic function)

Methods
Method: (setf chord-indexes) NEW-VALUE (CHORD chord)

The indexes of the notes from the scale that the chord is made up of.

Source

scales.lisp (file)

Generic Function: chord-name CHORD

The octave ratio of the chord (i.e. what to multiply a pitch by to increase its octave by 1).

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf chord-name) (generic function)

Methods
Method: chord-name (THIS symbol)
Method: chord-name (CHORD chord)

The full name of the chord.

Generic Function: (setf chord-name) NEW-VALUE OBJECT
Package

cl-patterns

Reader

chord-name (generic function)

Methods
Method: (setf chord-name) NEW-VALUE (CHORD chord)

The full name of the chord.

Source

scales.lisp (file)

Generic Function: chord-scale CHORD

The scale that the chord is derived from.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf chord-scale) (generic function)

Methods
Method: chord-scale (THIS symbol)
Method: chord-scale (CHORD chord)

The scale that the chord is derived from.

Generic Function: (setf chord-scale) NEW-VALUE OBJECT
Package

cl-patterns

Reader

chord-scale (generic function)

Methods
Method: (setf chord-scale) NEW-VALUE (CHORD chord)

The scale that the chord is derived from.

Source

scales.lisp (file)

Generic Function: db OBJECT

Volume in decibels (dB).

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf db) (generic function)

Methods
Method: db (EVENT event)
Generic Function: (setf db) VALUE EVENT
Package

cl-patterns

Reader

db (generic function)

Methods
Method: (setf db) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: delta OBJECT

The number of beats between the start of this event and the start of the next one.

See also: ‘dur’, ‘sustain’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf delta) (generic function)

Methods
Method: delta (EVENT event)
Generic Function: (setf delta) VALUE EVENT
Package

cl-patterns

Reader

delta (generic function)

Methods
Method: (setf delta) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: dur OBJECT

The total duration of the note, in beats.

See also: ‘delta’, ‘legato’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf dur) (generic function)

Methods
Method: dur (ESEQ eseq)
Source

eseq.lisp (file)

Method: dur (EVENT event)
Generic Function: (setf dur) VALUE EVENT
Package

cl-patterns

Reader

dur (generic function)

Methods
Method: (setf dur) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: end OBJECT

End a task; it will stop when its current loop completes.

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: end (LIST list)
Source

clock.lisp (file)

Method: end (ITEM task)
Source

clock.lisp (file)

Method: end (ITEM symbol)
Source

clock.lisp (file)

Method: end (PDEF pdef)
Source

clock.lisp (file)

Method: end ITEM
Source

clock.lisp (file)

Generic Function: end-quant OBJECT

The end-quant of OBJECT; a list representing when OBJECT is allowed to end playing or when a ‘pdef’ is allowed to swap to a new definition if it has been redefined. Note that if ‘end-quant’ is not set (the default), the pattern can only end or swap when the pattern itself ends (i.e. when it yields nil).

See ‘quant’ for more information on quants and a description of acceptable values.

See also: ‘quant’, ‘play-quant’, ‘next-beat-for-quant’, ‘beat’, ‘end’, ‘pdef’

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf end-quant) (generic function)

Methods
Method: end-quant (ESEQ eseq)
Source

eseq.lisp (file)

Method: end-quant (PDEF pdef)
Source

patterns.lisp (file)

Method: end-quant (PATTERN pattern)
Source

patterns.lisp (file)

Generic Function: (setf end-quant) NEW-VALUE OBJECT
Package

cl-patterns

Reader

end-quant (generic function)

Methods
Method: (setf end-quant) VALUE (ESEQ eseq)
Source

eseq.lisp (file)

Method: (setf end-quant) VALUE (PATTERN pattern)
Source

patterns.lisp (file)

Generic Function: eseq-add ESEQ EVENT

Add EVENT to ESEQ. If EVENT doesn’t have a ‘beat’, it is placed after the last event in ESEQ.

See also: ‘eseq-remove’

Package

cl-patterns

Source

eseq.lisp (file)

Methods
Method: eseq-add (ESEQ eseq) (EVENTS list)
Method: eseq-add (ESEQ eseq) (EVENT event)
Generic Function: eseq-events OBJECT

Get the list of events from an ‘eseq’. Don’t set this directly, as eseq expects its events to be in order by beat. Instead use ‘eseq-add’ and ‘eseq-remove’

Package

cl-patterns

Source

eseq.lisp (file)

Writer

(setf eseq-events) (generic function)

Methods
Method: eseq-events (ESEQ eseq)

The actual list of events that the eseq contains. Don’t add events to this directly, as eseq expects them to be in order by beat. Instead use the ‘eseq-add’ function.

Generic Function: (setf eseq-events) NEW-VALUE OBJECT
Package

cl-patterns

Reader

eseq-events (generic function)

Methods
Method: (setf eseq-events) NEW-VALUE (ESEQ eseq)

The actual list of events that the eseq contains. Don’t add events to this directly, as eseq expects them to be in order by beat. Instead use the ‘eseq-add’ function.

Source

eseq.lisp (file)

Generic Function: eseq-remove ESEQ EVENT

Remove EVENT from ESEQ.

See also: ‘eseq-add’

Package

cl-patterns

Source

eseq.lisp (file)

Methods
Method: eseq-remove (ESEQ eseq) (EVENTS list)
Method: eseq-remove (ESEQ eseq) (INDEX integer)
Method: eseq-remove (ESEQ eseq) (EVENT event)
Generic Function: event-plist EVENT

The raw plist containing the key/value pairs of the event.

Package

cl-patterns

Source

event.lisp (file)

Methods
Method: event-plist (EVENT event)

The plist containing all of the event’s keys and values.

Generic Function: freq OBJECT

Frequency of the note, in Hz.

See also: ‘rate’, ‘midinote’, ‘degree’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf freq) (generic function)

Methods
Method: freq (EVENT event)
Generic Function: (setf freq) VALUE EVENT
Package

cl-patterns

Reader

freq (generic function)

Methods
Method: (setf freq) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: instrument OBJECT

The instrument or synth to trigger.

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf instrument) (generic function)

Methods
Method: instrument (EVENT event)
Generic Function: (setf instrument) VALUE EVENT
Package

cl-patterns

Reader

instrument (generic function)

Methods
Method: (setf instrument) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: launch OBJECT

Play a new copy of OBJECT on the clock. Unlike ‘play’, calling this method on a ‘pdef’ will always start a new copy of its pattern instead of the pdef itself.

See also: ‘play’

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: launch (LIST list)
Source

clock.lisp (file)

Method: launch (SYMBOL symbol)
Source

clock.lisp (file)

Method: launch (PDEF pdef)
Source

clock.lisp (file)

Method: launch (PATTERN pattern)
Source

clock.lisp (file)

Method: launch (EVENT event)
Source

clock.lisp (file)

Method: launch ITEM
Source

clock.lisp (file)

Generic Function: legato OBJECT

How long the note should be held, in beats, as a factor of its total duration (‘dur’).

See also: ‘sustain’, ‘dur’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf legato) (generic function)

Methods
Method: legato (EVENT event)
Generic Function: (setf legato) VALUE EVENT
Package

cl-patterns

Reader

legato (generic function)

Methods
Method: (setf legato) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: loop-p OBJECT

Whether or not OBJECT should play again after it ends.

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf loop-p) (generic function)

Methods
Method: loop-p (TASK task)
Source

clock.lisp (file)

Method: loop-p (ESEQ eseq)
Source

eseq.lisp (file)

Method: loop-p (PDEF pdef)
Source

patterns.lisp (file)

Method: loop-p (PSTREAM pstream)
Source

patterns.lisp (file)

Method: loop-p (PATTERN pattern)
Source

patterns.lisp (file)

Method: loop-p (EVENT event)
Source

event.lisp (file)

Generic Function: (setf loop-p) VALUE EVENT
Package

cl-patterns

Reader

loop-p (generic function)

Methods
Method: (setf loop-p) VALUE (ESEQ eseq)
Source

eseq.lisp (file)

Method: (setf loop-p) VALUE (PATTERN pattern)
Source

patterns.lisp (file)

Method: (setf loop-p) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: midinote OBJECT

MIDI note number of the note (0-127).

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf midinote) (generic function)

Methods
Method: midinote (EVENT event)
Generic Function: (setf midinote) VALUE EVENT
Package

cl-patterns

Reader

midinote (generic function)

Methods
Method: (setf midinote) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: next PATTERN

Get the next value of a pstream, function, or other object, advancing the pstream forward in the process.

See also: ‘next-n’, ‘next-upto-n’, ‘peek’

Package

cl-patterns

Source

patterns.lisp (file)

Method Combination

pattern (long method combination)

Methods
Method: next (ESEQ eseq-pstream)
Source

eseq.lisp (file)

Method: next (PTRACKER ptracker-pstream)
Source

tracker.lisp (file)

Method: next (PCYCLES pcycles-pstream)
Source

cycles.lisp (file)

Method: next (PATTERN pbjorklund-pstream)
Source

bjorklund.lisp (file)

Method: next (PS-PSTREAM ps-pstream)
Method: next (PACCUM paccum-pstream)
Method: next (PACLUMP paclump-pstream)
Method: next (PCLUMP pclump-pstream)
Method: next (PPARCHAIN pparchain-pstream)
Method: next (PWALK pwalk-pstream)
Method: next (PTS pts-pstream)
Method: next (PMETA pmeta-pstream)
Method: next (PPAR ppar-pstream)
Method: next (PDROP pdrop-pstream)
Method: next (PDELTA pdelta-pstream)
Method: next (PDIFF pdiff-pstream)
Method: next (PCHAIN pchain-pstream)
Method: next (PSYM psym-pstream)
Method: next (PRUN prun-pstream)
Method: next (PINDEX pindex-pstream)
Method: next (PTIME ptime-pstream)
Method: next (PBEAT* pbeat*-pstream)
Method: next (PBEAT pbeat-pstream)
Method: next (PDURSTUTTER pdurstutter-pstream)
Method: next (PSYNC psync-pstream)
Method: next (PFINDUR pfindur-pstream)
Method: next (PFIN pfin-pstream)
Method: next (PARP parp-pstream)
Method: next (PIF pif-pstream)
Method: next (PSCRATCH pscratch-pstream)
Method: next (PHISTORY phistory-pstream)
Method: next (PSLIDE pslide-pstream)
Method: next (PRERANGE prerange-pstream)
Method: next (PNARY pnary-pstream)
Method: next (PPATLACE ppatlace-pstream)
Method: next (PLACE place-pstream)
Method: next (PTRACE ptrace-pstream)
Method: next (PGEOM pgeom-pstream)
Method: next (PSERIES pseries-pstream)
Method: next (PGAUSS pgauss-pstream)
Method: next (PEXPRAND pexprand-pstream)
Method: next (PBROWN pbrown-pstream)
Method: next (PWHITE pwhite-pstream)
Method: next (PSHUF pshuf-pstream)
Method: next (PN pn-pstream)
Method: next (PLAZY plazy-pstream)
Method: next (PDEF pdef-pstream)
Method: next (PR pr-pstream)
Method: next (PFUNC pfunc-pstream)
Method: next (PWXRAND pwxrand-pstream)
Method: next (PWRAND pwrand-pstream)
Method: next (PXRAND pxrand-pstream)
Method: next (PRAND prand-pstream)
Method: next (PK pk-pstream)
Method: next (PSER pser-pstream)
Method: next (PSEQ pseq-pstream)
Method: next (PBIND pbind-pstream)
Method: next (PATTERN t-pstream)
Method: next (PSTREAM pstream) around
Method: next (PATTERN function)
Method: next (PATTERN pattern)
Method: next PATTERN
Generic Function: pan OBJECT

Stereo panning, where -1 is fully left, 1 is fully right, and 0 is center.

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf pan) (generic function)

Methods
Method: pan (EVENT event)
Generic Function: (setf pan) VALUE EVENT
Package

cl-patterns

Reader

pan (generic function)

Methods
Method: (setf pan) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: parent-pattern PATTERN

Get the containing pattern of PATTERN, or NIL if there isn’t one.

See also: ‘parent-pbind’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: parent-pattern (PATTERN pattern)
Generic Function: parent-pbind PATTERN

Get the containing pbind of PATTERN, or NIL if there isn’t one.

See also: ‘parent-pattern’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: parent-pbind (PATTERN pattern)
Generic Function: pattern-metadata PATTERN &optional KEY

Get the value of PATTERN’s metadata for KEY. Returns true as a second value if the metadata had an entry for KEY, or nil if it did not.

Package

cl-patterns

Source

patterns.lisp (file)

Writer

(setf pattern-metadata) (function)

Methods
Method: pattern-metadata (ESEQ eseq) &optional KEY
Source

eseq.lisp (file)

Method: pattern-metadata (PATTERN pattern) &optional KEY
Generic Function: pdef-key OBJECT

Get the key (name) of PDEF.

Package

cl-patterns

Source

patterns.lisp (file)

Writer

(setf pdef-key) (generic function)

Methods
Method: pdef-key (PDEF pdef)

automatically generated reader method

Method: pdef-key (PBIND pbind)
Generic Function: (setf pdef-key) VALUE PDEF
Package

cl-patterns

Reader

pdef-key (generic function)

Methods
Method: (setf pdef-key) VALUE (SYMBOL symbol)
Source

patterns.lisp (file)

Method: (setf pdef-key) VALUE (PDEF pdef)
Source

patterns.lisp (file)

Generic Function: pdef-pattern OBJECT

Get the pattern that PDEF points to.

Package

cl-patterns

Source

patterns.lisp (file)

Writer

(setf pdef-pattern) (generic function)

Methods
Method: pdef-pattern (NULL null)
Method: pdef-pattern (SYMBOL symbol)
Method: pdef-pattern (PDEF pdef)

automatically generated reader method

Generic Function: (setf pdef-pattern) NEW-VALUE OBJECT
Package

cl-patterns

Reader

pdef-pattern (generic function)

Methods
Method: (setf pdef-pattern) NEW-VALUE (PDEF pdef)

automatically generated writer method

Source

patterns.lisp (file)

Generic Function: pdef-pstream OBJECT
Generic Function: (setf pdef-pstream) NEW-VALUE OBJECT
Package

cl-patterns

Methods
Method: pdef-pstream (PDEF pdef)

automatically generated reader method

Source

patterns.lisp (file)

Method: (setf pdef-pstream) NEW-VALUE (PDEF pdef)

automatically generated writer method

Source

patterns.lisp (file)

Generic Function: pdef-task OBJECT

Get the task that PDEF was last being played in.

Package

cl-patterns

Source

patterns.lisp (file)

Writer

(setf pdef-task) (generic function)

Methods
Method: pdef-task (PDEF pdef)

automatically generated reader method

Generic Function: (setf pdef-task) NEW-VALUE OBJECT
Package

cl-patterns

Reader

pdef-task (generic function)

Methods
Method: (setf pdef-task) NEW-VALUE (PDEF pdef)

automatically generated writer method

Source

patterns.lisp (file)

Generic Function: peek PATTERN

"Peek" at the next value of a pstream, without advancing its current position.

See also: ‘next’, ‘peek-n’, ‘peek-upto-n’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: peek (PATTERN pattern)
Method: peek (PSTREAM pstream)
Generic Function: play OBJECT

Play an object (typically an event or pattern).

See also: ‘launch’, ‘stop’

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: play (LIST list)
Source

clock.lisp (file)

Method: play (SYMBOL symbol)
Source

clock.lisp (file)

Method: play (PDEF pdef)
Source

clock.lisp (file)

Method: play (PATTERN pattern)
Source

clock.lisp (file)

Method: play (EVENT event)
Source

clock.lisp (file)

Generic Function: play-quant OBJECT

The play-quant of OBJECT; a list representing when OBJECT is allowed to begin playing. Defaults to (1).

See ‘quant’ for more information on quants and a description of acceptable values.

See also: ‘quant’, ‘end-quant’, ‘next-beat-for-quant’, ‘beat’, ‘play’

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf play-quant) (generic function)

Methods
Method: play-quant (ESEQ eseq)
Source

eseq.lisp (file)

Method: play-quant (PDEF pdef)
Source

patterns.lisp (file)

Method: play-quant (PATTERN pattern)
Source

patterns.lisp (file)

Method: play-quant (EVENT event)
Source

event.lisp (file)

Generic Function: (setf play-quant) VALUE EVENT
Package

cl-patterns

Reader

play-quant (generic function)

Methods
Method: (setf play-quant) VALUE (ESEQ eseq)
Source

eseq.lisp (file)

Method: (setf play-quant) VALUE (PATTERN pattern)
Source

patterns.lisp (file)

Method: (setf play-quant) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: playing-p OBJECT &optional CLOCK

Whether OBJECT is playing.

See also: ‘play-or-stop’, ‘play-or-end’, ‘playing-pdefs’, ‘playing-nodes’

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: playing-p (LIST list) &optional CLOCK
Source

clock.lisp (file)

Method: playing-p (KEY symbol) &optional CLOCK
Source

clock.lisp (file)

Method: playing-p (PDEF pdef) &optional CLOCK
Source

clock.lisp (file)

Method: playing-p (TASK task) &optional CLOCK
Source

clock.lisp (file)

Generic Function: pstream-count PATTERN

The number of pstreams that have been made of this pattern.

Package

cl-patterns

Source

patterns.lisp (file)

Writer

(setf pstream-count) (generic function)

Methods
Method: pstream-count (ESEQ eseq)

The number of pstreams that have been made of this eseq.

Source

eseq.lisp (file)

Method: pstream-count (PSTREAM pstream)

How many times a pstream was made of this pstream’s source prior to this pstream. For example, if it was the first time ‘as-pstream’ was called on the pattern, this will be 0.

Method: pstream-count (PATTERN pattern)

The number of pstreams that have been made of this pattern.

Generic Function: (setf pstream-count) NEW-VALUE OBJECT
Package

cl-patterns

Reader

pstream-count (generic function)

Methods
Method: (setf pstream-count) NEW-VALUE (PSTREAM pstream)

How many times a pstream was made of this pstream’s source prior to this pstream. For example, if it was the first time ‘as-pstream’ was called on the pattern, this will be 0.

Source

patterns.lisp (file)

Method: (setf pstream-count) NEW-VALUE (PATTERN pattern)

The number of pstreams that have been made of this pattern.

Source

patterns.lisp (file)

Generic Function: quant OBJECT

The quant of OBJECT; a list representing when OBJECT is allowed to begin playing (‘play-quant’), end playing (‘end-quant’), or when a ‘pdef’ is allowed to swap to its new definition (‘end-quant’). ‘quant’ will return the value of ‘play-quant’, but sets both ‘play-quant’ and ‘end-quant’ when it is setf.

A quant value takes the form (divisor phase offset) where all provided elements are numbers. Only the first element is required.

- "divisor" is the divisor to quantize the clock to. The next time (mod (beats *clock*) divisor) is 0 is when OBJECT will start playing.
- "phase" is the number of beats to add on to the position determined by "divisor".
- "offset" is the number of seconds to add on to the position determined by "divisor" and "phase".

For example, a quant of (4) means it can start on any clock beat that is divisible by 4 (0, 4, 8, etc). A quant of (4 2) means the pstream can start 2 beats after any beat divisible by 4 (2, 6, 10, etc). And a quant of (4 0 1) means that the pstream can start 1 second after any beat that is divisible by 4.

See also: ‘play-quant’, ‘end-quant’, ‘next-beat-for-quant’, ‘beat’, ‘play’

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf quant) (generic function)

Methods
Method: quant (EVENT event)
Source

event.lisp (file)

Method: quant OBJECT
Generic Function: (setf quant) VALUE OBJECT
Package

cl-patterns

Reader

quant (generic function)

Methods
Method: (setf quant) VALUE (EVENT event)
Source

event.lisp (file)

Method: (setf quant) VALUE OBJECT
Source

utility.lisp (file)

Generic Function: rate OBJECT

Playback rate, i.e. for playing back sound buffers. 1 is normal speed, 2 is twice as fast, 0.5 half as fast, etc.

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf rate) (generic function)

Methods
Method: rate (EVENT event)
Generic Function: (setf rate) VALUE EVENT
Package

cl-patterns

Reader

rate (generic function)

Methods
Method: (setf rate) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: render OBJECT OUTPUT &key TEMPO MAX-PATTERN-YIELD-LENGTH MAX-OUTPUT-DURATION &allow-other-keys

Render a pattern or other object as audio or other format. OUTPUT is what the pattern should be rendered as. It accepts the following values:

- A string - Output file name (file format is determined by the file extension).
- :buffer - Render to a buffer in the relevant backend (determined by parameters of OBJECT, i.e. instrument or backend keys of events).
- :bdef - Render to a buffer handled by ‘bdef:bdef’ if the bdef library is loaded. Falls back to :buffer if bdef is not loaded.
- :file - Render to a file in the ‘*cl-patterns-temporary-directory*’.
- :score - Render as a SuperCollider score in memory. Only works if the cl-patterns/supercollider/score system is loaded. Can also be rendered to a file if a .osc filename is provided and :supercollider is provided for BACKEND. - :pstream - Make a pstream from the pattern and grab outputs to it. Effectively defers to ‘next-upto-n’.
- :eseq - Make an ‘eseq’ from the pattern. Effectively defers to ‘as-eseq’.
- Any backend name - Render as a buffer in that backend.

The following additional keyword arguments are also supported, depending on the output type:

- BACKEND - The name of the backend to use to render. Defaults to the first enabled backend.
- TEMPO - The tempo of the result in beats per second. Defaults to ‘*clock*”s current tempo.
- MAX-PATTERN-YIELD-LENGTH - Maximum number of outputs to grab from the source pattern. Must be an integer (cannot be :inf). See also: ‘*max-pattern-yield-length*’.
- MAX-OUTPUT-DURATION - The maximum duration of the output in seconds. Defaults to infinite, in which case the pattern is limited by MAX-PATTERN-YIELD-LENGTH.

See also: ‘as-eseq’

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: render OBJECT (OUTPUT (eql score)) &rest ARGS &key &allow-other-keys
Method: render OBJECT (OUTPUT (eql file)) &rest ARGS &key &allow-other-keys
Method: render OBJECT (OUTPUT (eql buffer)) &rest ARGS &key &allow-other-keys
Method: render OBJECT (OUTPUT pathname) &rest ARGS &key &allow-other-keys
Method: render OBJECT (OUTPUT (eql pstream)) &key MAX-PATTERN-YIELD-LENGTH
Generic Function: rest-p OBJECT

Whether or not something is a rest or a rest-representing object (i.e. :rest, :r, or a rest event).

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf rest-p) (generic function)

Methods
Method: rest-p (EVENT event)
Source

event.lisp (file)

Method: rest-p THIS
Method: rest-p (SYMBOL symbol)
Generic Function: (setf rest-p) VALUE EVENT
Package

cl-patterns

Reader

rest-p (generic function)

Methods
Method: (setf rest-p) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: scale OBJECT

Get either a musical scale object by its name, or get the name of the scale of an event.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf scale) (generic function)

Methods
Method: scale (EVENT event)
Source

event.lisp (file)

Method: scale (OBJECT scale)
Method: scale (OBJECT string)
Method: scale (OBJECT symbol)
Generic Function: (setf scale) VALUE EVENT
Package

cl-patterns

Reader

scale (generic function)

Methods
Method: (setf scale) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: scale-name SCALE

The full name of the scale.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf scale-name) (generic function)

Methods
Method: scale-name (THIS symbol)
Method: scale-name (SCALE scale)

The full name of the scale.

Generic Function: (setf scale-name) NEW-VALUE OBJECT
Package

cl-patterns

Reader

scale-name (generic function)

Methods
Method: (setf scale-name) NEW-VALUE (SCALE scale)

The full name of the scale.

Source

scales.lisp (file)

Generic Function: scale-notes SCALE

The degrees of the scale.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf scale-notes) (generic function)

Methods
Method: scale-notes (THIS symbol)
Method: scale-notes (SCALE scale)

The degrees of the scale.

Generic Function: (setf scale-notes) NEW-VALUE OBJECT
Package

cl-patterns

Reader

scale-notes (generic function)

Methods
Method: (setf scale-notes) NEW-VALUE (SCALE scale)

The degrees of the scale.

Source

scales.lisp (file)

Generic Function: scale-tuning SCALE

The scale’s ‘tuning’.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf scale-tuning) (generic function)

Methods
Method: scale-tuning (THIS symbol)
Method: scale-tuning (SCALE scale)

The scale’s ‘tuning’.

Generic Function: (setf scale-tuning) NEW-VALUE OBJECT
Package

cl-patterns

Reader

scale-tuning (generic function)

Methods
Method: (setf scale-tuning) NEW-VALUE (SCALE scale)

The scale’s ‘tuning’.

Source

scales.lisp (file)

Generic Function: start-backend BACKEND &key &allow-other-keys

Start a backend. Some backends support additional options which can be provided as keyword arguments.

See also: ‘stop-backend’, ‘enable-backend’

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: start-backend BACKEND &key &allow-other-keys before
Generic Function: stop OBJECT

Immediately stop a playing object (typically a pattern, pdef, task, or node). If OBJECT is T, stop all playing patterns and nodes.

See also: ‘end’, ‘play’

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: stop (ITEM (eql t))
Source

clock.lisp (file)

Method: stop (ITEM null)
Source

clock.lisp (file)

Method: stop (LIST list)
Source

clock.lisp (file)

Method: stop (TASK task)
Source

clock.lisp (file)

Method: stop (SYMBOL symbol)
Source

clock.lisp (file)

Method: stop (PDEF pdef)
Source

clock.lisp (file)

Generic Function: stop-backend BACKEND

Stop a backend. This is automatically called when ‘disable-backend’ is run.

See also: ‘start-backend’, ‘disable-backend’

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: sustain OBJECT

How long the note should be held, in beats.

See also: ‘legato’, ‘delta’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf sustain) (generic function)

Methods
Method: sustain (EVENT event)
Generic Function: (setf sustain) VALUE EVENT
Package

cl-patterns

Reader

sustain (generic function)

Methods
Method: (setf sustain) VALUE (EVENT event)
Source

event.lisp (file)

Generic Function: tempo OBJECT

Get the tempo of OBJECT in beats per second. If OBJECT is a number, set the tempo of ‘*clock*’ to that number.

Package

cl-patterns

Source

utility.lisp (file)

Writer

(setf tempo) (generic function)

Methods
Method: tempo (SYMBOL symbol)
Source

clock.lisp (file)

Method: tempo (NUMBER number)
Source

clock.lisp (file)

Method: tempo (CLOCK clock)

The tempo of the clock, in beats per second.

Source

clock.lisp (file)

Generic Function: (setf tempo) VALUE ITEM
Package

cl-patterns

Reader

tempo (generic function)

Methods
Method: (setf tempo) VALUE (ITEM clock)
Source

clock.lisp (file)

Generic Function: tuning OBJECT

Get a tuning by name.

Package

cl-patterns

Source

scales.lisp (file)

Methods
Method: tuning (OBJECT tuning)
Method: tuning (OBJECT string)
Method: tuning (OBJECT symbol)
Generic Function: tuning-name TUNING

The full name of the tuning.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf tuning-name) (generic function)

Methods
Method: tuning-name (THIS symbol)
Method: tuning-name (TUNING tuning)

The full name of the tuning.

Generic Function: (setf tuning-name) NEW-VALUE OBJECT
Package

cl-patterns

Reader

tuning-name (generic function)

Methods
Method: (setf tuning-name) NEW-VALUE (TUNING tuning)

The full name of the tuning.

Source

scales.lisp (file)

Generic Function: tuning-octave-ratio TUNING

The octave ratio of the tuning (i.e. what to multiply a pitch by to increase its octave by 1).

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf tuning-octave-ratio) (generic function)

Methods
Method: tuning-octave-ratio (THIS symbol)
Method: tuning-octave-ratio (TUNING tuning)

The octave ratio of the tuning (i.e. what to multiply a pitch by to increase its octave by 1).

Generic Function: (setf tuning-octave-ratio) NEW-VALUE OBJECT
Package

cl-patterns

Reader

tuning-octave-ratio (generic function)

Methods
Method: (setf tuning-octave-ratio) NEW-VALUE (TUNING tuning)

The octave ratio of the tuning (i.e. what to multiply a pitch by to increase its octave by 1).

Source

scales.lisp (file)

Generic Function: tuning-pitches TUNING

The actual semitone values of the tuning.

Package

cl-patterns

Source

scales.lisp (file)

Writer

(setf tuning-pitches) (generic function)

Methods
Method: tuning-pitches (THIS symbol)
Method: tuning-pitches (TUNING tuning)

The actual semitone values of the tuning.

Generic Function: (setf tuning-pitches) NEW-VALUE OBJECT
Package

cl-patterns

Reader

tuning-pitches (generic function)

Methods
Method: (setf tuning-pitches) NEW-VALUE (TUNING tuning)

The actual semitone values of the tuning.

Source

scales.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.5 Classes

Class: chord ()

Chord definition.

Package

cl-patterns

Source

scales.lisp (file)

Direct superclasses
  • sequence (class)
  • standard-object (class)
Direct methods
Direct slots
Slot: name

The full name of the chord.

Initargs

:name

Readers

chord-name (generic function)

Writers

(setf chord-name) (generic function)

Slot: indexes

The indexes of the notes from the scale that the chord is made up of.

Initargs

:indexes

Readers

chord-indexes (generic function)

Writers

(setf chord-indexes) (generic function)

Slot: scale

The scale that the chord is derived from.

Initargs

:scale

Readers

chord-scale (generic function)

Writers

(setf chord-scale) (generic function)

Class: eseq ()
Package

cl-patterns

Source

eseq.lisp (file)

Direct superclasses
Direct subclasses

eseq-pstream (class)

Direct methods
Direct slots
Slot: events

The actual list of events that the eseq contains. Don’t add events to this directly, as eseq expects them to be in order by beat. Instead use the ‘eseq-add’ function.

Type

list

Initargs

:events

Initform

(list)

Readers

eseq-events (generic function)

Writers

(setf eseq-events) (generic function)

Slot: dur

The duration of the eseq. If the slot is unbound, defaults to ‘last-dur’ rounded up to the next multiple of the eseq’s ‘play-quant’.

Type

(or null number)

Initargs

:dur

Slot: play-quant

A list of numbers representing when the eseq’s pstream can start playing. See ‘play-quant’.

Initargs

:play-quant

Slot: end-quant

A list of numbers representing when the eseq pstream can end playing or be swapped out for its source’s new definition. See ‘end-quant’.

Initargs

:end-quant

Slot: loop-p

Whether or not the eseq should loop when played.

Initargs

:loop-p

Slot: pstream-count

The number of pstreams that have been made of this eseq.

Initform

0

Readers

pstream-count (generic function)

Slot: source

The source object (i.e. pattern) that the eseq was created from, or nil if it was original.

Initargs

:source

Slot: metadata

Hash table of additional data associated with the eseq, accessible with the ‘pattern-metadata’ function.

Type

hash-table

Initargs

:metadata

Initform

(make-hash-table)

Class: event ()

Class representing a musical event.

Package

cl-patterns

Source

event.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: event-plist

The plist containing all of the event’s keys and values.

Type

list

Initargs

:event-plist

Initform

(list)

Readers

event-plist (generic function)

Slot: %beat

The time in beats when this event occurred in the pstream. Generally you should use ‘beat’ instead.

Type

(or null number)

Class: paccum ()

Numeric accumulator. Each output and STEP is used as the input for OPERATOR to generate the next output. When LO, HI, and BOUND-BY are provided, outputs that fall outside the range LO..HI are wrapped back inside with the BOUND-BY function; the value is provided as its first argument, and LO and HI are provided as its second and third.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-upto-n (paccum #’+ 0 1) 5) ;; same as (pseries 0 1)
;; ;=> (0 1 2 3 4)

;; (next-upto-n (paccum #’+ 0 1 :inf :lo 0 :hi 3 :bound-by #’wrap) 9) ;; same as above, wrapping between 0 and 3.
;; ;=> (0 1 2 0 1 2 0 1 2)

See also: ‘pseries’, ‘pgeom’, ‘pwalk’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

paccum-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: operator
Initargs

:operator

Slot: start
Initargs

:start

Slot: step
Initargs

:step

Slot: length
Initargs

:length

Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: bound-by
Initargs

:bound-by

Class: paccum-pstream ()

pstream for ‘paccum’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-value
Initargs

:current-value

Class: paclump ()

Automatically group outputs of the source pattern into lists of up to N items each. Unlike ‘pclump’, clump size is automatically set to the length of the longest list in the values of ‘*event*’, or 1 if there are no lists.

Example:

;; (next-upto-n (pbind :foo (pseq ’((1) (1 2) (1 2 3)) 1) :bar (paclump (pseries))))
;; ;=> ((EVENT :FOO (1) :BAR (0)) (EVENT :FOO (1 2) :BAR (1 2)) (EVENT :FOO (1 2 3) :BAR (3 4 5)))

See also: ‘pclump’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

paclump-pstream (class)

Direct methods

print-object (method)

Direct slots
Slot: pattern
Initargs

:pattern

Class: paclump-pstream ()

pstream for ‘paclump’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: parp ()

Arpeggiator pattern; each event yielded by PATTERN is bound to ‘*event*’ and then the entirety of the ARPEGGIATOR pattern is yielded.

Example:

;; (next-n (parp (pbind :foo (pseq ’(1 2 3))) (pbind :bar (pseq ’(4 5 6) 1))) 9)
;; ;=> ((EVENT :FOO 1 :BAR 4) (EVENT :FOO 1 :BAR 5) (EVENT :FOO 1 :BAR 6)
;; (EVENT :FOO 2 :BAR 4) (EVENT :FOO 2 :BAR 5) (EVENT :FOO 2 :BAR 6)
;; (EVENT :FOO 3 :BAR 4) (EVENT :FOO 3 :BAR 5) (EVENT :FOO 3 :BAR 6))

See also: ‘psym’, ‘pmeta’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

parp-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: arpeggiator
Initargs

:arpeggiator

Class: parp-pstream ()

pstream for ‘parp’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pattern-event
Initargs

:current-pattern-event

Slot: current-arpeggiator-stream
Initargs

:current-arpeggiator-stream

Class: pattern ()

Abstract pattern superclass.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods
Direct slots
Slot: play-quant

A list of numbers representing when the pattern’s pstream can start playing. See ‘play-quant’ and ‘quant’.

Initargs

:play-quant

Slot: end-quant

A list of numbers representing when a pattern can end playing and when a ‘pdef’ can be swapped out for a new definition. See ‘end-quant’ and ‘quant’.

Type

list

Initargs

:end-quant

Readers

end-quant (generic function)

Writers

(setf end-quant) (generic function)

Slot: end-condition

Nil or a function that is called by the clock with the pattern as its argument to determine whether the pattern should end or swap to a new definition.

Type

(or null function)

Initargs

:end-condition

Readers

end-condition (generic function)

Writers

(setf end-condition) (generic function)

Slot: parent

When a pattern is embedded in another pattern, the embedded pattern’s parent slot points to the pattern it is embedded in.

Initargs

:parent

Slot: loop-p

Whether or not the pattern should loop when played.

Initargs

:loop-p

Slot: cleanup

A list of functions that are run when the pattern ends or is stopped.

Initargs

:cleanup

Initform

(list)

Slot: pstream-count

The number of pstreams that have been made of this pattern.

Initform

0

Readers

pstream-count (generic function)

Writers

(setf pstream-count) (generic function)

Slot: metadata

Hash table of additional data associated with the pattern, accessible with the ‘pattern-metadata’ function.

Type

hash-table

Initargs

:metadata

Initform

(make-hash-table)

Class: pbeat ()

Yield the number of beats elapsed since the pbeat was embedded in the pstream.

Example:

;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 2 :FOO 1) (EVENT :DUR 3 :FOO 3))

See also: ‘pbeat*’, ‘beat’, ‘prun’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbeat-pstream (class)

Direct methods

print-object (method)

Class: pbeat* ()

Yield the number of beats on the ‘*clock*’ of the current pattern. In other words, pbeat* is clock-synced, unlike ‘pbeat’, which is pattern-synced.

Example:

;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat*)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 200) (EVENT :DUR 2 :FOO 201) (EVENT :DUR 3 :FOO 203))

See also: ‘pbeat’, ‘beat’, ‘prun’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbeat*-pstream (class)

Direct methods

print-object (method)

Class: pbeat*-pstream ()

pstream for ‘pbeat*’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: task
Initargs

:task

Class: pbeat-pstream ()

pstream for ‘pbeat’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pbind ()

pbind yields events determined by its PAIRS, which are a list of keys and values. Each key corresponds to a key in the resulting events, and each value is treated as a pattern that is evaluated for each step of the pattern to generate the value for its key.

Example:

;; (next-n (pbind :foo (pseq ’(1 2 3)) :bar :hello) 4)
;;
;; ;=> ((EVENT :FOO 1 :BAR :HELLO) (EVENT :FOO 2 :BAR :HELLO) (EVENT :FOO 3 :BAR :HELLO) NIL)

See also: ‘pmono’, ‘pb’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbind-pstream (class)

Direct methods
Direct slots
Slot: pairs

The pattern pairs of the pbind; a plist mapping its keys to their values.

Initargs

:pairs

Initform

(list)

Class: pbind-pstream ()

pstream for ‘pbind’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods
Class: pbjorklund ()

pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, and STEPS is number of steps in the sequence. Additionally, OFFSET is the number to rotate the sequence by, DUR is the total duration one repeat of the sequence should be, and REPEATS is the number of repeats that should be yielded. This pattern outputs events which can be embedded into another pattern. Each pulse is a note, and each subdivision of the sequence that is not a pulse is a rest. If you just want the raw output from the Bjorklund algorithm (not in pattern form), use ‘bjorklund’ instead.

Example:

;; (next-upto-n (pbjorklund 3 7))
;; => ((EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7))

See also: ‘bjorklund’

Package

cl-patterns

Source

bjorklund.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbjorklund-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: pulses
Initargs

:pulses

Slot: steps
Initargs

:steps

Slot: offset
Initargs

:offset

Slot: dur
Initargs

:dur

Slot: repeats
Initargs

:repeats

Class: pbjorklund-pstream ()

pstream for ‘pbjorklund’.

Package

cl-patterns

Source

bjorklund.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pbrown ()

Brownian motion within a range; each output randomly a maximum of STEP away from the previous. LO and HI define the lower and upper bounds of the range. STEP defaults to 1 if LO and HI are integers.

Example:

;; (next-upto-n (pbrown 0 10 1 10))
;; ;=> (2 3 3 3 4 3 4 5 6 5)

See also: ‘pwhite’, ‘pexprand’, ‘pgauss’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbrown-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: step
Initargs

:step

Slot: length
Initargs

:length

Class: pbrown-pstream ()

pstream for ‘pbrown’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-value
Initargs

:current-value

Class: pchain ()

Combine multiple patterns into one event stream.

Example:

;; (next-n (pchain (pbind :foo (pseq ’(1 2 3))) (pbind :bar (pseq ’(7 8 9) 1))) 4) ;;
;; ;=> ((EVENT :FOO 1 :BAR 7) (EVENT :FOO 2 :BAR 8) (EVENT :FOO 3 :BAR 9) NIL)

See also: ‘pbind”s :embed key

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses
Direct methods

as-pstream (method)

Direct slots
Slot: patterns
Initargs

:patterns

Class: pchain-pstream ()

pstream for ‘pchain’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct subclasses

pparchain-pstream (class)

Direct methods

next (method)

Class: pclump ()

Group outputs of the source pattern into lists of up to N items each.

Example:

;; (next-upto-n (pclump (pseries 0 1 5) 2))
;; ;=> ((0 1) (2 3) (4))

See also: ‘paclump’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pclump-pstream (class)

Direct methods

print-object (method)

Direct slots
Slot: pattern
Initargs

:pattern

Slot: n
Initargs

:n

Class: pclump-pstream ()

pstream for ‘pclump’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pcycles ()

pcycles yields values from LIST as events whose dur is (/ 1 list-length) and whose value is the original value in the list. This process recurses into sublists, subdividing their durs equally among the sublist’s contents to be a fraction of what their dur originally would be. The total dur yielded by pcycles is always equal to 1. pcycles repeats the whole LIST once.

Package

cl-patterns

Source

cycles.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pcycles-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: map
Initargs

:map

Class: pcycles-pstream ()

pstream for ‘pcycles’.

Package

cl-patterns

Source

cycles.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: parsed-list
Initargs

:parsed-list

Class: pdef ()

Define a named pattern, with KEY being the name of the pattern and PATTERN the pattern itself. Named patterns are stored by name in a global dictionary and can be referred back to by calling ‘pdef’ without supplying PATTERN. The global dictionary also keeps track of the pdef’s pstream when ‘play’ is called on it. If a pdef is redefined while it is being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘end-quant’ time is reached (if non-nil). Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).

Example:

;; (pdef :foo (pbind :degree (pseries 0 1 4)))
;;
;; (play (pdef :foo))
;; ;; redefine the pdef’s pattern... note that the redefinition doesn’t become audible until the current loop finishes playing:
;; (pdef :foo (pbind :degree (pseries 4 -1 4)))

See also: ‘find-pdef’, ‘all-pdefs’, ‘pb’, ‘pmeta’, ‘ps’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pdef-pstream (class)

Direct methods
Direct slots
Slot: key
Initargs

:key

Readers

pdef-key (generic function)

Slot: pattern
Initargs

:pattern

Readers

pdef-pattern (generic function)

Writers

(setf pdef-pattern) (generic function)

Slot: pstream
Initargs

:pstream

Readers

pdef-pstream (generic function)

Writers

(setf pdef-pstream) (generic function)

Slot: task
Initargs

:task

Readers

pdef-task (generic function)

Writers

(setf pdef-task) (generic function)

Class: pdef-pstream ()

pstream for ‘pdef’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods
  • next (method)
  • print-object (method)
Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: pdelta ()

Output the difference between successive outputs of PATTERN, assuming PATTERN restarts every CYCLE outputs.

Unlike ‘pdiff’, pdelta is written with its use as input for ‘pbind”s :delta key in mind. If PATTERN’s successive values would result in a negative difference, pdelta instead wraps the delta around to the next multiple of CYCLE. This would allow you to, for example, supply the number of the beat that each event occurs on, rather than specifying the delta between each event. This is of course achievable using pbind’s :beat key as well, however that method requires the pbind to peek at future values, which is not always desirable.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-n (pdelta (pseq ’(0 1 2 3)) 4) 8)
;;
;; ;=> (1 1 1 1 1 1 1 1)
;;
;; (next-n (pdelta (pseq ’(0 1 2 5)) 4) 8)
;;
;; ;=> (1 1 3 3 1 1 3 3)

See also: ‘pdiff’, ‘pbind”s :beat key

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pdelta-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: cycle
Initargs

:cycle

Class: pdelta-pstream ()

pstream for ‘pdelta’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pdiff ()

Output the difference between successive outputs of PATTERN.

Example:

;; (next-n (pdiff (pseq ’(3 1 4 3) 1)) 4)
;;
;; ;=> (-2 3 -1 NIL)

See also: ‘pdelta’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pdiff-pstream (class)

Direct methods

print-object (method)

Direct slots
Slot: pattern
Initargs

:pattern

Class: pdiff-pstream ()

pstream for ‘pdiff’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pdrop ()

Drop the first N outputs from PATTERN and yield the rest. If N is negative, drop the last N outputs from PATTERN instead.

Example:

;; (next-n (pdrop (pseq ’(1 2 3 4) 1) 2) 4)
;;
;; ;=> (3 4 NIL NIL)

See also: ‘pshift’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pdrop-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: n
Initargs

:n

Class: pdrop-pstream ()

pstream for ‘pdrop’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pdurstutter ()

Yield each output from PATTERN N times, dividing it by N. If the output from PATTERN is an event, its dur is divided; if it’s a number, the number itself is divided instead of being yielded directly.

Example:

;; (next-n (pdurstutter (pseq ’(1 2 3 4 5)) (pseq ’(3 2 1 0 2))) 9)
;; ;=> (1/3 1/3 1/3 1 1 3 5/2 5/2 NIL)
;;
;; (next-n (pdurstutter (pbind :dur (pseq ’(1 2 3 4 5)))
;; (pseq ’(3 2 1 0 2)))
;; 9)
;; ;=> ((EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1) (EVENT :DUR 1) (EVENT :DUR 3) (EVENT :DUR 5/2) (EVENT :DUR 5/2) NIL)

See also: ‘pr’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pdurstutter-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: n
Initargs

:n

Class: pdurstutter-pstream ()

pstream for ‘pdurstutter’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-value
Initargs

:current-value

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Initform

0

Class: pexprand ()

Exponentially-distributed random numbers between LO and HI. Note that LO and HI cannot be 0, and that LO and HI must have the same sign or else complex numbers will be output.

Example:

;; (next-upto-n (pexprand 1.0 8.0 4))
;; ;=> (1.0420843091865208d0 1.9340168112124456d0 2.173209129035095d0 4.501371557329618d0)

See also: ‘pwhite’, ‘pbrown’, ‘pgauss’, ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pexprand-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: length
Initargs

:length

Class: pexprand-pstream ()

pstream for ‘pexprand’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pfin ()

Yield up to COUNT outputs from PATTERN.

Example:

;; (next-n (pfin (pseq ’(1 2 3) :inf) 3) 5) ;; ;=> (1 2 3 NIL NIL)

See also: ‘pfindur’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pfin-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: count
Initargs

:count

Class: pfin-pstream ()

pstream for ‘pfin’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pfindur ()

Yield events from PATTERN until their total duration is within TOLERANCE of DUR, or greater than DUR. Any events that would end beyond DUR are cut short. If PATTERN outputs numbers, their total sum is limited instead.

Example:

;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) NIL)
;;
;; (next-upto-n (pfindur (pwhite 0 4) 16))
;; ;=> (1 3 0 1 2 2 1 3 0 1 2)
;; (reduce #’+ *)
;; ;=> 16

See also: ‘pfin’, ‘psync’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pfindur-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: dur
Initargs

:dur

Slot: tolerance
Initargs

:tolerance

Class: pfindur-pstream ()

pstream for ‘pfindur’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-dur
Initargs

:current-dur

Slot: elapsed-dur
Initargs

:elapsed-dur

Initform

0

Class: pfunc ()

Yield the result of evaluating FUNC. Note that the current event of the parent pattern is still accessible via the ‘*event*’ special variable.

Example:

;; (next-upto-n (pfunc (lambda () (random 10)) 4))
;; ;=> ((5 2 8 9))
;;
;; (next-upto-n (pbind :foo (pwhite 0 10 4) :bar (pfunc (lambda () (if (> (event-value *event* :foo) 5) :greater :lesser)))))
;; ;=> ((EVENT :FOO 0 :BAR :LESSER) (EVENT :FOO 6 :BAR :GREATER)
;; (EVENT :FOO 7 :BAR :GREATER) (EVENT :FOO 8 :BAR :GREATER))

See also: ‘pf’, ‘pnary’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pfunc-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: func
Initargs

:func

Slot: length
Initargs

:length

Class: pfunc-pstream ()

pstream for ‘pfunc’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pgauss ()

Random numbers distributed along a normal (gaussian) curve. MEAN is the "center" of the distribution, DEVIATION is the standard deviation (i.e. the higher the value, the further the outputs are spread from MEAN).

Example:

;; (next-n (pgauss) 4)
;; ;=> (0.08918811646370092d0 0.1745957067161632d0 0.7954678768273173d0 -1.2215823449671597d0)

See also: ‘pwhite’, ‘pexprand’, ‘pbrown’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pgauss-pstream (class)

Direct methods
Direct slots
Slot: mean
Initargs

:mean

Slot: deviation
Initargs

:deviation

Slot: length
Initargs

:length

Class: pgauss-pstream ()

pstream for ‘pgauss’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pgeom ()

Yield START, then generate subsequent outputs by multiplying by GROW, for a total of LENGTH outputs.

Example:

;; (next-upto-n (pgeom 1 2 4))
;; ;=> (1 2 4 8)

See also: ‘pseries’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pgeom-pstream (class)

Direct methods
Direct slots
Slot: start
Initargs

:start

Slot: grow
Initargs

:grow

Slot: length
Initargs

:length

Class: pgeom-pstream ()

pstream for ‘pgeom’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-value
Initargs

:current-value

Class: phistory ()

Refer back to PATTERN’s history, yielding the output at the index provided by STEP-PATTERN.

Note that PATTERN is still advanced once per event, and if STEP-PATTERN yields a number pointing to an event in PATTERN that hasn’t been yielded yet (i.e. if PATTERN has only advanced once but STEP-PATTERN yields 3 for its output), phistory yields nil.

Example:

;; (next-n (phistory (pseries) (pseq ’(0 2 1))) 3)
;; ;=> (0 NIL 1)

See also: ‘pscratch’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

phistory-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: step-pattern
Initargs

:step-pattern

Class: phistory-pstream ()

pstream for ‘phistory’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pif ()

"If" expression for patterns. TEST is evaluated for each step, and if it’s non-nil, the value of TRUE will be yielded, otherwise the value of FALSE will be. Note that TRUE and FALSE can be patterns, and if they are, they are only advanced in their respective cases, not for every step. Also note that pif will continue to advance even if TEST yields nil; pif only yields nil if TRUE or FALSE do.

Example:

;; (next-n (pif (pseq ’(t t nil nil nil)) (pseq ’(1 2)) (pseq ’(3 nil 4))) 5)
;; ;=> (1 2 3 NIL 4)

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pif-pstream (class)

Direct methods
Direct slots
Slot: test
Initargs

:test

Slot: true
Initargs

:true

Slot: false
Initargs

:false

Class: pif-pstream ()

pstream for ‘pif’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pindex ()

Use INDEX-PAT to index into the list returned by LIST-PAT. WRAP-P is whether indexes that are out of range will be wrapped (if t) or will simply return nil.

Example:

;; (next-n (pindex (list 99 98 97) (pseq (list 0 1 2 3))) 4)
;;
;; ;=> (99 98 97 NIL)
;;
;; (next-upto-n (pindex (list 99 98 97) (pseries 0 1 6) t))
;;
;; ;=> (99 98 97 99 98 97)

See also: ‘pwalk’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pindex-pstream (class)

Direct methods
Direct slots
Slot: list-pat
Initargs

:list-pat

Slot: index-pat
Initargs

:index-pat

Slot: wrap-p
Initargs

:wrap-p

Class: pindex-pstream ()

pstream for ‘pindex’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pk ()

Yield the value of KEY in the current ‘*event*’ context, returning DEFAULT if that value is nil.

Example:

;; (next-upto-n (pbind :foo (pseq ’(1 2 3) 1) :bar (pk :foo)))
;; ;=> ((EVENT :FOO 1 :BAR 1) (EVENT :FOO 2 :BAR 2) (EVENT :FOO 3 :BAR 3))

See also: ‘pbind’, ‘event-value’, ‘*event*’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pk-pstream (class)

Direct methods
Direct slots
Slot: key
Initargs

:key

Slot: default
Initargs

:default

Class: pk-pstream ()

pstream for ‘pk’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: place ()

Yield each value from LIST in sequence. If the value is a list, the first element of that list is yielded. The second time that sub-list is encountered, its second element will be yielded; the third time, the third element, and so on. REPEATS controls the number of times LIST is repeated.

Example:

;; (next-upto-n (place (list 1 2 (list 3 4 5)) 3))
;; ;=> (1 2 3 1 2 4 1 2 5)

See also: ‘ppatlace’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

place-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: repeats
Initargs

:repeats

Class: place-pstream ()

pstream for ‘place’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeat
Initargs

:current-repeat

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: plazy ()

Evaluates FUNC to generate a pattern, which is then yielded from until its end, at which point FUNC is evaluated again to generate the next pattern. The pattern is generated a total of REPEATS times.

Example:

;; (next-n (plazy (lambda () (if (= 0 (random 2)) (pseq ’(1 2 3) 1) (pseq ’(9 8 7) 1)))) 6)
;; ;=> (9 8 7 1 2 3)

See also: ‘pfunc’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

plazy-pstream (class)

Direct methods
Direct slots
Slot: func
Initargs

:func

Slot: repeats
Initargs

:repeats

Class: plazy-pstream ()

pstream for ‘plazy’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pmeta ()

Meta-control patterns using the events output by PATTERN. In other words, instead of triggering synths directly, the events output by PATTERN are used to embed patterns into the pmeta’s pstream.

The following keys are supported:

- :pattern or :instrument - name of the source pattern for this "step".
- :dur - set the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).
- :findur - limit the duration of the embedded pattern.
- :sync - sync the duration of the embedded pattern to a multiple of the provided value, similar to ‘psync’
- :stretch - multiply the duration of each of the source pattern’s events.
- :ts or :fit - timestretch a pattern so its total duration is the number specified, a la ‘pts’.
- :r or :repeat - repeat each event the number of times returned by the function when the event is applied to it, similar to ‘pr’.
- :inject - inject key/value pairs from the output of this value into the source pattern.
- :step-inject or :sinject - inject one output from this value per step.

The following keys are planned for future implementation:

- :start or :end - adjust the start or end points of the source pattern (i.e. to skip the first half, set :start to 0.5).
- :start-beat or :end-beat - adjust the start or end points of the source pattern in number of beats (i.e. to end the pattern 2 beats early, set :end-beat to -2).
- :start-nth or :end-nth - adjust the start or end points of the source pattern by skipping the first or last N events.
- :filter or :remove-if-not - skip all events from the source pattern that return nil when applied to the specified function or pattern.
- :mapcar or :nary - process each event from the source pattern with a function or another pattern.

See doc/special-keys.org for more information on these keys.

Example:

;; ;; define a few patterns...
;; (pdef :foo (pbind :x (pseq ’(1 2 3) 1) :dur 1))
;; (pdef :bar (pbind :y (pseries) :dur (pwhite 0.1 1.0 3)))
;;
;; ;; use pmeta to play pattern foo and then pattern bar, ensuring each are 2 beats long in total by way of pmeta’s sync key, which works similarly to ‘psync’
;; (next-upto-n (pmeta :pattern (pseq (list :foo :bar) 1) :sync 2))
;; ;=> ((EVENT :X 1 :DUR 1) (EVENT :X 2 :DUR 1) ;; from (pdef :foo)
;; (EVENT :Y 0 :DUR 0.76958686) (EVENT :Y 1 :DUR 0.94850993) (EVENT :Y 2 :DUR 0.28190327)) ;; from (pdef :bar)

See also: ‘psym’, ‘parp’, ‘pdef’, ‘pbind’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pmeta-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: pattern
Initargs

:pattern

Class: pmeta-pstream ()

pstream for ‘pmeta’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: pn ()

Embed the full PATTERN into the pstream REPEATS times.

Example:

;; (next-upto-n (pn (pwhite 0 5 1) 5))
;; ;=> (2 4 2 1 0)

See also: ‘pr’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pn-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: repeats
Initargs

:repeats

Class: pn-pstream ()

pstream for ‘pn’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-pstream
Initargs

:current-pstream

Class: pnary ()

Yield the result of applying OPERATOR to each value yielded by each pattern in PATTERNS.

Example:

;; (next-upto-n (pnary (pseq (list ’+ ’- ’* ’/) 2) 2 2))
;; ;=> (4 0 4 1)

See also: ‘pfunc’, ‘p+’, ‘p-’, ‘p*’, ‘p/’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pnary-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: operator
Initargs

:operator

Slot: patterns
Initargs

:patterns

Class: pnary-pstream ()

pstream for ‘pnary’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: ppar ()

Combine multiple event patterns into one pstream with all events in temporal order. LIST is the list of patterns, or a pattern yielding lists of patterns. The ppar ends when all of the patterns in LIST end.

Example:

;; (next-upto-n (ppar (list (pbind :dur (pn 1/2 4))
;; (pbind :dur (pn 2/3 4)))))
;;
;; ;=> ((EVENT :DUR 1/2 :DELTA 0) (EVENT :DUR 2/3 :DELTA 1/2)
;; (EVENT :DUR 1/2 :DELTA 1/6) (EVENT :DUR 2/3 :DELTA 1/3)
;; (EVENT :DUR 1/2 :DELTA 1/3) (EVENT :DUR 2/3 :DELTA 1/6)
;; (EVENT :DUR 1/2 :DELTA 1/2))

See also: ‘psym’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ppar-pstream (class)

Direct methods

print-object (method)

Direct slots
Slot: list
Initargs

:list

Class: ppar-pstream ()

pstream for ‘ppar’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: pstreams
Initargs

:pstreams

Class: pparchain ()

Combine multiple patterns into several event streams. The event yielded by the first pattern will be used as the input event to the second pattern, and so on. The events yielded by each pattern will be collected into a list and yielded by the pparchain. This pattern is effectively ‘ppar’ and ‘pchain’ combined.

Example:

;; (next-upto-n (pparchain (pbind :foo (pseries 0 1 3)) (pbind :baz (p+ (pk :foo) 1) :foo (p+ (pk :foo) 3))))
;; ;=> (((EVENT :FOO 0) (EVENT :FOO 3 :BAZ 1))
;; ((EVENT :FOO 1) (EVENT :FOO 4 :BAZ 2))
;; ((EVENT :FOO 2) (EVENT :FOO 5 :BAZ 3)))

See also: ‘ppc’, ‘ppar’, ‘pchain’, ‘pbind”s :embed key

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pchain (class)

Direct subclasses

pparchain-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: patterns
Initargs

:patterns

Class: pparchain-pstream ()

pstream for ‘pparchain’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: ppatlace ()

Yield each value from LIST in sequence, or one output from each pattern in LIST per cycle of the list. If one of the patterns embedded in LIST ends sooner than the others, it is simply removed and the ppatlace continues to yield from the rest of the LIST. The entire LIST is yielded through a total of REPEATS times.

Example:

;; (next-upto-n (ppatlace (list (pseq (list 1 2 3) 1)
;; (pseq (list 4 5 6) 2))))
;; ;=> (1 4 2 5 3 6 4 5 6)

See also: ‘place’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ppatlace-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: repeats
Initargs

:repeats

Class: ppatlace-pstream ()

pstream for ‘ppatlace’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pr ()

Repeat each value from PATTERN REPEATS times. If REPEATS is 0, the value is skipped.

Example:

;; (next-upto-n (pr (pseries) (pseq ’(1 3 0 2) 1)))
;; ;=> (0 1 1 1 3 3)

See also: ‘pdurstutter’, ‘pn’, ‘pdrop’, ‘parp’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pr-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: repeats
Initargs

:repeats

Class: pr-pstream ()

pstream for ‘pr’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-value
Initargs

:current-value

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: prand ()

Yield random values from LIST.

Example:

;; (next-n (prand ’(1 2 3) 5) 6)
;; ;=> (3 2 2 1 1 NIL)

See also: ‘pxrand’, ‘pwrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

prand-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: length
Initargs

:length

Class: prand-pstream ()

pstream for ‘prand’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: prerange ()

Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.

Note that this is effectively a convenience wrapper over ‘pnary’ and ‘rerange’; thus you should see ‘rerange’ for more information.

See also: ‘rerange’, ‘pnary’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

prerange-pstream (class)

Direct methods
Direct slots
Slot: input
Initargs

:input

Slot: from-range
Initargs

:from-range

Slot: to-range
Initargs

:to-range

Class: prerange-pstream ()

pstream for ‘prerange’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: prun ()

Run PATTERN "independently" of its parent, holding each value for DUR beats. Each of PATTERN’s outputs is treated as if it lasted DUR beats, being continuously yielded during that time before moving on to the next output.

Example:

;; (next-upto-n (pbind :foo (pseq ’(1 2 3 4 5))
;; :bar (prun (pseq ’(4 5 6 7 8))
;; (pseq ’(1 2 0.5 0.5 1)))))
;; ;=> ((EVENT :FOO 1 :BAR 4)
;; (EVENT :FOO 2 :BAR 5)
;; (EVENT :FOO 3 :BAR 5)
;; (EVENT :FOO 4 :BAR 6)
;; (EVENT :FOO 5 :BAR 8))

See also: ‘beat’, ‘pbeat’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

prun-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: dur
Initargs

:dur

Class: prun-pstream ()

pstream for ‘prun’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-dur
Initargs

:current-dur

Class: ps ()

Preserve pstream state across subsequent calls to ‘as-pstream’. To reset the pstream, simply re-evaluate the ps definition.

Based on the pattern originally from the miSCellaneous SuperCollider library.

Example:

;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
;;
;; (next-upto-n *pst* 4)
;; ;=> (4 5 6 7)
;;
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)

See also: ‘prs’, ‘pdef’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ps-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: pattern
Initargs

:pattern

Slot: pstream
Initargs

:pstream

Class: ps-pstream ()

pstream for ‘ps’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pscratch ()

"Scratches" across the values yielded by a pstream, similar in concept to how a DJ might scratch a record, altering the normal flow of playback. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.

Based on the pattern originally from the ddwPatterns SuperCollider library.

Example:

;; (next-upto-n (pscratch (pseries) (pseq ’(0 1 1 -1 2) 2)))
;; ;=> (0 0 1 2 1 3 3 4 5 4)

See also: ‘phistory’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pscratch-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: step-pattern
Initargs

:step-pattern

Class: pscratch-pstream ()

pstream for ‘pscratch’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-index
Initargs

:current-index

Initform

0

Class: pseq ()

Sequentially yield items from LIST, repeating the whole list REPEATS times. OFFSET is the offset to index into the list.

Example:

;; (next-n (pseq ’(5 6 7) 2) 7)
;; ;=> (5 6 7 5 6 7 NIL)
;;
;; (next-upto-n (pseq ’(5 6 7) 2 1))
;; ;=> (6 7 5 6 7 5)

See also: ‘pser’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pseq-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: repeats
Initargs

:repeats

Slot: offset
Initargs

:offset

Class: pseq-pstream ()

pstream for ‘pseq’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pser ()

Sequentially yield values from LIST, yielding a total of LENGTH values.

Example:

;; (next-n (pser ’(5 6 7) 2) 3)
;;
;; ;=> (5 6 NIL)

See also: ‘pseq’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pser-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: length
Initargs

:length

Slot: offset
Initargs

:offset

Class: pser-pstream ()

pstream for ‘pser’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-index
Initargs

:current-index

Class: pseries ()

Yield START, then generate subsequent outputs by adding STEP, for a total of LENGTH outputs.

Example:

;; (next-upto-n (pseries 1 2 4))
;; ;=> (1 3 5 7)

See also: ‘pseries*’, ‘pgeom’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pseries-pstream (class)

Direct methods
Direct slots
Slot: start
Initargs

:start

Slot: step
Initargs

:step

Slot: length
Initargs

:length

Class: pseries-pstream ()

pstream for ‘pseries’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-value
Initargs

:current-value

Class: pshuf ()

Shuffle LIST, then yield each item from the shuffled list, repeating it REPEATS times.

Example:

;; (next-upto-n (pshuf ’(1 2 3) 2))
;;
;; ;=> (3 1 2 3 1 2)

See also: ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pshuf-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: repeats
Initargs

:repeats

Class: pshuf-pstream ()

pstream for ‘pshuf’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: shuffled-list
Initargs

:shuffled-list

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pslide ()

"Slide" across sections of LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP is the number to increment the start index by after each section, and START is the initial index into LIST that the first section starts from. WRAP-AT-END, when true, means that an index outside of the list will wrap around. When false, indexes outside of the list result in nil.

Example:

;; (next-upto-n (pslide (list 0 1 2 3 4 5 6) 3 3 2 1 t))
;; ;=> (1 2 3 3 4 5 5 6 0)

See also: ‘pscratch’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pslide-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: repeats
Initargs

:repeats

Slot: len
Initargs

:len

Slot: step
Initargs

:step

Slot: start
Initargs

:start

Slot: wrap-at-end
Initargs

:wrap-at-end

Class: pslide-pstream ()

pstream for ‘pslide’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Slot: current-repeats
Initargs

:current-repeats

Slot: remaining-current-segment
Initargs

:remaining-current-segment

Slot: current-value
Initargs

:current-value

Class: pstream ()

"Pattern stream". Keeps track of the current state of a pattern in process of yielding its outputs.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct subclasses
Direct methods
Direct slots
Slot: number

The number of outputs yielded from this pstream and any sub-pstreams that have ended.

Initform

0

Slot: pattern-stack

The stack of pattern pstreams embedded in this pstream.

Initform

(list)

Slot: source

The source object (i.e. pattern) that this pstream was created from.

Initargs

:source

Slot: pstream-count

How many times a pstream was made of this pstream’s source prior to this pstream. For example, if it was the first time ‘as-pstream’ was called on the pattern, this will be 0.

Type

integer

Initargs

:pstream-count

Readers

pstream-count (generic function)

Writers

(setf pstream-count) (generic function)

Slot: beat

The number of beats that have elapsed since the start of the pstream.

Type

number

Initform

0

Readers

beat (generic function)

Slot: history

The history of outputs yielded by the pstream.

Type

vector

Slot: history-number

The number of items in this pstream’s history. Differs from the number slot in that all outputs are immediately included in its count.

Initform

0

Slot: start-beat

The beat number of the parent pstream when this pstream started.

Initargs

:start-beat

Slot: future-number

The number of peeks into the future that have been made in the pstream. For example, if ‘peek’ is used once, this would be 1. If ‘next’ is called after that, future-number decreases back to 0.

Initform

0

Slot: future-beat

The current beat including all future outputs (the ‘beat’ slot does not include peeked outputs).

Initform

0

Class: psym ()

Use a pattern of symbols to embed ‘pdef’s. PATTERN is the source pattern that yields symbols naming the pdef to embed.

Example:

;; (pdef :foo (pseq ’(1 2 3) 1))
;;
;; (pdef :bar (pseq ’(4 5 6) 1))
;;
;; (next-upto-n (psym (pseq ’(:foo :bar) 1)))
;;
;; ;=> (1 2 3 4 5 6)

See also: ‘pdef’, ‘ppar’, ‘pmeta’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

psym-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Class: psym-pstream ()

pstream for ‘psym’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: psync ()

Yield events from PATTERN until their total duration is within TOLERANCE of MAXDUR, cutting off any events that would extend past MAXDUR. If PATTERN ends before MAXDUR, a rest is added to the pstream to round its duration up to the nearest multiple of SYNC-QUANT.

Example:

;; (next-upto-n (psync (pbind :dur (pseq ’(5) 1)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :TYPE :REST :DUR 3))
;;
;; (next-upto-n (psync (pbind :dur (pseq ’(5) 5)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5 :DELTA 1))

See also: ‘pfindur’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

psync-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: sync-quant
Initargs

:sync-quant

Slot: maxdur
Initargs

:maxdur

Slot: tolerance
Initargs

:tolerance

Class: psync-pstream ()

pstream for ‘psync’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: elapsed-dur
Initargs

:elapsed-dur

Initform

0

Class: ptime ()

Yield the number of seconds elapsed since ptime was embedded in the pstream.

Note: May give inaccurate results if the clock’s tempo changes occur more frequently than events in the parent pbind.

Example:

;; (setf (tempo *clock*) 1) ;; 60 BPM
;; (next-n (pbind :dur 1 :time (ptime)) 2)
;; ;=> ((EVENT :DUR 1 :TIME 0) (EVENT :DUR 1 :TIME 1.0))

See also: ‘pbeat’, ‘prun’, ‘beat’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ptime-pstream (class)

Direct methods

print-object (method)

Class: ptime-pstream ()

pstream for ‘ptime’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: last-beat-checked
Initargs

:last-beat-checked

Slot: tempo-at-beat
Initargs

:tempo-at-beat

Slot: elapsed-time
Initargs

:elapsed-time

Initform

0

Class: ptrace ()

Print the PREFIX and each output of TRACE to STREAM. If TRACE is t, print ‘*event*’. If TRACE is a different symbol, print the value of that symbol in ‘*event*’. If TRACE is a pattern, ptrace yields its output unaffected. Otherwise, it yields t.

See also: ‘debug-recent-events’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ptrace-pstream (class)

Direct methods
Direct slots
Slot: trace
Initargs

:trace

Slot: prefix
Initargs

:prefix

Slot: stream
Initargs

:stream

Class: ptrace-pstream ()

pstream for ‘ptrace’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: ptracker ()

Defines an event pattern via a tracker-inspired notation. HEADER is a plist mapping the pattern’s "columns" (keys) to their default values or to patterns that are used to generate the key’s values for each output. ROWS is a list of lists, each sublist specifying the values for a step. Values can be specified on their own (in which case they’re matched in order to the columns specified in the header) or by using Lisp’s traditional key/value notation.

By default, the pattern repeats infinitely, however it can be limited by providing a :repeats argument in the header specifying the number of repeats.

Example:

;; (ptracker (list :freq 440 :dur 1/4)
;; ’((100) ;; play a note with a frequency of 100
;; :r ;; rest for 1/4 beat
;; (:midinote 70 :dur 1/2) ;; play a note at midinote 70 for 1/2 beat
;; (-) ;; continue previous note for an additional 1/4 beat
;; (600 3/4) ;; play a note with a frequency of 600 for 3/4 beat
;; :r ;; rest for 1/4 beat
;; (750 :foo 3) ;; play a note at frequency 750, dur 1/4, and additional :foo key with value 3
;; ))

See also: ‘pt’, ‘pcycles’, ‘pbind’

Package

cl-patterns

Source

tracker.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ptracker-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: header
Initargs

:header

Slot: rows
Initargs

:rows

Class: ptracker-pstream ()

pstream for ‘ptracker’.

Package

cl-patterns

Source

tracker.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: repeats
Initargs

:repeats

Slot: current-row
Initargs

:current-row

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pts ()

Timestretch PATTERN so its total duration is DUR. Note that only the first ‘*max-pattern-yield-length*’ events from PATTERN are considered, and that they are calculated immediately at pstream creation time rather than lazily as the pstream yields.

Example:

;; (next-upto-n (pts (pbind :dur (pn 1 4)) 5))
;;
;; ;=> ((EVENT :DUR 5/4) (EVENT :DUR 5/4) (EVENT :DUR 5/4) (EVENT :DUR 5/4))

See also: ‘pfindur’, ‘psync’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pts-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: dur
Initargs

:dur

Class: pts-pstream ()

pstream for ‘pts’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pwalk ()

"Walk" over the values in LIST by using the accumulated value of the outputs of STEP-PATTERN as the index. At the beginning of the pwalk and each time the start or end of the list is passed, the output of DIRECTION-PATTERN is taken and used as the multiplier for values from STEP-PATTERN. START-POS is the index in LIST for pwalk to take its first output from.

Example:

;; ;; using (pseq (list 1 -1)) as the DIRECTION-PATTERN causes the pwalk’s output to "ping-pong":
;; (next-n (pwalk (list 0 1 2 3) (pseq (list 1)) (pseq (list 1 -1))) 10)
;;
;; ;=> (0 1 2 3 2 1 0 1 2 3)

See also: ‘pindex’, ‘pbrown’, ‘paccum’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pwalk-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: step-pattern
Initargs

:step-pattern

Slot: direction-pattern
Initargs

:direction-pattern

Slot: start-pos
Initargs

:start-pos

Class: pwalk-pstream ()

pstream for ‘pwalk’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-index
Initargs

:current-index

Slot: current-direction
Initargs

:current-direction

Class: pwhite ()

Linearly-distributed random numbers between LO and HI, inclusive.

Example:

;; (next-upto-n (pwhite 0 10 16))
;; ;=> (7 2 4 5 7 10 4 8 10 2 3 5 9 2 5 4)

See also: ‘pexprand’, ‘pbrown’, ‘pgauss’, ‘prand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pwhite-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: length
Initargs

:length

Class: pwhite-pstream ()

pstream for ‘pwhite’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pwrand ()

Yield random elements from LIST weighted by respective values from WEIGHTS.

Example:

;; (next-upto-n (pwrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 1 2 2 2 1 2 1 1 3)

See also: ‘prand’, ‘pxrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pwrand-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Slot: weights
Initargs

:weights

Slot: length
Initargs

:length

Class: pwrand-pstream ()

pstream for ‘pwrand’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pwxrand ()

Yield random elements from LIST weighted by respective values from WEIGHTS, never repeating equivalent values twice in a row. This is effectively ‘pxrand’ and ‘pwrand’ combined.

Example:

;; (next-upto-n (pwxrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 2 1 2 1 3 1 2 1 2)

See also: ‘prand’, ‘pxrand’, ‘pwrand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pwxrand-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: list
Initargs

:list

Slot: weights
Initargs

:weights

Slot: length
Initargs

:length

Class: pwxrand-pstream ()

pstream for ‘pwxrand’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: last-result
Initargs

:last-result

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pxrand ()

Yield random values from LIST, never repeating equal values twice in a row.

Example:

;; (next-upto-n (pxrand ’(1 2 3) 4))
;; ;=> (3 1 2 1)

See also: ‘prand’, ‘pwrand’, ‘pwxrand’

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pxrand-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: list
Initargs

:list

Slot: length
Initargs

:length

Class: pxrand-pstream ()

pstream for ‘pxrand’.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: last-result
Initargs

:last-result

Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: scale ()

Scale definition.

Package

cl-patterns

Source

scales.lisp (file)

Direct superclasses
  • sequence (class)
  • standard-object (class)
Direct methods
Direct slots
Slot: name

The full name of the scale.

Initargs

:name

Readers

scale-name (generic function)

Writers

(setf scale-name) (generic function)

Slot: notes

The degrees of the scale.

Initargs

:notes

Readers

scale-notes (generic function)

Writers

(setf scale-notes) (generic function)

Slot: tuning

The scale’s ‘tuning’.

Initargs

:tuning

Readers

scale-tuning (generic function)

Writers

(setf scale-tuning) (generic function)

Class: tuning ()

Tuning definition.

Package

cl-patterns

Source

scales.lisp (file)

Direct superclasses
  • sequence (class)
  • standard-object (class)
Direct methods
Direct slots
Slot: name

The full name of the tuning.

Initargs

:name

Readers

tuning-name (generic function)

Writers

(setf tuning-name) (generic function)

Slot: pitches

The actual semitone values of the tuning.

Initargs

:pitches

Readers

tuning-pitches (generic function)

Writers

(setf tuning-pitches) (generic function)

Slot: octave-ratio

The octave ratio of the tuning (i.e. what to multiply a pitch by to increase its octave by 1).

Initargs

:octave-ratio

Readers

tuning-octave-ratio (generic function)

Writers

(setf tuning-octave-ratio) (generic function)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *abbreviations*

List of abbreviations that should be used by ‘generate-aliases’ to auto-generate aliases for ‘tuning’s, ‘scale’s, ‘chord’s, etc.

Package

cl-patterns

Source

scales.lisp (file)

Special Variable: *backends*

List of registered backends for cl-patterns. This holds all the information about each backend and should not be modified by the user; change the ‘*enabled-backends*’ variable to set which backends are enabled.

Package

cl-patterns

Source

backend.lisp (file)

Special Variable: *chords*

Hash table mapping names and aliases to chord definition objects.

Package

cl-patterns

Source

scales.lisp (file)

Special Variable: *deprecated-function-warning-raw-set-event-value-notified-p*
Package

cl-patterns

Source

event.lisp (file)

Special Variable: *dictionary-lookup-functions*

List of functions that can be used to look up the object that a symbol can name. Each function should return the object in question if it exists, or nil (or throw an error) if it doesn’t.

Functions like ‘play’, ‘end’, ‘launch’, and ‘stop’ will check symbols against each of these dictionaries in order and will apply themselves to the object from the first dictionary with a matching key.

Example:

;; *dictionary-lookup-functions*
;; => (CL-PATTERNS::FIND-PDEF BDEF:BDEF)
;; (play :foo) ;; will (play (pdef :foo)) if that pdef exists, or (play (bdef :foo)) if the bdef exists. If neither exists, it will throw an error.

See also: ‘play’, ‘launch’, ‘end’, ‘stop’

Package

cl-patterns

Source

backend.lisp (file)

Special Variable: *enabled-backends*

List of registered and enabled backends for cl-patterns. Any event that is played is tested against each of these backends’ respond-p functions in order. The event is then played on the first backend to return true.

Package

cl-patterns

Source

backend.lisp (file)

Special Variable: *event-special-keys*

Plist mapping event special keys to their case lists.

Package

cl-patterns

Source

event.lisp (file)

Special Variable: *patterns*

List of the names of all defined pattern types.

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *pbind-special-init-keys*

The list of special keys for pbind that alters it during its initialization.

See also: ‘define-pbind-special-init-key’

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *pbind-special-process-keys*

The list of special keys for pbind that alter the outputs of the pbind.

See also: ‘define-pbind-special-process-key’

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *pbind-special-wrap-keys*

The list of special keys for pbind that causes the pbind to be replaced by another pattern during its initialization.

See also: ‘define-pbind-special-wrap-key’

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *pdef-dictionary*

The global pdef dictionary.

Package

cl-patterns

Source

patterns.lisp (file)

Special Variable: *performance-errors-lock*

The lock on ‘*performance-errors*’ to make it thread-safe.

Package

cl-patterns

Source

clock.lisp (file)

Special Variable: *scales*

Hash table mapping names and aliases to scale definition objects.

Package

cl-patterns

Source

scales.lisp (file)

Special Variable: *tunings*

Hash table mapping names and aliases to tuning definition objects.

Package

cl-patterns

Source

scales.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Symbol macros

Symbol Macro: *latency*
Package

cl-patterns

Source

event.lisp (file)

Expansion

(cl-patterns::clock-latency cl-patterns:*clock*)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.3 Macros

Macro: define-event-special-key NAME CASES &key REMOVE-KEYS DEFINE-METHODS DOCUMENTATION

Define a special key with the key NAME for events (i.e. keys that take their values from other keys, or keys that have default values).

CASES is an alist of cases mapping event key names to forms. When ‘event-value’ is called on an event for the NAME key, then the event is tested for the keys of CASES in the order they’re listed. The associated form of the first key of CASES that exists in the event is evaluated to get the value of that call to ‘event-value’.

If no case is provided with a key that’s the same as NAME, one is automatically added at the start with a form that just returns the value of the event’s NAME key. If a case is provided with t as its key, that case is always run when found. This allows you to set a default value for the key if none of the other keys from CASES exist in the event.

REMOVE-KEYS is a list of keys to remove from the event when the NAME key is being set with ‘(setf event-value)’. If t (the default), all keys in CASES will be removed from the event.

DEFINE-METHODS, if true, will cause the macro to define methods for getting and setting the key in an event.

DOCUMENTATION is the documentation string for the function.

Example:

;; (define-event-special-key amp ((:db (db-amp (raw-event-value event :db)))
;; (t 0.5))
;; :define-methods t)

This defines the amp key for events. Since the :amp KEY is implied, it doesn’t need to be specified in the CASES. Thus if the event already has an :amp key, its value will be used by default. If no :amp key exists in the event, then the :db FUNC is run if the :db key exists. If neither :amp nor :db exist in the event, then the t key is run, giving a default of 0.5.

Additionally, because :define-methods is true, we can also do the following:

;; (defparameter *foo* (event :amp 0.9))
;; (amp *foo*) ; => 0.9
;; (setf (amp *foo*) 0.7)

Package

cl-patterns

Source

event.lisp (file)

Macro: define-pbind-special-init-key KEY &body BODY

Define a special key for pbind that alters the pbind during its initialization, either by embedding a plist into its pattern-pairs or in another way. These functions are called once, when the pbind is created, and must return a plist if the key should embed values into the pbind pairs, or NIL if it should not.

Package

cl-patterns

Source

patterns.lisp (file)

Macro: define-pbind-special-process-key KEY &body BODY

Define a special key for pbind that alters the pattern in a nonstandard way. These functions are called for each event created by the pbind and must return an event if the key should embed values into the event stream, or NIL if the pstream should end.

Package

cl-patterns

Source

patterns.lisp (file)

Macro: define-pbind-special-wrap-key KEY &body BODY

Define a special key for pbind that replaces the pbind with another pattern during the pbind’s initialization. Each encapsulation key is run once on the pbind after it has been initialized, altering the type of pattern returned if the return value of the function is non-NIL.

Package

cl-patterns

Source

patterns.lisp (file)

Macro: make-default-render-method TYPE

Generate a default ‘render’ method.

Package

cl-patterns

Source

utility.lisp (file)

Macro: make-default-render-methods ()

Generate the default ‘render’ methods for :buffer, :file, :score, etc.

Package

cl-patterns

Source

utility.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.4 Compiler macros

Compiler Macro: raw-set-event-value &rest ARGS
Package

cl-patterns

Source

event.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.5 Functions

Function: absolute-beats-to-timestamp BEATS CLOCK

Convert a clock’s number of beats to a timestamp. The result is only guaranteed to be accurate if it’s greater than the clock’s beat-at-tempo slot.

Package

cl-patterns

Source

clock.lisp (file)

Function: backend-instrument-has-gate-p INSTRUMENT BACKEND

Whether or not SYNTH in BACKEND has a gate control (i.e. whether it needs to be manually released or if it acts as a "one-shot").

Package

cl-patterns

Source

backend.lisp (file)

Function: can-swap-now-p PSTREAM

Whether PSTREAM can swap to its new definition, based on ‘end-quant’, ‘end-condition’, and ‘ended-p’.

Package

cl-patterns

Source

clock.lisp (file)

Function: clock-add ITEM &optional CLOCK

Add ITEM (usually a ‘pstream’) to CLOCK’s tasks. Generally you don’t need to use this directly and would use ‘play’ instead.

See also: ‘clock-remove’, ‘play’

Package

cl-patterns

Source

clock.lisp (file)

Function: clock-clear-tasks &optional CLOCK

Remove all tasks from CLOCK.

See also: ‘clock-tasks’

Package

cl-patterns

Source

clock.lisp (file)

Function: clock-latency &optional CLOCK
Function: (setf clock-latency) VALUE &optional CLOCK
Package

cl-patterns

Source

clock.lisp (file)

Function: clock-remove TASK &optional CLOCK

Remove TASK from CLOCK’s tasks. Generally you don’t need to use this directly and would use ‘stop’ or ‘end’ instead.

See also: ‘clock-add’, ‘stop’, ‘end’

Package

cl-patterns

Source

clock.lisp (file)

Function: cumulative-list LIST

Return a copy of LIST where the elements previous are added to the current one.

Example:

;; (cumulative-list (list 1 2 3 4))
;; => (1 3 6 10)

Package

cl-patterns

Source

utility.lisp (file)

Function: cycles-parse LIST
Package

cl-patterns

Source

cycles.lisp (file)

Function: decf-remaining PATTERN &optional KEY

Decrease PATTERN’s KEY value.

See also: ‘remaining-p’

Package

cl-patterns

Source

patterns.lisp (file)

Function: ensure-pdef OBJECT

Attempt to ensure OBJECT is a pdef.

Package

cl-patterns

Source

patterns.lisp (file)

Function: event-backends EVENT

Get a list of backends that EVENT should be played on, either via the event’s :backend key or via the ‘enabled-backends’.

Package

cl-patterns

Source

backend.lisp (file)

Function: event-with-raw-timing EVENT TASK

Get an event like EVENT but with the :BEAT-AT-START and :TIMESTAMP-AT-START keys added for backends.

Package

cl-patterns

Source

clock.lisp (file)

Function: find-backend-supporting-render RENDER-TYPE

Get the output and backend names of the first enabled backend that supports RENDER-TYPE (i.e. :buffer, :file, :score, etc), or nil if none support it.

See also: ‘render’

Package

cl-patterns

Source

utility.lisp (file)

Function: from-range INPUT MAP

Unmap INPUT from the range specified by MAP to the range [0..1].

See also: ‘to-range’, ‘rerange’

Package

cl-patterns

Source

utility.lisp (file)

Function: generate-aliases NAME

Generate a list of aliases for NAME by mapping various combinations of ‘*abbreviations*’.

See also: ‘*abbreviations*’

Package

cl-patterns

Source

scales.lisp (file)

Function: gete LIST KEY

Get a list of the value of KEY for each event in LIST.

Package

cl-patterns

Source

utility.lisp (file)

Function: index-and-offset NUM

Return a cons cell consisting of the input number and the offset its sharps/flats represent.

Package

cl-patterns

Source

scales.lisp (file)

Function: index-of-greater-than N LIST

Get the index of the first element of LIST greater than N.

Package

cl-patterns

Source

utility.lisp (file)

Function: lookup-object-for-symbol SYMBOL

Look up the object named by SYMBOL using ‘*dictionary-lookup-functions*’. Returns nil if no object was found.

Package

cl-patterns

Source

backend.lisp (file)

Function: make-default-event ()

Get ‘*event*’ if it’s not nil, or get a fresh empty event.

Package

cl-patterns

Source

patterns.lisp (file)

Function: mapcar-longest FUNCTION &rest LISTS

Like ‘mapcar’, but the resulting list is the length of the longest input list instead of the shortest. Indexes into shorter lists are wrapped. Additional return values from the last call are passed through as additional values from this function.

Example:

;; (mapcar-longest #’+ (list 1) (list 2 3 4))
;; => (3 4 5)

See also: ‘multi-channel-funcall’

Package

cl-patterns

Source

utility.lisp (file)

Function: near NUMBER &optional RANGE OF

Test whether NUMBER is within RANGE (bipolar) of OF.

Examples:

;; (near 4 1 5) ;; => t
;; (near 4 1) ;; => nil
;; (near 0.5) ;; => t
;; (near 0.5 0.6 1) ;; => t

See also: ‘alexandria:clamp’, ‘wrap’

Package

cl-patterns

Source

utility.lisp (file)

Function: normalized-sum LIST

Return a copy of LIST normalized so all of its numbers summed together equal 1.

Package

cl-patterns

Source

utility.lisp (file)

Function: note-name-and-octave NOTE

Given a note name, return a list consisting of its note number and its octave (defaulting to 5 if it’s not specified).

See also: ‘note-number’, ‘note-name’

Package

cl-patterns

Source

scales.lisp (file)

Function: pcycles-parse-list LIST &optional MAP
Package

cl-patterns

Source

cycles.lisp (file)

Function: pdef-ensure-key KEY

Ensure KEY is a proper pdef key.

Package

cl-patterns

Source

patterns.lisp (file)

Function: pdef-ref KEY &optional VALUE

Retrieve a value from the global pdef dictionary, or set it if VALUE is provided.

Package

cl-patterns

Source

patterns.lisp (file)

Function: plist-set PLIST KEY VALUE

Return a new copy of PLIST, but with its KEY set to VALUE. If VALUE is nil, return a copy without KEY.

Package

cl-patterns

Source

utility.lisp (file)

Function: pshift PATTERN SHIFT &optional MAX-YIELD
Package

cl-patterns

Source

patterns.lisp (file)

Function: pstream-elt-index-to-history-index PSTREAM INDEX

Given INDEX, an absolute index into PSTREAM’s history, return the actual index into the current recorded history of the pstream.

See also: ‘pstream-history-advance-by’

Package

cl-patterns

Source

patterns.lisp (file)

Function: pstream-history-advance-by PSTREAM INDEX

Convert a history index (i.e. a positive number provided to ‘pstream-elt-future’) to the amount that the history must be advanced by.

If the provided index is before the earliest item in history, the result will be a negative number denoting how far beyond the earliest history the index is. If the provided index is within the current history, the result will be zero.
If the provided index is in the future, the result will be a positive number denoting how far in the future it is.

See also: ‘pstream-elt-index-to-history-index’

Package

cl-patterns

Source

patterns.lisp (file)

Function: raw-event-value EVENT KEY

Get the value of KEY in EVENT without running any conversion functions.

See also: ‘event-value’

Package

cl-patterns

Source

event.lisp (file)

Writer

(setf raw-event-value) (function)

Function: (setf raw-event-value) VALUE EVENT KEY

Set the value of KEY to VALUE in EVENT without running any conversion functions.

See also: ‘raw-event-value’, ‘event-value’

Package

cl-patterns

Source

event.lisp (file)

Reader

raw-event-value (function)

Function: raw-set-event-value EVENT KEY VALUE

Set the value of KEY to VALUE in EVENT without running any conversion functions. Deprecated; use (setf (raw-event-value EVENT KEY) VALUE) instead.

Package

cl-patterns

Source

event.lisp (file)

Function: remaining-p PATTERN &optional REPEATS-KEY REMAINING-KEY

True if PATTERN’s REMAINING-KEY slot value represents outputs "remaining" (see ‘value-remaining-p’). If PATTERN’s REMAINING-KEY slot is unbound or 0, and REPEATS-KEY is not nil, then it is automatically set to the ‘next’ of PATTERN’s REPEATS-KEY slot. Then if that new value is 0 or nil, remaining-p returns nil. Otherwise, :reset is returned as a generalized true value and to indicate that ‘next’ was called on PATTERN’s REPEATS-KEY slot.

See also: ‘value-remaining-p’, ‘decf-remaining’

Package

cl-patterns

Source

patterns.lisp (file)

Function: seq &key START END LIMIT STEP DEFAULT

Generate a sequence of numbers as a list.

START is the start of the range, END is the end. LIMIT is a hard limit on the number of results in the sequence. STEP is the interval between each number in the sequence.

When STEP is omitted and LIMIT is provided, the step is automatically calculated by dividing the range between LIMIT steps.

If LIMIT is 1, DEFAULT is used to find the value. DEFAULT can be :START, :END, :MEAN, or another value. :START and :END mean the returned value is the value of those arguments. :MEAN means the mean value of START and END is used. If another value is provided, it is used as the default instead.

See also: ‘seq-range’

Package

cl-patterns

Source

utility.lisp (file)

Function: seq-range NUM &optional STOP STEP

Conveniently generate a sequence of numbers as a list. This function is based off Python’s range() function, and thus has three ways of being called:

With one argument NUM, generate a range from 0 to (1- NUM):

;; (seq-range 4) ; => (0 1 2 3)

With two arguments NUM and STOP, generate a range from NUM to (1- STOP):

;; (seq-range 2 4) ; => (2 3)

With three arguments NUM, STOP, and STEP, generate a range from NUM to (1- STOP), each step increasing by STEP:

;; (seq-range 2 8 2) ; => (2 4 6)

See also: ‘seq’

Package

cl-patterns

Source

utility.lisp (file)

Function: set-parents PATTERN

Loop through PATTERN’s slots and set the "parent" slot of any patterns to this pattern.

Package

cl-patterns

Source

patterns.lisp (file)

Function: sharp-or-flat STRING

Given STRING, return a number representing how many semitones above or below its number it represents, by counting sharps (#) and flats (b).

Package

cl-patterns

Source

scales.lisp (file)

Function: string-reader STREAM CHAR
Package

cl-patterns

Source

tracker.lisp (file)

Function: string-replace STRING OLD NEW

Find the first instance of OLD in STRING and replace it with NEW. Return the new string, or if OLD was not found, return STRING unchanged. Returns the position that OLD was found as a second value, or nil if it was not found.

Package

cl-patterns

Source

utility.lisp (file)

Function: t-pstream VALUE

Make a t-pstream object with the value VALUE.

Package

cl-patterns

Source

patterns.lisp (file)

Function: t-short STREAM CHAR SUBCHAR
Package

cl-patterns

Source

tracker.lisp (file)

Function: task-nodes TASK BACKEND

Get the list of nodes for TASK for the specified backend. If BACKEND is nil, get all of the resources for TASK regardless of backend.

Package

cl-patterns

Source

backend.lisp (file)

Writer

(setf task-nodes) (function)

Function: (setf task-nodes) VALUE TASK BACKEND

Set the list of nodes for TASK for the specified backend. If BACKEND is nil, set the full backend-resources slot for the task.

Package

cl-patterns

Source

backend.lisp (file)

Reader

task-nodes (function)

Function: to-range INPUT MAP

Map INPUT from the range [0..1] to the range specified by MAP.

See also: ‘from-range’, ‘rerange’

Package

cl-patterns

Source

utility.lisp (file)

Function: tracker-shorthand STREAM CHAR SUBCHAR

Reader macro for ‘ptracker’ preprocessing.

Package

cl-patterns

Source

tracker.lisp (file)

Function: value-remaining-p VALUE

True if VALUE represents that a pstream has outputs "remaining"; i.e. VALUE is a symbol (i.e. :inf), or a number greater than 0.

See also: ‘remaining-p’, ‘decf-remaining’

Package

cl-patterns

Source

patterns.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.6 Generic functions

Generic Function: backend-all-nodes BACKEND

Get a list of all active nodes for the specified backend.

See also: ‘backend-panic’

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: backend-control-node-at TIME NODE PARAMS BACKEND

At TIME, set NODE’s parameters to PARAMS. If NODE is an instrument name, launch a node with those parameters at the specified time instead. This function should return the node object.

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: backend-convert-object OBJECT KEY BACKEND

Convert OBJECT to a value that BACKEND can understand. For example, the SuperCollider backend requires that any ‘cl-collider::buffer’ objects are converted to their bufnum.

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-convert-object OBJECT KEY BACKEND
Generic Function: backend-instrument-args-list INSTRUMENT EVENT BACKEND

Generate a plist of parameters for INSTRUMENT based off of its controls, taking values from EVENT. Unlike ‘event-plist’, this function doesn’t include event keys that aren’t also one of the synth’s arguments.

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-instrument-args-list INSTRUMENT EVENT BACKEND
Generic Function: backend-instrument-controls INSTRUMENT BACKEND

Get the list of names of controls for INSTRUMENT in BACKEND.

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: backend-node-p OBJECT BACKEND

True if OBJECT is a node for the specified backend.

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: backend-panic BACKEND

"Panic" the backend, i.e. stop all of its nodes immediately.

See also: ‘backend-all-nodes’

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-panic BACKEND
Generic Function: backend-play-event EVENT TASK BACKEND

Play ITEM on the sound server specified by BACKEND. TASK is the task that triggered ITEM to be played. Typically a backend should not need to define a specialized method for this generic if it already provides methods for the following:

- ‘backend-instrument-controls’
- ‘backend-node-p’
- ‘backend-timestamps-for-event’
- ‘backend-proxys-node’
- ‘backend-control-node-at’

It’s suggested to define methods for ‘backend-convert-object’ if the backend requires objects to be converted to another representation before being used as an instrument’s parameters. Additionally, methods for ‘play’, ‘launch’, ‘stop’, and ‘end’ may be convenient to define for the backend’s node class.

See also: ‘backend-task-removed’

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-play-event ITEM TASK BACKEND
Generic Function: backend-proxys-node ID BACKEND

Get the current node object on BACKEND for the proxy with the specified ID.

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: backend-task-removed TASK BACKEND

Called when TASK is removed from the clock so BACKEND can free any associated nodes. Typically a backend shouldn’t need to define a method for this generic if it already defines methods for the events listed in the docstring for ‘backend-play-event’.

See also: ‘backend-play-event’

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-task-removed TASK BACKEND
Generic Function: backend-tempo-change-at CLOCK TIMESTAMP BACKEND

Set the backend’s tempo to NEW-TEMPO at the timestamp provided.

Package

cl-patterns

Source

backend.lisp (file)

Methods
Method: backend-tempo-change-at CLOCK TIMESTAMP BACKEND
Generic Function: backend-timestamps-for-event EVENT TASK BACKEND

Get a list containing timestamps for the start and end of EVENT’s note, in the format that BACKEND expects for its scheduling function.

See also: ‘backend-control-node-at’

Package

cl-patterns

Source

backend.lisp (file)

Generic Function: clock-process-event CLOCK TASK EVENT TYPE

Process EVENT on CLOCK. TASK is the associated task, and TYPE is the event type.

Package

cl-patterns

Source

clock.lisp (file)

Methods
Method: clock-process-event CLOCK TASK EVENT TYPE
Method: clock-process-event CLOCK TASK EVENT (TYPE (eql rest))
Method: clock-process-event CLOCK TASK EVENT (TYPE (eql tempo))
Generic Function: end-condition OBJECT
Generic Function: (setf end-condition) NEW-VALUE OBJECT
Package

cl-patterns

Methods
Method: end-condition (PATTERN pattern)
Method: (setf end-condition) NEW-VALUE (PATTERN pattern)

Nil or a function that is called by the clock with the pattern as its argument to determine whether the pattern should end or swap to a new definition.

Source

patterns.lisp (file)

Generic Function: ended-p PSTREAM

Returns t if PSTREAM has no more outputs, or nil if outputs remain to be yielded.

Example:

;; (defparameter *pstr* (as-pstream (pseq ’(1 2) 1)))
;; (next *pstr*) ;=> 1
;; (ended-p *pstr*) ;=> NIL
;; (next *pstr*) ;=> 2
;; (ended-p *pstr*) ;=> NIL
;; (next *pstr*) ;=> NIL
;; (ended-p *pstr*) ;=> T

See also: ‘last-output’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: ended-p (PSTREAM pstream)
Generic Function: events-in-range PSTREAM MIN MAX

Get all the events from PSTREAM whose start beat are MIN or greater, and less than MAX.

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: events-in-range (PSTREAM pstream) MIN MAX
Method: events-in-range (PATTERN pattern) MIN MAX
Generic Function: last-dur OBJECT

Get the beat position of the ending of the last event in the ESEQ.

Package

cl-patterns

Source

utility.lisp (file)

Methods
Method: last-dur (ESEQ eseq)
Source

eseq.lisp (file)

Method: last-dur (LIST list)
Generic Function: last-output PSTREAM

Returns the last output yielded by PSTREAM.

Example:

;; (defparameter *pstr* (as-pstream (pseq ’(1 2 3) 1))) ;; (next *pstr*) ;=> 1
;; (last-output *pstr*) ;=> 1

See also: ‘ended-p’

Package

cl-patterns

Source

patterns.lisp (file)

Methods
Method: last-output (PSTREAM pstream)
Generic Function: next.events-ordered ESEQ
Package

cl-patterns

Methods
Method: next.events-ordered (ESEQ eseq-pstream)
Source

eseq.lisp (file)

Generic Function: pstream-elt-index CONDITION
Package

cl-patterns

Methods
Method: pstream-elt-index (CONDITION pstream-out-of-range)
Source

patterns.lisp (file)

Generic Function: real-beat CLOCK
Package

cl-patterns

Methods
Method: real-beat (CLOCK clock)

Get the "real beat" of the clock; i.e. compute what the beat number should actually be at this instant in time (whereas the beat slot for the clock is quantized to the clock’s granularity).

Note that this function will likely be removed in the future with improvements to the clock, so you should expect to eventually have to update code depending on it.

See also: ‘beat’

Source

clock.lisp (file)

Generic Function: task-clock OBJECT
Generic Function: (setf task-clock) NEW-VALUE OBJECT
Package

cl-patterns

Methods
Method: task-clock (TASK task)
Method: (setf task-clock) NEW-VALUE (TASK task)

The clock that the task is running on.

Source

clock.lisp (file)

Generic Function: task-item OBJECT
Generic Function: (setf task-item) NEW-VALUE OBJECT
Package

cl-patterns

Methods
Method: task-item (TASK task)
Method: (setf task-item) NEW-VALUE (TASK task)

The actual playing item that the task refers to. Typically this is a pstream or similar.

Source

clock.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.7 Conditions

Condition: pstream-out-of-range ()
Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

condition (condition)

Direct methods

pstream-elt-index (method)

Direct slots
Slot: index
Initargs

:index

Readers

pstream-elt-index (generic function)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.8 Classes

Class: clock ()

A musical time-based clock defining a tempo and pulse that its tasks synchronize to.

Package

cl-patterns

Source

clock.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: beat

The number of beats that have elapsed since the creation of the clock.

Type

number

Initform

0

Readers

beat (generic function)

Writers

(setf beat) (generic function)

Slot: tempo

The tempo of the clock, in beats per second.

Type

number

Initargs

:tempo

Initform

1

Readers

tempo (generic function)

Slot: latency

The default latency for events played on the clock.

Initargs

:latency

Initform

1/10

Slot: play-expired-events

If T, always play events, even if their scheduled time has already passed. If NIL, silently skip these events. If :WARN, print a warning for each event skipped.

Initargs

:play-expired-events

Slot: tasks

The list of tasks that are running on the clock. Use ‘play’, ‘stop’, etc to play and stop patterns (the "friendly" way to add or remove them from the clock), or ‘clock-add’ and ‘clock-remove’ to manually remove them directly.

Slot: tasks-lock

The lock on the tasks to make the clock thread-safe.

Initform

(bordeaux-threads:make-recursive-lock)

Slot: timestamp-at-tempo

The local-time timestamp when the tempo was last changed.

Initform

(local-time:now)

Slot: beat-at-tempo

The number of beats on the clock when the tempo was last changed.

Initform

0

Class: eseq-pstream ()
Package

cl-patterns

Source

eseq.lisp (file)

Direct superclasses
Direct methods
Direct slots
Slot: events-remaining

The list of events left to be played in the pstream.

Initargs

:events-remaining

Slot: direct-p

Whether changes to the source eseq should affect this pstream immediately.

Initargs

:direct-p

Class: t-pstream ()

Pattern stream object that yields its value only once.

Package

cl-patterns

Source

patterns.lisp (file)

Direct superclasses

pstream (class)

Direct methods
  • next (method)
  • print-object (method)
Direct slots
Slot: value

The value that is yielded by the t-pstream.

Initargs

:value

Class: task ()

An item scheduled to be run on the clock.

Package

cl-patterns

Source

clock.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: item

The actual playing item that the task refers to. Typically this is a pstream or similar.

Initargs

:item

Readers

task-item (generic function)

Writers

(setf task-item) (generic function)

Slot: loop-p

Whether the task should loop. If left unbound, the task’s item’s loop-p slot is referred to instead.

Initargs

:loop-p

Slot: start-beat

The beat of the clock when the task started.

Type

(or null number)

Initargs

:start-beat

Slot: clock

The clock that the task is running on.

Type

cl-patterns::clock

Initargs

:clock

Readers

task-clock (generic function)

Writers

(setf task-clock) (generic function)

Slot: backend-resources

Resources associated with this task that should be freed by it, i.e. nodes it triggered, buffers it loaded, etc.

Initargs

:backend-resources


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-patterns.asd: The cl-patterns․asd file
cl-patterns/backend.lisp: The cl-patterns/backend․lisp file
cl-patterns/clock.lisp: The cl-patterns/clock․lisp file
cl-patterns/conversions.lisp: The cl-patterns/conversions․lisp file
cl-patterns/eseq.lisp: The cl-patterns/eseq․lisp file
cl-patterns/event.lisp: The cl-patterns/event․lisp file
cl-patterns/extensions/sequence.lisp: The cl-patterns/extensions/sequence․lisp file
cl-patterns/package.lisp: The cl-patterns/package․lisp file
cl-patterns/patterns: The cl-patterns/patterns module
cl-patterns/patterns/bjorklund.lisp: The cl-patterns/patterns/bjorklund․lisp file
cl-patterns/patterns/cycles.lisp: The cl-patterns/patterns/cycles․lisp file
cl-patterns/patterns/export.lisp: The cl-patterns/patterns/export․lisp file
cl-patterns/patterns/patterns.lisp: The cl-patterns/patterns/patterns․lisp file
cl-patterns/patterns/tracker.lisp: The cl-patterns/patterns/tracker․lisp file
cl-patterns/scales.lisp: The cl-patterns/scales․lisp file
cl-patterns/utility.lisp: The cl-patterns/utility․lisp file

F
File, Lisp, cl-patterns.asd: The cl-patterns․asd file
File, Lisp, cl-patterns/backend.lisp: The cl-patterns/backend․lisp file
File, Lisp, cl-patterns/clock.lisp: The cl-patterns/clock․lisp file
File, Lisp, cl-patterns/conversions.lisp: The cl-patterns/conversions․lisp file
File, Lisp, cl-patterns/eseq.lisp: The cl-patterns/eseq․lisp file
File, Lisp, cl-patterns/event.lisp: The cl-patterns/event․lisp file
File, Lisp, cl-patterns/extensions/sequence.lisp: The cl-patterns/extensions/sequence․lisp file
File, Lisp, cl-patterns/package.lisp: The cl-patterns/package․lisp file
File, Lisp, cl-patterns/patterns/bjorklund.lisp: The cl-patterns/patterns/bjorklund․lisp file
File, Lisp, cl-patterns/patterns/cycles.lisp: The cl-patterns/patterns/cycles․lisp file
File, Lisp, cl-patterns/patterns/export.lisp: The cl-patterns/patterns/export․lisp file
File, Lisp, cl-patterns/patterns/patterns.lisp: The cl-patterns/patterns/patterns․lisp file
File, Lisp, cl-patterns/patterns/tracker.lisp: The cl-patterns/patterns/tracker․lisp file
File, Lisp, cl-patterns/scales.lisp: The cl-patterns/scales․lisp file
File, Lisp, cl-patterns/utility.lisp: The cl-patterns/utility․lisp file

L
Lisp File, cl-patterns.asd: The cl-patterns․asd file
Lisp File, cl-patterns/backend.lisp: The cl-patterns/backend․lisp file
Lisp File, cl-patterns/clock.lisp: The cl-patterns/clock․lisp file
Lisp File, cl-patterns/conversions.lisp: The cl-patterns/conversions․lisp file
Lisp File, cl-patterns/eseq.lisp: The cl-patterns/eseq․lisp file
Lisp File, cl-patterns/event.lisp: The cl-patterns/event․lisp file
Lisp File, cl-patterns/extensions/sequence.lisp: The cl-patterns/extensions/sequence․lisp file
Lisp File, cl-patterns/package.lisp: The cl-patterns/package․lisp file
Lisp File, cl-patterns/patterns/bjorklund.lisp: The cl-patterns/patterns/bjorklund․lisp file
Lisp File, cl-patterns/patterns/cycles.lisp: The cl-patterns/patterns/cycles․lisp file
Lisp File, cl-patterns/patterns/export.lisp: The cl-patterns/patterns/export․lisp file
Lisp File, cl-patterns/patterns/patterns.lisp: The cl-patterns/patterns/patterns․lisp file
Lisp File, cl-patterns/patterns/tracker.lisp: The cl-patterns/patterns/tracker․lisp file
Lisp File, cl-patterns/scales.lisp: The cl-patterns/scales․lisp file
Lisp File, cl-patterns/utility.lisp: The cl-patterns/utility․lisp file

M
Module, cl-patterns/patterns: The cl-patterns/patterns module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   I   L   M   N   P   Q   R   S   T   U   V  
Index Entry  Section

(
(setf amp): Exported generic functions
(setf amp): Exported generic functions
(setf beat): Exported generic functions
(setf beat): Exported generic functions
(setf beat): Exported generic functions
(setf chord-indexes): Exported generic functions
(setf chord-indexes): Exported generic functions
(setf chord-name): Exported generic functions
(setf chord-name): Exported generic functions
(setf chord-scale): Exported generic functions
(setf chord-scale): Exported generic functions
(setf clock-latency): Internal functions
(setf clock-tasks): Exported functions
(setf db): Exported generic functions
(setf db): Exported generic functions
(setf delta): Exported generic functions
(setf delta): Exported generic functions
(setf dur): Exported generic functions
(setf dur): Exported generic functions
(setf e): Exported functions
(setf end-condition): Internal generic functions
(setf end-condition): Internal generic functions
(setf end-quant): Exported generic functions
(setf end-quant): Exported generic functions
(setf end-quant): Exported generic functions
(setf eseq-events): Exported generic functions
(setf eseq-events): Exported generic functions
(setf event-value): Exported functions
(setf freq): Exported generic functions
(setf freq): Exported generic functions
(setf instrument): Exported generic functions
(setf instrument): Exported generic functions
(setf legato): Exported generic functions
(setf legato): Exported generic functions
(setf loop-p): Exported generic functions
(setf loop-p): Exported generic functions
(setf loop-p): Exported generic functions
(setf loop-p): Exported generic functions
(setf midinote): Exported generic functions
(setf midinote): Exported generic functions
(setf pan): Exported generic functions
(setf pan): Exported generic functions
(setf pattern-metadata): Exported functions
(setf pdef-key): Exported generic functions
(setf pdef-key): Exported generic functions
(setf pdef-key): Exported generic functions
(setf pdef-pattern): Exported generic functions
(setf pdef-pattern): Exported generic functions
(setf pdef-pstream): Exported generic functions
(setf pdef-pstream): Exported generic functions
(setf pdef-task): Exported generic functions
(setf pdef-task): Exported generic functions
(setf play-quant): Exported generic functions
(setf play-quant): Exported generic functions
(setf play-quant): Exported generic functions
(setf play-quant): Exported generic functions
(setf pstream-count): Exported generic functions
(setf pstream-count): Exported generic functions
(setf pstream-count): Exported generic functions
(setf quant): Exported generic functions
(setf quant): Exported generic functions
(setf quant): Exported generic functions
(setf rate): Exported generic functions
(setf rate): Exported generic functions
(setf raw-event-value): Internal functions
(setf rest-p): Exported generic functions
(setf rest-p): Exported generic functions
(setf scale): Exported generic functions
(setf scale): Exported generic functions
(setf scale-name): Exported generic functions
(setf scale-name): Exported generic functions
(setf scale-notes): Exported generic functions
(setf scale-notes): Exported generic functions
(setf scale-tuning): Exported generic functions
(setf scale-tuning): Exported generic functions
(setf sustain): Exported generic functions
(setf sustain): Exported generic functions
(setf task-clock): Internal generic functions
(setf task-clock): Internal generic functions
(setf task-item): Internal generic functions
(setf task-item): Internal generic functions
(setf task-nodes): Internal functions
(setf tempo): Exported generic functions
(setf tempo): Exported generic functions
(setf tuning-name): Exported generic functions
(setf tuning-name): Exported generic functions
(setf tuning-octave-ratio): Exported generic functions
(setf tuning-octave-ratio): Exported generic functions
(setf tuning-pitches): Exported generic functions
(setf tuning-pitches): Exported generic functions

A
absolute-beats-to-timestamp: Internal functions
all-backends: Exported functions
all-chords: Exported functions
all-patterns: Exported functions
all-pdefs: Exported functions
all-scales: Exported functions
all-tunings: Exported functions
amp: Exported generic functions
amp: Exported generic functions
amp-db: Exported functions
as-eseq: Exported generic functions
as-eseq: Exported generic functions
as-eseq: Exported generic functions
as-eseq: Exported generic functions
as-eseq: Exported generic functions
as-eseq: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions
as-pstream: Exported generic functions

B
backend-all-nodes: Internal generic functions
backend-control-node-at: Internal generic functions
backend-convert-object: Internal generic functions
backend-convert-object: Internal generic functions
backend-instrument-args-list: Internal generic functions
backend-instrument-args-list: Internal generic functions
backend-instrument-controls: Internal generic functions
backend-instrument-has-gate-p: Internal functions
backend-node-p: Internal generic functions
backend-panic: Internal generic functions
backend-panic: Internal generic functions
backend-play-event: Internal generic functions
backend-play-event: Internal generic functions
backend-proxys-node: Internal generic functions
backend-task-removed: Internal generic functions
backend-task-removed: Internal generic functions
backend-tempo-change-at: Internal generic functions
backend-tempo-change-at: Internal generic functions
backend-timestamps-for-event: Internal generic functions
beat: Exported generic functions
beat: Exported generic functions
beat: Exported generic functions
beat: Exported generic functions
beat: Exported generic functions
beat: Exported generic functions
bipolar-1-to-midi: Exported functions
bjorklund: Exported functions
bsubseq: Exported generic functions
bsubseq: Exported generic functions
bsubseq: Exported generic functions

C
can-swap-now-p: Internal functions
chord: Exported generic functions
chord: Exported generic functions
chord: Exported generic functions
chord: Exported generic functions
chord: Exported generic functions
chord-indexes: Exported generic functions
chord-indexes: Exported generic functions
chord-indexes: Exported generic functions
chord-midinotes: Exported functions
chord-name: Exported generic functions
chord-name: Exported generic functions
chord-name: Exported generic functions
chord-notes: Exported functions
chord-scale: Exported generic functions
chord-scale: Exported generic functions
chord-scale: Exported generic functions
clock-add: Internal functions
clock-clear-tasks: Internal functions
clock-latency: Internal functions
clock-loop: Exported functions
clock-process: Exported functions
clock-process-event: Internal generic functions
clock-process-event: Internal generic functions
clock-process-event: Internal generic functions
clock-process-event: Internal generic functions
clock-remove: Internal functions
clock-tasks: Exported functions
combine-events: Exported functions
combine-events-via-lists: Exported functions
Compiler Macro, raw-set-event-value: Internal compiler macros
copy-event: Exported functions
cumulative-list: Internal functions
cycles: Exported macros
cycles-parse: Internal functions

D
db: Exported generic functions
db: Exported generic functions
db-amp: Exported functions
decf-remaining: Internal functions
define-chord: Exported functions
define-event-special-key: Internal macros
define-pbind-special-init-key: Internal macros
define-pbind-special-process-key: Internal macros
define-pbind-special-wrap-key: Internal macros
define-scale: Exported functions
define-tuning: Exported functions
defpattern: Exported macros
degree-freq: Exported functions
degree-midinote: Exported functions
degree-note: Exported functions
delta: Exported generic functions
delta: Exported generic functions
disable-backend: Exported functions
dur: Exported generic functions
dur: Exported generic functions
dur: Exported generic functions
dur-time: Exported functions

E
e: Exported functions
enable-backend: Exported functions
enabled-backends: Exported functions
end: Exported generic functions
end: Exported generic functions
end: Exported generic functions
end: Exported generic functions
end: Exported generic functions
end: Exported generic functions
end-condition: Internal generic functions
end-condition: Internal generic functions
end-quant: Exported generic functions
end-quant: Exported generic functions
end-quant: Exported generic functions
end-quant: Exported generic functions
ended-p: Internal generic functions
ended-p: Internal generic functions
ensure-pdef: Internal functions
eseq: Exported functions
eseq-add: Exported generic functions
eseq-add: Exported generic functions
eseq-add: Exported generic functions
eseq-events: Exported generic functions
eseq-events: Exported generic functions
eseq-length: Exported functions
eseq-p: Exported functions
eseq-remove: Exported generic functions
eseq-remove: Exported generic functions
eseq-remove: Exported generic functions
eseq-remove: Exported generic functions
event: Exported functions
event-backends: Internal functions
event-equal: Exported functions
event-p: Exported functions
event-plist: Exported generic functions
event-plist: Exported generic functions
event-value: Exported functions
event-with-raw-timing: Internal functions
events-differing-keys: Exported functions
events-in-range: Internal generic functions
events-in-range: Internal generic functions
events-in-range: Internal generic functions
events-lists-differing-keys: Exported functions
every-event-equal: Exported functions

F
find-backend-supporting-render: Internal functions
find-pdef: Exported functions
freq: Exported generic functions
freq: Exported generic functions
freq-degree: Exported functions
freq-midinote: Exported functions
freq-note: Exported functions
freq-octave: Exported functions
freq-rate: Exported functions
frequency-to-midi: Exported functions
from-range: Internal functions
Function, (setf clock-latency): Internal functions
Function, (setf clock-tasks): Exported functions
Function, (setf e): Exported functions
Function, (setf event-value): Exported functions
Function, (setf pattern-metadata): Exported functions
Function, (setf raw-event-value): Internal functions
Function, (setf task-nodes): Internal functions
Function, absolute-beats-to-timestamp: Internal functions
Function, all-backends: Exported functions
Function, all-chords: Exported functions
Function, all-patterns: Exported functions
Function, all-pdefs: Exported functions
Function, all-scales: Exported functions
Function, all-tunings: Exported functions
Function, amp-db: Exported functions
Function, backend-instrument-has-gate-p: Internal functions
Function, bipolar-1-to-midi: Exported functions
Function, bjorklund: Exported functions
Function, can-swap-now-p: Internal functions
Function, chord-midinotes: Exported functions
Function, chord-notes: Exported functions
Function, clock-add: Internal functions
Function, clock-clear-tasks: Internal functions
Function, clock-latency: Internal functions
Function, clock-loop: Exported functions
Function, clock-process: Exported functions
Function, clock-remove: Internal functions
Function, clock-tasks: Exported functions
Function, combine-events: Exported functions
Function, combine-events-via-lists: Exported functions
Function, copy-event: Exported functions
Function, cumulative-list: Internal functions
Function, cycles-parse: Internal functions
Function, db-amp: Exported functions
Function, decf-remaining: Internal functions
Function, define-chord: Exported functions
Function, define-scale: Exported functions
Function, define-tuning: Exported functions
Function, degree-freq: Exported functions
Function, degree-midinote: Exported functions
Function, degree-note: Exported functions
Function, disable-backend: Exported functions
Function, dur-time: Exported functions
Function, e: Exported functions
Function, enable-backend: Exported functions
Function, enabled-backends: Exported functions
Function, ensure-pdef: Internal functions
Function, eseq: Exported functions
Function, eseq-length: Exported functions
Function, eseq-p: Exported functions
Function, event: Exported functions
Function, event-backends: Internal functions
Function, event-equal: Exported functions
Function, event-p: Exported functions
Function, event-value: Exported functions
Function, event-with-raw-timing: Internal functions
Function, events-differing-keys: Exported functions
Function, events-lists-differing-keys: Exported functions
Function, every-even