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.5, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 15:05:59 2019 GMT+0.


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

1 Introduction

#+TITLE: cl-patterns

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

Put more simply, cl-patterns is a system for composing music 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
- ~ptracker~ and ~pcycles~ - still need work, APIs 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:package.lisp][package.lisp]] - the package definition file.
- [[file:LICENSE][LICENSE]] - the MIT license.
- [[file:cl-patterns.asd][cl-patterns.asd]] - cl-patterns systems definition file.

** doc

- [[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/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/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.

*** 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 that are 100% compatible with SuperCollider's patterns system.

*** backends

- [[file:src/backends/debug.lisp][debug.lisp]] - basic debug backend. responds to all events and prints and stores them without any audio output.
- [[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/alsa-midi.lisp][alsa-midi.lisp]] - code to interface cl-patterns with [[https://github.com/defaultxr/cl-alsaseq][cl-alsaseq]].

** 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 want to chat about it, the "official" room is on [[https://matrix.to/#/#cl-patterns:struct.ws][Matrix: #cl-patterns:struct.ws]].

You can contact me (the primary author) on IRC as well; I'm usually idling on Freenode with the nick ~defaultxr~.

Obviously, any bugs, feature requests, suggestions, etc should be submitted to the GitHub [[https://github.com/defaultxr/cl-patterns/issues][issue tracker]].


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. <defaultxr@gmail.com>

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.5

Dependencies
Source

cl-patterns.asd (file)

Components

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

3 Files

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


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

3.1 Lisp


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

3.1.1 cl-patterns.asd

Location

cl-patterns.asd

Systems

cl-patterns (system)


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

3.1.2 cl-patterns/package.lisp

Parent

cl-patterns (system)

Location

package.lisp

Packages

cl-patterns


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

3.1.3 cl-patterns/src/utility.lisp

Dependency

package.lisp (file)

Parent

cl-patterns (system)

Location

src/utility.lisp

Exported Definitions
Internal Definitions

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

3.1.4 cl-patterns/src/conversions.lisp

Dependency

src/utility.lisp (file)

Parent

cl-patterns (system)

Location

src/conversions.lisp

Exported Definitions

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

3.1.5 cl-patterns/src/scales.lisp

Dependency

src/conversions.lisp (file)

Parent

cl-patterns (system)

Location

src/scales.lisp

Exported Definitions
Internal Definitions

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

3.1.6 cl-patterns/src/event.lisp

Dependency

src/scales.lisp (file)

Parent

cl-patterns (system)

Location

src/event.lisp

Exported Definitions
Internal Definitions

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

3.1.7 cl-patterns/src/patterns/patterns.lisp

Dependency

src/event.lisp (file)

Parent

cl-patterns (system)

Location

src/patterns/patterns.lisp

Exported Definitions
Internal Definitions

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

3.1.8 cl-patterns/src/patterns/bjorklund.lisp

Dependency

src/patterns/patterns.lisp (file)

Parent

cl-patterns (system)

Location

src/patterns/bjorklund.lisp

Exported Definitions

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

3.1.9 cl-patterns/src/patterns/cycles.lisp

Dependency

src/patterns/bjorklund.lisp (file)

Parent

cl-patterns (system)

Location

src/patterns/cycles.lisp

Exported Definitions
Internal Definitions

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

3.1.10 cl-patterns/src/patterns/tracker.lisp

Dependency

src/patterns/cycles.lisp (file)

Parent

cl-patterns (system)

Location

src/patterns/tracker.lisp

Exported Definitions
Internal Definitions

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

3.1.11 cl-patterns/src/backend.lisp

Dependency

src/patterns/tracker.lisp (file)

Parent

cl-patterns (system)

Location

src/backend.lisp

Exported Definitions
Internal Definitions

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

3.1.12 cl-patterns/src/clock.lisp

Dependency

src/backend.lisp (file)

Parent

cl-patterns (system)

Location

src/clock.lisp

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 cl-patterns

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


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

5.1.1 Special variables

Special Variable: *clock*

The default clock to run tasks on.

Package

cl-patterns

Source

src/utility.lisp (file)

Special Variable: *event*

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

Package

cl-patterns

Source

src/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

src/patterns/patterns.lisp (file)

Special Variable: *note-names*

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

Package

cl-patterns

Source

src/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

src/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

src/clock.lisp (file)


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

5.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 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.

LIST is the actual pattern to generate.

Package

cl-patterns

Source

src/patterns/cycles.lisp (file)

Macro: defpattern NAME SUPERCLASSES SLOTS &optional DOCUMENTATION CREATION-FUNCTION

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.

CREATION-FUNCTION is 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

src/patterns/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

src/patterns/patterns.lisp (file)

Macro: pf &body BODY

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Macro: pt HEADER &rest ROWS
Package

cl-patterns

Source

src/patterns/tracker.lisp (file)


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

5.1.3 Functions

Function: all-backends ()

Get a list of all registered backends.

Package

cl-patterns

Source

src/backend.lisp (file)

Function: all-chords ()

Get a list of all defined chords.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: all-patterns ()

Get a list of all defined patterns.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: all-pdefs ()

Get a list of all pdefs.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: all-scales ()

Get a list of all defined scales.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: all-tunings ()

Get a list of all defined tunings.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: amp-db AMP

Convert amplitude to decibels.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: bipolar-1-to-midi NUMBER

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

Package

cl-patterns

Source

src/utility.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

src/patterns/bjorklund.lisp (file)

Function: chord-indexes INSTANCE
Function: (setf chord-indexes) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: chord-midinotes ROOT &optional TYPE OCTAVE
Package

cl-patterns

Source

src/scales.lisp (file)

Function: chord-name INSTANCE
Function: (setf chord-name) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: chord-note-numbers CHORD

Return a list consisting of the note numbers for CHORD.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: chord-scale INSTANCE
Function: (setf chord-scale) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.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

src/clock.lisp (file)

Function: combine-events &rest EVENTS

Returns 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’

Package

cl-patterns

Source

src/event.lisp (file)

Function: copy-event EVENT

Return a new event that is a copy of EVENT.

See also: ‘combine-events’

Package

cl-patterns

Source

src/event.lisp (file)

Function: db-amp DB

Convert decibels to amplitude.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: define-chord NAME SCALE INDEXES &optional ALIASES

Define a chord and add it to the *chords* list.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: define-scale NAME NOTES &optional TUNING ALIASES

Define a scale and add it to the *scales* list.

Package

cl-patterns

Source

src/scales.lisp (file)

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

Define a tuning and add it to the ‘*tunings*’ list.

Package

cl-patterns

Source

src/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

src/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

src/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

src/conversions.lisp (file)

Function: disable-backend NAME

Disable a registered backend.

Package

cl-patterns

Source

src/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

src/conversions.lisp (file)

Function: enable-backend NAME

Enable a registered backend.

Package

cl-patterns

Source

src/backend.lisp (file)

Function: enabled-backends ()

Get a list of all enabled backends.

Package

cl-patterns

Source

src/backend.lisp (file)

Function: event &rest PARAMS

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

Package

cl-patterns

Source

src/event.lisp (file)

Function: event-equal EVENT1 EVENT2

Test if EVENT1 and EVENT2 are equivalent.

See also: ‘every-event-equal’

Package

cl-patterns

Source

src/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).

Package

cl-patterns

Source

src/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

src/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

src/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

src/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: ‘events-differing-keys’

Package

cl-patterns

Source

src/event.lisp (file)

Function: exponential-random-range LOW HIGH

Generate a random number between LOW and HIGH, with exponential distribution.

See also: ‘random-range’

Package

cl-patterns

Source

src/utility.lisp (file)

Function: freq-midinote FREQ

Convert a frequency to a midi note number.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: freq-octave FREQ

Get the octave number that the frequency FREQ occurs in.

Package

cl-patterns

Source

src/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

src/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

src/utility.lisp (file)

Function: get-event-value EVENT &optional KEY

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

The EVENT parameter can be omitted, in which case the KEY key is looked up from ‘*event*’.

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-value’

Package

cl-patterns

Source

src/event.lisp (file)

Function: gete LIST KEY

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

Package

cl-patterns

Source

src/utility.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 we call them tunings.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: make-clock &optional TEMPO TASKS

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

To 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.

Package

cl-patterns

Source

src/clock.lisp (file)

Function: midi-ratio MIDI

Convert a MIDI note number difference to a frequency ratio.

Package

cl-patterns

Source

src/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

src/utility.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

src/conversions.lisp (file)

Function: midinote-freq MIDINOTE

Convert a midi note number to a frequency.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: midinote-octave MIDINOTE

Get the octave number that MIDINOTE occurs in.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: midinote-rate MIDINOTE &optional BASE-NOTE

Convert a midinote to a playback rate.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: next-beat-for-quant QUANT CURRENT-BEAT

Get the next valid beat for QUANT after CURRENT-BEAT.

Package

cl-patterns

Source

src/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’

Package

cl-patterns

Source

src/patterns/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-upto-n’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: note-midinote NOTE &key ROOT OCTAVE

Get the midinote of NOTE taking into account the ROOT and OCTAVE if provided.

Package

cl-patterns

Source

src/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".

Package

cl-patterns

Source

src/scales.lisp (file)

Function: note-number NOTE

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

Package

cl-patterns

Source

src/scales.lisp (file)

Function: p* &rest NUMBERS

p* multiplies 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

src/patterns/patterns.lisp (file)

Function: p+ &rest NUMBERS

p+ adds 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

src/patterns/patterns.lisp (file)

Function: p- &rest NUMBERS

p- subtracts 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

src/patterns/patterns.lisp (file)

Function: p/ &rest NUMBERS

p/ divides 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

src/patterns/patterns.lisp (file)

Function: parp PATTERN ARPEGGIATOR

parp is an "arpeggiator"; 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

src/patterns/patterns.lisp (file)

Function: pbeat ()

pbeat yields the number of beats elapsed since its embedding 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: ‘beat’, ‘prun’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Function: pbjorklund PULSES STEPS &optional OFFSET

pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, STEPS is number of steps in the sequence, and OFFSET is the number to rotate the sequence by. 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. The total duration of the sequence is normalized to 1 beat, so it can be easily multiplied if you want it to be longer or shorter. 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

src/patterns/bjorklund.lisp (file)

Function: pbrown &optional LO HI STEP LENGTH

pbrown implements brownian motion, yielding LENGTH values between LO and HI, each value a maximum of STEP away from the previous value.

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Function: pcycles LIST

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

src/patterns/cycles.lisp (file)

Function: pdef KEY &optional PATTERN

pdef defines 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 currently being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘quant’ time is reached. Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pdefs-playing &optional CLOCK

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

Package

cl-patterns

Source

src/clock.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.

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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Function: pdurstutter PATTERN N

pdurstutter yields 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’, ‘pstutter’

Package

cl-patterns

Source

src/patterns/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’

Package

cl-patterns

Source

src/patterns/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’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pexprand &optional LO HI LENGTH

pexprand yields LENGTH exponentially-distributed random numbers between LO and HI.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pfin PATTERN COUNT

pfin yields 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

src/patterns/patterns.lisp (file)

Function: pfindur PATTERN DUR &optional TOLERANCE

pfindur yields 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.

Example:

;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;;
;; => ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) NIL)

See also: ‘pfin’, ‘psync’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pfunc FUNC &optional LENGTH

pfunc evaluates the function FUNC each time its next output is requested, and yields the result of that function. It does this a maximum of LENGTH times. 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))

See also: ‘pf’, ‘pnary’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pfuture PATTERN STEP-PATTERN

DEPRECATED - just use ‘phistory’ instead.

pfuture gets the first *max-pattern-yield-length* outputs from PATTERN, and then uses STEP-PATTERN to index that history.

See also: ‘phistory’, ‘pscratch’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pgeom &optional START GROW LENGTH

pgeom yields START, and then each subsequent value is the previous value times GROW, for a total of LENGTH values yielded.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: phistory PATTERN STEP-PATTERN

phistory refers back to PATTERN’s history, yielding the value 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), it will return nil.

Example:

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

See also: ‘pfuture’, ‘pscratch’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pif CONDITION TRUE FALSE

pif acts as an if statement for patterns. CONDITION 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 CONDITION 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

src/patterns/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’, ‘pswitch’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pk KEY &optional DEFAULT

pk returns the value of KEY in the current *event* context, returning DEFAULT if that value is nil.

Example:

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

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: place LIST &optional REPEATS

place yields 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

src/patterns/patterns.lisp (file)

Function: play-or-end ITEM

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

Package

cl-patterns

Source

src/utility.lisp (file)

Function: play-or-stop ITEM

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

Package

cl-patterns

Source

src/utility.lisp (file)

Function: plazy FUNC

plazy funcalls FUNC which should return a pattern, which is then yielded from until its end, at which point FUNC is re-evaluated to generate the next pattern.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: plazyn FUNC &optional REPEATS

plazyn funcalls FUNC which should return a pattern, which is then yielded from until its end, at which point FUNC is re-evaluated to generate the next pattern. The pattern is generated a total of REPEATS times.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pmeta PATTERN

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".
- :sustain - limit the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).

The following keys are planned for future implementation:

- :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’.
- :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 - 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.
- :inject - inject key/value pairs from the output of this value into the source pattern.

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

Example:

See also: ‘psym’, ‘parp’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Function: pn PATTERN &optional REPEATS

pn embeds the full PATTERN into the pstream REPEATS times.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pnary OPERATOR &rest PATTERNS

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

See also: ‘pfunc’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Function: ppatlace LIST &optional REPEATS

ppatlace yields each value from LIST in sequence. If the value is a pattern, one value is yielded from that pattern before moving on to the next item in LIST. The second time around the LIST, the second value yielded from each pattern in LIST will be yielded instead. 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.

See also: ‘place’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pr PATTERN &optional REPEATS

pr yields a value from PATTERN REPEATS times before moving on to the next value from PATTERN.

See also: ‘pstutter’, ‘pdurstutter’, ‘parp’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: prand LIST &optional LENGTH

prand returns a random value from LIST, returning a total of LENGTH values.

Example:

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

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: prun PATTERN &optional DUR

Run PATTERN independently of when ‘next’ is called on its pstream. Each output of PATTERN is treated as if it lasted DUR beats, during which time it will be continuously yielded by prun. If PATTERN is an event pattern, DUR acts as a duration multiplier instead.

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

src/patterns/patterns.lisp (file)

Function: pscratch PATTERN STEP-PATTERN

pscratch "scratches" across the values yielded by a pstream. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.

Example:

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

See also: ‘phistory’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pseq LIST &optional REPEATS OFFSET

pseq yields values from LIST in the same order they were provided, 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

src/patterns/patterns.lisp (file)

Function: pser LIST &optional LENGTH OFFSET

pser yields values from LIST in the same order they were provided, returning a total of LENGTH values.

Example:

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

See also: ‘pseq’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pseries &optional START STEP LENGTH

pseries yields START, and then each subsequent value is the previous value plus STEP, for a total of LENGTH values yielded.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pshuf LIST &optional REPEATS

pshuf shuffles LIST, then yields each item from the shuffled list, repeating the list REPEATS times.

Example:

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

See also: ‘prand’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

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

pslide slides across sections LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP the number to increment the start index by after each section, and START is the initial index 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 will return nils.

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

src/patterns/patterns.lisp (file)

Function: pstream-elt PSTREAM N

Return the Nth element from PSTREAM’s history. Does not automatically advance PSTREAM if N is out of range.

Example:

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

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pstream-elt-future PSTREAM N

Return the Nth element from PSTREAM’s history, automatically advancing PSTREAM as necessary if the Nth element has not yet occurred.

When N is negative, NILs at the end of PSTREAM’s history are not included in indexing, but NIL may be returned if the negative index points to a position prior to the first element in history. Be careful when using negative numbers for N, since infinite-length patterns will cause this function to never return.

Note that if the Nth element has not yet occurred, this function will advance the pstream, thus affecting what will be returned when ‘next’ is called on the pstream. However, this behavior may change in the future.

Example:

;; (pstream-elt-future (as-pstream (pbind :foo (pseq ’(1 2 3) 1))) -1)
;;
;; => (EVENT :FOO 3)

See also: ‘pstream-elt’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pstream-nth N PSTREAM

Obsolete alias for ‘pstream-elt’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pstream-nth-future N PSTREAM

Obsolete alias for ‘pstream-elt-future’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pstutter PATTERN N

pstutter yields each output from PATTERN N times before moving on to the next output from PATTERN.

Example:

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

See also: ‘pr’, ‘pdurstutter’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Function: psync PATTERN SYNC-QUANT &optional MAXDUR TOLERANCE

psync yields 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

src/patterns/patterns.lisp (file)

Function: ptime ()

ptime yields the number of seconds elapsed since its embedding 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

src/patterns/patterns.lisp (file)

Function: ptrace PATTERN &optional KEY STREAM PREFIX

ptrace prints to STREAM the PREFIX and then the value of KEY for each event yielded by PATTERN, or the whole event or value if KEY is not provided. ptrace yields everything from the source PATTERN unaffected.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: ptracker HEADER ROWS
Package

cl-patterns

Source

src/patterns/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

src/patterns/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’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pwhite &optional LO HI LENGTH

pwhite yields LENGTH random numbers between LO and HI.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pwrand LIST &optional WEIGHTS LENGTH

pwrand returns a random element from LIST weighted by respective values from WEIGHTS, for a total of LENGTH values.

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pwxrand LIST &optional WEIGHTS LENGTH

pwxrand returns a random element from LIST weighted by respective values from WEIGHTS, for a total of LENGTH values, never repeating the same value twice in a row.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pxrand LIST &optional LENGTH

pxrand returns a random value from LIST that is not equal to the last result, returning a total of LENGTH values.

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

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: random-coin &optional PROBABILITY

Randomly return true with a probability of PROBABILITY/1.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: random-range LOW &optional HIGH

Return a random number between LOW and HIGH, inclusive. If HIGH is not provided, act the same as (random LOW).

See also: ‘exponential-random-range’

Package

cl-patterns

Source

src/utility.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

src/conversions.lisp (file)

Function: rate-midinote RATE &optional BASE-NOTE

Convert a playback rate to a midinote.

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: ratio-midi RATIO

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

Package

cl-patterns

Source

src/conversions.lisp (file)

Function: register-backend NAME

Register a cl-patterns backend.

Package

cl-patterns

Source

src/backend.lisp (file)

Function: remove-event-value EVENT KEY

Removes KEY from EVENT.

Package

cl-patterns

Source

src/event.lisp (file)

Function: scale-midinotes SCALE &key START-NOTE 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

src/scales.lisp (file)

Function: scale-name INSTANCE
Function: (setf scale-name) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: scale-notes INSTANCE
Function: (setf scale-notes) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: scale-tuning INSTANCE
Function: (setf scale-tuning) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: seq &key START END LIMIT STEP

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.

See also: ‘seq-range’

Package

cl-patterns

Source

src/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

src/utility.lisp (file)

Function: set-event-value EVENT KEY VALUE

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

This function is deprecated; use ‘(setf event-value)’ instead, i.e.:

;; (setf (event-value EVENT KEY) VALUE)

Package

cl-patterns

Source

src/event.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-with-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: ‘combine-events’

Package

cl-patterns

Source

src/event.lisp (file)

Function: start-clock-loop &optional TEMPO

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

See also: ‘clock-loop’

Package

cl-patterns

Source

src/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

src/conversions.lisp (file)

Function: tuning-name INSTANCE
Function: (setf tuning-name) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: tuning-octave-ratio INSTANCE
Function: (setf tuning-octave-ratio) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: tuning-tuning INSTANCE
Function: (setf tuning-tuning) VALUE INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: unipolar-1-to-midi NUMBER

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

Package

cl-patterns

Source

src/utility.lisp (file)


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

5.1.4 Generic functions

Generic Function: amp EVENT
Generic Function: (setf amp) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: amp (EVENT null)
Source

src/event.lisp (file)

Generic Function: as-pstream THING

Return THING as a pstream object.

See also: ‘pattern-as-pstream’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Methods
Method: as-pstream (PTRACKER ptracker)
Source

src/patterns/tracker.lisp (file)

Method: as-pstream (PATTERN pcycles)
Source

src/patterns/cycles.lisp (file)

Method: as-pstream (PBJORKLUND pbjorklund)
Source

src/patterns/bjorklund.lisp (file)

Method: as-pstream (PWALK pwalk)
Method: as-pstream (PTS pts)
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 (PSTUTTER pstutter)
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 (PFUTURE pfuture)
Method: as-pstream (PHISTORY phistory)
Method: as-pstream (PATTERN pslide)
Method: as-pstream (PATTERN pnary)
Method: as-pstream (PATTERN ppatlace)
Method: as-pstream (PLACE place)
Method: as-pstream (PTRACE ptrace)
Method: as-pstream (PATTERN pgeom)
Method: as-pstream (PATTERN pseries)
Method: as-pstream (PATTERN pexprand)
Method: as-pstream (PATTERN pbrown)
Method: as-pstream (PATTERN pwhite)
Method: as-pstream (PATTERN pshuf)
Method: as-pstream (PN pn)
Method: as-pstream (PATTERN plazyn)
Method: as-pstream (PLAZY plazy)
Method: as-pstream (PDEF pdef)
Method: as-pstream (PATTERN pr)
Method: as-pstream (PATTERN pfunc)
Method: as-pstream (PATTERN pwxrand)
Method: as-pstream (PATTERN pwrand)
Method: as-pstream (PATTERN pxrand)
Method: as-pstream (PATTERN prand)
Method: as-pstream (PATTERN pk)
Method: as-pstream (PSER pser)
Method: as-pstream (PATTERN pseq)
Method: as-pstream (ITEM pbind-pstream)
Method: as-pstream (PATTERN pbind)
Method: as-pstream (PSTREAM pstream) around
Method: as-pstream (PATTERN pattern) around
Method: as-pstream (PATTERN pattern)
Method: as-pstream (SYMBOL symbol)
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

src/utility.lisp (file)

Writer

(setf beat) (generic function)

Methods
Method: beat (CLOCK clock)
Source

src/clock.lisp (file)

Method: beat (PSTREAM pstream)

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

Source

src/patterns/patterns.lisp (file)

Method: beat (ITEM event)
Source

src/event.lisp (file)

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

cl-patterns

Reader

beat (generic function)

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

src/event.lisp (file)

Generic Function: chord ITEM
Package

cl-patterns

Source

src/scales.lisp (file)

Methods
Method: chord (ITEM chord)
Method: chord (ITEM string)
Method: chord (ITEM symbol)
Generic Function: db EVENT
Generic Function: (setf db) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: db (EVENT null)
Source

src/event.lisp (file)

Generic Function: delta EVENT
Generic Function: (setf delta) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: delta (EVENT null)
Source

src/event.lisp (file)

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

cl-patterns

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

src/event.lisp (file)

Method: dur (EVENT null)
Source

src/event.lisp (file)

Generic Function: end ITEM

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

Package

cl-patterns

Source

src/utility.lisp (file)

Methods
Method: end (ITEM task)
Source

src/clock.lisp (file)

Method: end (ITEM symbol)
Source

src/clock.lisp (file)

Method: end (ITEM pdef)
Source

src/clock.lisp (file)

Generic Function: event-plist OBJECT
Package

cl-patterns

Methods
Method: event-plist (EVENT event)

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

Source

src/event.lisp (file)

Generic Function: freq EVENT
Generic Function: (setf freq) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: freq (EVENT null)
Source

src/event.lisp (file)

Generic Function: instrument EVENT
Generic Function: (setf instrument) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: instrument (EVENT null)
Source

src/event.lisp (file)

Generic Function: keys ITEM

Get the keys of ITEM, whether it be a plist, event, etc.

Package

cl-patterns

Source

src/utility.lisp (file)

Methods
Method: keys (ITEM event)
Source

src/event.lisp (file)

Method: keys (ITEM hash-table)
Method: keys (ITEM cons)
Method: keys (ITEM null)
Generic Function: launch ITEM

Play a new copy of ITEM 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

src/utility.lisp (file)

Methods
Method: launch (SYMBOL symbol)
Source

src/clock.lisp (file)

Method: launch (PDEF pdef)
Source

src/clock.lisp (file)

Method: launch (PATTERN pattern)
Source

src/clock.lisp (file)

Method: launch (EVENT event)
Source

src/clock.lisp (file)

Generic Function: legato EVENT
Generic Function: (setf legato) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: legato (EVENT null)
Source

src/event.lisp (file)

Generic Function: loop-p ITEM

Whether or not ITEM should play again after it ends.

Package

cl-patterns

Source

src/utility.lisp (file)

Writer

(setf loop-p) (generic function)

Methods
Method: loop-p (TASK task)
Source

src/clock.lisp (file)

Method: loop-p (PATTERN pattern)

Whether or not the pattern should loop when played.

Source

src/patterns/patterns.lisp (file)

Generic Function: (setf loop-p) NEW-VALUE OBJECT
Package

cl-patterns

Reader

loop-p (generic function)

Methods
Method: (setf loop-p) NEW-VALUE (PATTERN pattern)

Whether or not the pattern should loop when played.

Source

src/patterns/patterns.lisp (file)

Generic Function: midinote EVENT
Generic Function: (setf midinote) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: midinote (EVENT null)
Source

src/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: ‘peek’, ‘next-n’, ‘next-upto-n’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Method Combination

pattern (long method combination)

Methods
Method: next (PTRACKER ptracker-pstream)
Source

src/patterns/tracker.lisp (file)

Method: next (PATTERN pcycles-pstream)
Source

src/patterns/cycles.lisp (file)

Method: next (PATTERN pbjorklund-pstream)
Source

src/patterns/bjorklund.lisp (file)

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 (PATTERN pdurstutter-pstream)
Method: next (PATTERN pstutter-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 (PSTREAM phistory-pstream)
Method: next (PATTERN pslide-pstream)
Method: next (PATTERN pnary-pstream)
Method: next (PATTERN ppatlace-pstream)
Method: next (PLACE place-pstream)
Method: next (PTRACE ptrace-pstream)
Method: next (PATTERN pgeom-pstream)
Method: next (PATTERN pseries-pstream)
Method: next (PATTERN pexprand-pstream)
Method: next (PATTERN pbrown-pstream)
Method: next (PATTERN pwhite-pstream)
Method: next (PATTERN pshuf-pstream)
Method: next (PN pn-pstream)
Method: next (PATTERN plazyn-pstream)
Method: next (PATTERN plazy-pstream)
Method: next (PATTERN pdef-pstream)
Method: next (PR pr-pstream)
Method: next (PATTERN pfunc-pstream)
Method: next (PATTERN pwxrand-pstream)
Method: next (PATTERN pwrand-pstream)
Method: next (PATTERN pxrand-pstream)
Method: next (PATTERN prand-pstream)
Method: next (PK pk-pstream)
Method: next (PSER pser-pstream)
Method: next (PSEQ pseq-pstream)
Method: next (PATTERN pbind-pstream)
Method: next (PATTERN t-pstream)
Method: next (PATTERN pstream) around
Method: next (PATTERN function)
Method: next (PATTERN pattern)
Method: next PATTERN
Generic Function: pan EVENT
Generic Function: (setf pan) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: pan (EVENT null)
Source

src/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

src/patterns/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

src/patterns/patterns.lisp (file)

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

cl-patterns

Methods
Method: pdef-pattern (OBJECT pdef)
Source

src/patterns/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’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Methods
Method: peek (PSTREAM pstream)
Generic Function: play ITEM

Play an item (typically an event or pattern) according to the current ‘*event-output-function*’.

See also: ‘launch’, ‘stop’

Package

cl-patterns

Source

src/utility.lisp (file)

Methods
Method: play (SYMBOL symbol)
Source

src/clock.lisp (file)

Method: play (PDEF pdef)
Source

src/clock.lisp (file)

Method: play (PATTERN pattern)
Source

src/clock.lisp (file)

Method: play (EVENT event)
Source

src/clock.lisp (file)

Generic Function: playing-p ITEM &optional CLOCK

Whether ITEM is playing.

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

Package

cl-patterns

Source

src/utility.lisp (file)

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

src/clock.lisp (file)

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

src/clock.lisp (file)

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

src/clock.lisp (file)

Generic Function: pstream-count OBJECT
Package

cl-patterns

Methods
Method: pstream-count (PSTREAM pstream)

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

Source

src/patterns/patterns.lisp (file)

Method: pstream-count (PATTERN pattern)

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

Source

src/patterns/patterns.lisp (file)

Generic Function: scale ITEM

Get a scale struct by name.

Package

cl-patterns

Source

src/scales.lisp (file)

Methods
Method: scale (ITEM scale)
Method: scale (ITEM string)
Method: scale (ITEM symbol)
Generic Function: start-backend BACKEND

Start a backend. By default, this is automatically called when ‘enable-backend’ is run.

Package

cl-patterns

Source

src/backend.lisp (file)

Generic Function: stop ITEM

Immediately stop a playing item (typically a playing task or pdef).

See also: ‘end’, ‘play’

Package

cl-patterns

Source

src/utility.lisp (file)

Methods
Method: stop (TASK task)
Source

src/clock.lisp (file)

Method: stop (SYMBOL symbol)
Source

src/clock.lisp (file)

Method: stop (PDEF pdef)
Source

src/clock.lisp (file)

Generic Function: stop-backend BACKEND

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

Package

cl-patterns

Source

src/backend.lisp (file)

Generic Function: sustain EVENT
Generic Function: (setf sustain) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: sustain (EVENT null)
Source

src/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

src/utility.lisp (file)

Writer

(setf tempo) (generic function)

Methods
Method: tempo (NUMBER number)
Source

src/clock.lisp (file)

Method: tempo (CLOCK clock)

The tempo of the clock, in beats per second.

Source

src/clock.lisp (file)

Generic Function: (setf tempo) VALUE ITEM
Package

cl-patterns

Reader

tempo (generic function)

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

src/clock.lisp (file)

Generic Function: tuning ITEM

Get a tuning struct by name.

Package

cl-patterns

Source

src/scales.lisp (file)

Methods
Method: tuning (ITEM tuning)
Method: tuning (ITEM string)
Method: tuning (ITEM symbol)

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

5.1.5 Structures

Structure: chord ()
Package

cl-patterns

Source

src/utility.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods
  • describe-object (method)
  • chord (method)
Direct slots
Slot: name
Readers

chord-name (function)

Writers

(setf chord-name) (function)

Slot: scale
Readers

chord-scale (function)

Writers

(setf chord-scale) (function)

Slot: indexes
Readers

chord-indexes (function)

Writers

(setf chord-indexes) (function)

Structure: scale ()
Package

cl-patterns

Source

src/utility.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

scale (method)

Direct slots
Slot: name
Readers

scale-name (function)

Writers

(setf scale-name) (function)

Slot: notes
Readers

scale-notes (function)

Writers

(setf scale-notes) (function)

Slot: tuning
Readers

scale-tuning (function)

Writers

(setf scale-tuning) (function)

Structure: tuning ()
Package

cl-patterns

Source

src/utility.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

tuning (method)

Direct slots
Slot: name
Readers

tuning-name (function)

Writers

(setf tuning-name) (function)

Slot: tuning
Readers

tuning-tuning (function)

Writers

(setf tuning-tuning) (function)

Slot: octave-ratio
Readers

tuning-octave-ratio (function)

Writers

(setf tuning-octave-ratio) (function)


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

5.1.6 Classes

Class: event ()

Class representing a musical event.

Package

cl-patterns

Source

src/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

(quote 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

(quote number)

Class: parp ()

parp is an "arpeggiator"; 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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods
Direct slots
Slot: quant

A list of numbers representing when the pattern’s pstream can start playing. The list takes the form (QUANT &OPTIONAL PHASE TIMING-OFFSET). For example, a quant of (4) means it can start on any beat on the clock that is divisible by 4. A quant of (4 2) means the pstream can start 2 beats after any beat divisible by 4. And a quant of (4 0 1) means that the pstream can start 1 second after any beat that is divisible by 4.

Initargs

:quant

Initform

(list 1)

Readers

quant (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

Readers

loop-p (generic function)

Writers

(setf loop-p) (generic function)

Slot: cleanup-functions

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

Initargs

:cleanup-functions

Initform

(list)

Slot: pstream-count

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

Initform

0

Readers

pstream-count (generic function)

Class: pbeat ()

pbeat yields the number of beats elapsed since its embedding 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: ‘beat’, ‘prun’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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

src/patterns/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: pbjorklund ()

pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, STEPS is number of steps in the sequence, and OFFSET is the number to rotate the sequence by. 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. The total duration of the sequence is normalized to 1 beat, so it can be easily multiplied if you want it to be longer or shorter. 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

src/patterns/bjorklund.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbjorklund-pstream (class)

Direct methods
Direct slots
Slot: pulses
Initargs

:pulses

Slot: steps
Initargs

:steps

Slot: offset
Initargs

:offset

Class: pbjorklund-pstream ()

pstream for ‘pbjorklund’.

Package

cl-patterns

Source

src/patterns/bjorklund.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pbrown ()

pbrown implements brownian motion, yielding LENGTH values between LO and HI, each value a maximum of STEP away from the previous value.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pbrown-pstream (class)

Direct methods
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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pchain-pstream (class)

Direct methods

as-pstream (method)

Direct slots
Slot: patterns
Initargs

:patterns

Class: pchain-pstream ()

pstream for ‘pchain’.

Package

cl-patterns

Source

src/patterns/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

src/patterns/cycles.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pcycles-pstream (class)

Direct methods
Direct slots
Slot: list
Initargs

:list

Class: pcycles-pstream ()

pstream for ‘pcycles’.

Package

cl-patterns

Source

src/patterns/cycles.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: parsed-list
Initargs

:parsed-list

Class: pdef ()

pdef defines 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 currently being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘quant’ time is reached. Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).

Package

cl-patterns

Source

src/patterns/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: loop-p
Initargs

:loop-p

Initform

t

Class: pdef-pstream ()

pstream for ‘pdef’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (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.

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

src/patterns/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

src/patterns/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

src/patterns/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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pdurstutter ()

pdurstutter yields 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’, ‘pstutter’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

pexprand yields LENGTH exponentially-distributed random numbers between LO and HI.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pexprand-pstream (class)

Direct methods
Direct slots
Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: length
Initargs

:length

Class: pexprand-pstream ()

pstream for ‘pexprand’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pfin ()

pfin yields 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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pfindur ()

pfindur yields 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.

Example:

;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;;
;; => ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) NIL)

See also: ‘pfin’, ‘psync’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-dur
Initargs

:current-dur

Slot: current-elapsed
Initargs

:current-elapsed

Initform

0

Class: pfunc ()

pfunc evaluates the function FUNC each time its next output is requested, and yields the result of that function. It does this a maximum of LENGTH times. 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))

See also: ‘pf’, ‘pnary’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pfuture ()

DEPRECATED - just use ‘phistory’ instead.

pfuture gets the first *max-pattern-yield-length* outputs from PATTERN, and then uses STEP-PATTERN to index that history.

See also: ‘phistory’, ‘pscratch’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

phistory (class)

Direct subclasses

pfuture-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: step-pattern
Initargs

:step-pattern

Class: pfuture-pstream ()

pstream for ‘pfuture’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Class: pgeom ()

pgeom yields START, and then each subsequent value is the previous value times GROW, for a total of LENGTH values yielded.

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

phistory refers back to PATTERN’s history, yielding the value 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), it will return nil.

Example:

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

See also: ‘pfuture’, ‘pscratch’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses
Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: step-pattern
Initargs

:step-pattern

Class: phistory-pstream ()

pstream for ‘phistory’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct subclasses

pfuture-pstream (class)

Direct methods

next (method)

Class: pif ()

pif acts as an if statement for patterns. CONDITION 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 CONDITION 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

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pif-pstream (class)

Direct methods
Direct slots
Slot: condition
Initargs

:condition

Slot: true
Initargs

:true

Slot: false
Initargs

:false

Class: pif-pstream ()

pstream for ‘pif’.

Package

cl-patterns

Source

src/patterns/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’, ‘pswitch’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: pk ()

pk returns the value of KEY in the current *event* context, returning DEFAULT if that value is nil.

Example:

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

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

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: place ()

place yields 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

src/patterns/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

src/patterns/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 ()

plazy funcalls FUNC which should return a pattern, which is then yielded from until its end, at which point FUNC is re-evaluated to generate the next pattern.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

plazy-pstream (class)

Direct methods
Direct slots
Slot: func
Initargs

:func

Class: plazy-pstream ()

pstream for ‘plazy’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: plazyn ()

plazyn funcalls FUNC which should return a pattern, which is then yielded from until its end, at which point FUNC is re-evaluated to generate the next pattern. The pattern is generated a total of REPEATS times.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

plazyn-pstream (class)

Direct methods
Direct slots
Slot: func
Initargs

:func

Slot: repeats
Initargs

:repeats

Class: plazyn-pstream ()

pstream for ‘plazyn’.

Package

cl-patterns

Source

src/patterns/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".
- :sustain - limit the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).

The following keys are planned for future implementation:

- :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’.
- :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 - 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.
- :inject - inject key/value pairs from the output of this value into the source pattern.

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

Example:

See also: ‘psym’, ‘parp’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pmeta-pstream (class)

Direct methods

print-object (method)

Direct slots
Slot: pattern
Initargs

:pattern

Class: pmeta-pstream ()

pstream for ‘pmeta’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: pn ()

pn embeds the full PATTERN into the pstream REPEATS times.

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

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

See also: ‘pfunc’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: pstreams
Initargs

:pstreams

Class: ppatlace ()

ppatlace yields each value from LIST in sequence. If the value is a pattern, one value is yielded from that pattern before moving on to the next item in LIST. The second time around the LIST, the second value yielded from each pattern in LIST will be yielded instead. 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.

See also: ‘place’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pr ()

pr yields a value from PATTERN REPEATS times before moving on to the next value from PATTERN.

See also: ‘pstutter’, ‘pdurstutter’, ‘parp’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

prand returns a random value from LIST, returning a total of LENGTH values.

Example:

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

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

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: prun ()

Run PATTERN independently of when ‘next’ is called on its pstream. Each output of PATTERN is treated as if it lasted DUR beats, during which time it will be continuously yielded by prun. If PATTERN is an event pattern, DUR acts as a duration multiplier instead.

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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: dur-history
Initargs

:dur-history

Class: pscratch ()

pscratch "scratches" across the values yielded by a pstream. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.

Example:

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

See also: ‘phistory’

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-index
Initargs

:current-index

Initform

0

Class: pseq ()

pseq yields values from LIST in the same order they were provided, 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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pser ()

pser yields values from LIST in the same order they were provided, returning a total of LENGTH values.

Example:

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

See also: ‘pseq’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

pseries yields START, and then each subsequent value is the previous value plus STEP, for a total of LENGTH values yielded.

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

pshuf shuffles LIST, then yields each item from the shuffled list, repeating the list REPEATS times.

Example:

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

See also: ‘prand’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

pslide slides across sections LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP the number to increment the start index by after each section, and START is the initial index 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 will return nils.

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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses
Direct methods
Direct slots
Slot: number

The number of outputs yielded from the pstream.

Initform

0

Slot: pattern-stack

The stack of pattern pstreams embedded in this pstream.

Initform

(list)

Slot: history

The history of outputs yielded by the pstream.

Initform

(list)

Slot: beat

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

Initform

0

Readers

beat (generic function)

Slot: start-beat

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

Initargs

:start-beat

Slot: pstream-offset

The current offset in the pstream’s history that ‘next’ should read from. For example, if ‘peek’ is used on the pstream once, this would be -1.

Initform

0

Slot: pstream-count

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

Initargs

:pstream-count

Readers

pstream-count (generic function)

Class: pstutter ()

pstutter yields each output from PATTERN N times before moving on to the next output from PATTERN.

Example:

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

See also: ‘pr’, ‘pdurstutter’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pstutter-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: n
Initargs

:n

Class: pstutter-pstream ()

pstream for ‘pstutter’.

Package

cl-patterns

Source

src/patterns/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: 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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-pstream
Initargs

:current-pstream

Class: psync ()

psync yields 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

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: ptime ()

ptime yields the number of seconds elapsed since its embedding 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

src/patterns/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

src/patterns/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 ()

ptrace prints to STREAM the PREFIX and then the value of KEY for each event yielded by PATTERN, or the whole event or value if KEY is not provided. ptrace yields everything from the source PATTERN unaffected.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

ptrace-pstream (class)

Direct methods
Direct slots
Slot: pattern
Initargs

:pattern

Slot: key
Initargs

:key

Slot: stream
Initargs

:stream

Slot: prefix
Initargs

:prefix

Class: ptrace-pstream ()

pstream for ‘ptrace’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Class: ptracker ()
Package

cl-patterns

Source

src/patterns/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

src/patterns/tracker.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-row
Initargs

:current-row

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

src/patterns/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

src/patterns/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’

Package

cl-patterns

Source

src/patterns/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

src/patterns/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 ()

pwhite yields LENGTH random numbers between LO and HI.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses

pattern (class)

Direct subclasses

pwhite-pstream (class)

Direct methods
Direct slots
Slot: lo
Initargs

:lo

Slot: hi
Initargs

:hi

Slot: length
Initargs

:length

Class: pwhite-pstream ()

pstream for ‘pwhite’.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pwrand ()

pwrand returns a random element from LIST weighted by respective values from WEIGHTS, for a total of LENGTH values.

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

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pwxrand ()

pwxrand returns a random element from LIST weighted by respective values from WEIGHTS, for a total of LENGTH values, never repeating the same value twice in a row.

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods

next (method)

Direct slots
Slot: current-repeats-remaining
Initargs

:current-repeats-remaining

Class: pxrand ()

pxrand returns a random value from LIST that is not equal to the last result, returning a total of LENGTH values.

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

Package

cl-patterns

Source

src/patterns/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

src/patterns/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


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

5.2 Internal definitions


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

5.2.1 Special variables

Special Variable: *backends*

Plist 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

src/backend.lisp (file)

Special Variable: *chords*
Package

cl-patterns

Source

src/scales.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

src/backend.lisp (file)

Special Variable: *event-special-keys*

Plist mapping event special keys to their case lists.

Package

cl-patterns

Source

src/event.lisp (file)

Special Variable: *latency*

Default latency for events, in seconds.

Package

cl-patterns

Source

src/event.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

src/patterns/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

src/patterns/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

src/patterns/patterns.lisp (file)

Special Variable: *pdef-dictionary*

The global PDEF dictionary.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Special Variable: *performance-errors-lock*

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

Package

cl-patterns

Source

src/clock.lisp (file)

Special Variable: *scales*

Plist of all defined scales.

Package

cl-patterns

Source

src/scales.lisp (file)

Special Variable: *tunings*

Plist of all defined tunings.

Package

cl-patterns

Source

src/scales.lisp (file)


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

5.2.2 Macros

Macro: create-global-dictionary NAME
Package

cl-patterns

Source

src/utility.lisp (file)

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

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 a plist 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.

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

src/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

src/patterns/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 a list or event if the key should embed values into the event stream, or NIL if it should not.

Package

cl-patterns

Source

src/patterns/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

src/patterns/patterns.lisp (file)


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

5.2.3 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

src/clock.lisp (file)

Function: as-pstream-pairs PAIRS
Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: chord-p OBJECT
Package

cl-patterns

Source

src/utility.lisp (file)

Function: clock-add ITEM &optional CLOCK

Add ITEM to CLOCK’s tasks.

Package

cl-patterns

Source

src/clock.lisp (file)

Function: clock-clear-tasks &optional CLOCK

Remove all tasks from CLOCK.

Package

cl-patterns

Source

src/clock.lisp (file)

Function: clock-process CLOCK BEATS

Process any of CLOCK’s tasks that occur in the next BEATS beats.

Package

cl-patterns

Source

src/clock.lisp (file)

Function: clock-remove TASK &optional CLOCK

Remove TASK from CLOCK’s tasks.

Package

cl-patterns

Source

src/clock.lisp (file)

Function: copy-chord INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: copy-scale INSTANCE
Package

cl-patterns

Source

src/utility.lisp (file)

Function: copy-tuning INSTANCE
Package

cl-patterns

Source

src/utility.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

src/utility.lisp (file)

Function: cycles-parse LIST
Package

cl-patterns

Source

src/patterns/cycles.lisp (file)

Function: decf-remaining PATTERN &optional KEY

Decrease PATTERN’s KEY value.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: define-tuning-aliases TUNING-NAME &rest ALIASES

Define aliases for the tuning named TUNING-NAME.

Package

cl-patterns

Source

src/scales.lisp (file)

Function: elt-wrap LIST N

Return the Nth value of LIST, wrapping around if the value is bigger or smaller than the list length.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: flatten-1 LIST

Like ‘alexandria:flatten’, but only flattens one layer.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: has-gate-p SYNTH BACKEND

Whether or not SYNTH in BACKEND has a gate control.

Package

cl-patterns

Source

src/backend.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

src/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

src/utility.lisp (file)

Function: make-chord &key (NAME NAME) (SCALE SCALE) (INDEXES INDEXES)
Package

cl-patterns

Source

src/utility.lisp (file)

Function: make-default-event ()
Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: make-node-map ()

Make a hash-table to hold task->node mappings for a backend.

Package

cl-patterns

Source

src/backend.lisp (file)

Function: make-scale &key (NAME NAME) (NOTES NOTES) (TUNING TUNING)
Package

cl-patterns

Source

src/utility.lisp (file)

Function: make-tuning &key (NAME NAME) (TUNING TUNING) (OCTAVE-RATIO OCTAVE-RATIO)
Package

cl-patterns

Source

src/utility.lisp (file)

Function: most-x LIST PREDICATE KEY

Get the most PREDICATE item in LIST by comparing whether PREDICATE is true for the values returned by KEY applied to each element of LIST.

Example:

;; get the smallest item in the list:
;; (most-x (list 1 2 3) ’< ’identity)

Package

cl-patterns

Source

src/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

src/utility.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

src/patterns/patterns.lisp (file)

Function: pcycles-parse-list LIST
Package

cl-patterns

Source

src/patterns/cycles.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

src/patterns/patterns.lisp (file)

Function: pdef-ref-get PDEF-KEY KEY

Get PDEF-KEY’s KEY value from its plist.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: pdef-ref-set PDEF-KEY KEY PATTERN

Set PDEF-KEY’s KEY in its plist to PATTERN.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: play-test ITEM &optional PSTREAM

Simply output information about the event that’s being played. Useful for diagnostics when no audio output is available.

Package

cl-patterns

Source

src/event.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

src/utility.lisp (file)

Function: pshift PATTERN SHIFT &optional MAX-YIELD
Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: random-range.new LOW &optional HIGH

Return a random number between LOW and HIGH, inclusive. If HIGH is not provided, act the same as (random LOW).

Package

cl-patterns

Source

src/utility.lisp (file)

Function: raw-event-value EVENT KEY

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

Package

cl-patterns

Source

src/event.lisp (file)

Function: raw-set-event-value EVENT KEY VALUE

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

Package

cl-patterns

Source

src/event.lisp (file)

Function: remaining-p PATTERN &optional REPEATS-KEY REMAINING-KEY

Returns 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.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: round-up NUMBER &optional DIVISOR

Round NUMBER up to the next multiple of DIVISOR if it isn’t already a multiple of it.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: scale-p OBJECT
Package

cl-patterns

Source

src/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

src/patterns/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

src/scales.lisp (file)

Function: sign NUMBER

Get an integer representing the sign of a number.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: string-keyword STRING

Return STRING as a keyword, with all non-alphanumeric characters removed.

Package

cl-patterns

Source

src/utility.lisp (file)

Function: string-reader STREAM CHAR
Package

cl-patterns

Source

src/patterns/tracker.lisp (file)

Function: t-pstream VALUE

Make a t-pstream object with the value VALUE.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: t-short STREAM CHAR SUBCHAR
Package

cl-patterns

Source

src/patterns/tracker.lisp (file)

Function: task-nodes TASK MAP

Get the list of nodes for TASK from MAP.

Package

cl-patterns

Source

src/backend.lisp (file)

Writer

(setf task-nodes) (function)

Function: (setf task-nodes) VALUE TASK MAP

Set the list of nodes for TASK in MAP. If VALUE is nil, delete the reference to TASK in MAP.

Package

cl-patterns

Source

src/backend.lisp (file)

Reader

task-nodes (function)

Function: tracker-shorthand STREAM CHAR SUBCHAR

Reader macro for ‘ptracker’ preprocessing.

Package

cl-patterns

Source

src/patterns/tracker.lisp (file)

Function: tuning-p OBJECT
Package

cl-patterns

Source

src/utility.lisp (file)

Function: value-remaining-p VALUE

Returns 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.

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Function: wrap NUMBER BOTTOM TOP

Wraps a number between BOTTOM and TOP, similar to ‘cl:mod’.

Package

cl-patterns

Source

src/utility.lisp (file)


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

5.2.4 Generic functions

Generic Function: backend-play-event EVENT TASK BACKEND

Play EVENT using BACKEND.

Package

cl-patterns

Source

src/backend.lisp (file)

Generic Function: backend-plays-event-p EVENT BACKEND

Method returning true when BACKEND should play EVENT.

Package

cl-patterns

Source

src/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.

Package

cl-patterns

Source

src/backend.lisp (file)

Generic Function: degree EVENT
Generic Function: (setf degree) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: degree (EVENT null)
Source

src/event.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

src/patterns/patterns.lisp (file)

Methods
Method: ended-p (PSTREAM pstream)
Generic Function: events-after-p PSTREAM BEAT

Whether or not there are events in PSTREAM after BEAT.

See also: ‘events-in-range’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Methods
Method: events-after-p (PSTREAM pstream) BEAT
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.

See also: ‘events-after-p’

Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Methods
Method: events-in-range (PSTREAM pstream) MIN MAX
Method: events-in-range (PATTERN pattern) MIN MAX
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

src/patterns/patterns.lisp (file)

Methods
Method: last-output (PSTREAM pstream)
Generic Function: octave EVENT
Generic Function: (setf octave) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: octave (EVENT null)
Source

src/event.lisp (file)

Generic Function: pdef-key OBJECT
Package

cl-patterns

Methods
Method: pdef-key (PDEF pdef)

automatically generated reader method

Source

src/patterns/patterns.lisp (file)

Generic Function: pstream-elt-index CONDITION
Package

cl-patterns

Methods
Method: pstream-elt-index (CONDITION pstream-out-of-range)
Source

src/patterns/patterns.lisp (file)

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

cl-patterns

Methods
Method: quant (PDEF pdef)
Source

src/patterns/patterns.lisp (file)

Method: quant (PATTERN pattern)

A list of numbers representing when the pattern’s pstream can start playing. The list takes the form (QUANT &OPTIONAL PHASE TIMING-OFFSET). For example, a quant of (4) means it can start on any beat on the clock that is divisible by 4. A quant of (4 2) means the pstream can start 2 beats after any beat divisible by 4. And a quant of (4 0 1) means that the pstream can start 1 second after any beat that is divisible by 4.

Source

src/patterns/patterns.lisp (file)

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

src/patterns/patterns.lisp (file)

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

src/event.lisp (file)

Method: quant (EVENT null)
Source

src/event.lisp (file)

Generic Function: root EVENT
Generic Function: (setf root) VALUE EVENT
Package

cl-patterns

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

src/event.lisp (file)

Method: root (EVENT null)
Source

src/event.lisp (file)

Generic Function: synth-controls SYNTH BACKEND

Get the list of names of controls for SYNTH in BACKEND.

Package

cl-patterns

Source

src/backend.lisp (file)


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

5.2.5 Conditions

Condition: pstream-out-of-range ()
Package

cl-patterns

Source

src/patterns/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]

5.2.6 Classes

Class: clock ()

A musical time-based clock defining a tempo and pulse that its tasks synchronize to.

Package

cl-patterns

Source

src/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.

Initform

0

Slot: tempo

The tempo of the clock, in beats per second.

Initargs

:tempo

Initform

1

Readers

tempo (generic function)

Slot: tasks

The list of tasks that are running on the clock.

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: pbind-pstream ()
Package

cl-patterns

Source

src/patterns/patterns.lisp (file)

Direct superclasses
Direct methods
Class: t-pstream ()

Pattern stream object that yields its value only once.

Package

cl-patterns

Source

src/patterns/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

src/clock.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: item

The actual playing item that the task refers to.

Initargs

:item

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.

Initargs

:start-beat

Slot: clock

The clock that the task is running on.

Initargs

:clock


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-patterns.asd: The cl-patterns<dot>asd file
cl-patterns/package.lisp: The cl-patterns/package<dot>lisp file
cl-patterns/src/backend.lisp: The cl-patterns/src/backend<dot>lisp file
cl-patterns/src/clock.lisp: The cl-patterns/src/clock<dot>lisp file
cl-patterns/src/conversions.lisp: The cl-patterns/src/conversions<dot>lisp file
cl-patterns/src/event.lisp: The cl-patterns/src/event<dot>lisp file
cl-patterns/src/patterns/bjorklund.lisp: The cl-patterns/src/patterns/bjorklund<dot>lisp file
cl-patterns/src/patterns/cycles.lisp: The cl-patterns/src/patterns/cycles<dot>lisp file
cl-patterns/src/patterns/patterns.lisp: The cl-patterns/src/patterns/patterns<dot>lisp file
cl-patterns/src/patterns/tracker.lisp: The cl-patterns/src/patterns/tracker<dot>lisp file
cl-patterns/src/scales.lisp: The cl-patterns/src/scales<dot>lisp file
cl-patterns/src/utility.lisp: The cl-patterns/src/utility<dot>lisp file

F
File, Lisp, cl-patterns.asd: The cl-patterns<dot>asd file
File, Lisp, cl-patterns/package.lisp: The cl-patterns/package<dot>lisp file
File, Lisp, cl-patterns/src/backend.lisp: The cl-patterns/src/backend<dot>lisp file
File, Lisp, cl-patterns/src/clock.lisp: The cl-patterns/src/clock<dot>lisp file
File, Lisp, cl-patterns/src/conversions.lisp: The cl-patterns/src/conversions<dot>lisp file
File, Lisp, cl-patterns/src/event.lisp: The cl-patterns/src/event<dot>lisp file
File, Lisp, cl-patterns/src/patterns/bjorklund.lisp: The cl-patterns/src/patterns/bjorklund<dot>lisp file
File, Lisp, cl-patterns/src/patterns/cycles.lisp: The cl-patterns/src/patterns/cycles<dot>lisp file
File, Lisp, cl-patterns/src/patterns/patterns.lisp: The cl-patterns/src/patterns/patterns<dot>lisp file
File, Lisp, cl-patterns/src/patterns/tracker.lisp: The cl-patterns/src/patterns/tracker<dot>lisp file
File, Lisp, cl-patterns/src/scales.lisp: The cl-patterns/src/scales<dot>lisp file
File, Lisp, cl-patterns/src/utility.lisp: The cl-patterns/src/utility<dot>lisp file

L
Lisp File, cl-patterns.asd: The cl-patterns<dot>asd file
Lisp File, cl-patterns/package.lisp: The cl-patterns/package<dot>lisp file
Lisp File, cl-patterns/src/backend.lisp: The cl-patterns/src/backend<dot>lisp file
Lisp File, cl-patterns/src/clock.lisp: The cl-patterns/src/clock<dot>lisp file
Lisp File, cl-patterns/src/conversions.lisp: The cl-patterns/src/conversions<dot>lisp file
Lisp File, cl-patterns/src/event.lisp: The cl-patterns/src/event<dot>lisp file
Lisp File, cl-patterns/src/patterns/bjorklund.lisp: The cl-patterns/src/patterns/bjorklund<dot>lisp file
Lisp File, cl-patterns/src/patterns/cycles.lisp: The cl-patterns/src/patterns/cycles<dot>lisp file
Lisp File, cl-patterns/src/patterns/patterns.lisp: The cl-patterns/src/patterns/patterns<dot>lisp file
Lisp File, cl-patterns/src/patterns/tracker.lisp: The cl-patterns/src/patterns/tracker<dot>lisp file
Lisp File, cl-patterns/src/scales.lisp: The cl-patterns/src/scales<dot>lisp file
Lisp File, cl-patterns/src/utility.lisp: The cl-patterns/src/utility<dot>lisp file

Jump to:   C   F   L  

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

A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   H   I   K   L   M   N   O   P   Q   R   S   T   U   V   W  
Index Entry  Section

(
(setf amp): Exported generic functions
(setf amp): Exported generic functions
(setf beat): Exported generic functions
(setf beat): Exported generic functions
(setf chord-indexes): Exported functions
(setf chord-name): Exported functions
(setf chord-scale): Exported functions
(setf db): Exported generic functions
(setf db): Exported generic functions
(setf degree): Internal generic functions
(setf degree): Internal generic functions
(setf delta): Exported generic functions
(setf delta): Exported generic functions
(setf dur): Exported generic functions
(setf dur): 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 midinote): Exported generic functions
(setf midinote): Exported generic functions
(setf octave): Internal generic functions
(setf octave): Internal generic functions
(setf pan): Exported generic functions
(setf pan): Exported generic functions
(setf quant): Internal generic functions
(setf quant): Internal generic functions
(setf quant): Internal generic functions
(setf root): Internal generic functions
(setf root): Internal generic functions
(setf scale-name): Exported functions
(setf scale-notes): Exported functions
(setf scale-tuning): Exported functions
(setf sustain): Exported generic functions
(setf sustain): Exported generic functions
(setf task-nodes): Internal functions
(setf tempo): Exported generic functions
(setf tempo): Exported generic functions
(setf tuning-name): Exported functions
(setf tuning-octave-ratio): Exported functions
(setf tuning-tuning): Exported 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: Exported generic functions
amp-db: Exported 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-pairs: Internal functions

B
backend-play-event: Internal generic functions
backend-plays-event-p: Internal generic functions
backend-task-removed: Internal 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

C
chord: Exported generic functions
chord: Exported generic functions
chord: Exported generic functions
chord: Exported generic functions
chord-indexes: Exported functions
chord-midinotes: Exported functions
chord-name: Exported functions
chord-note-numbers: Exported functions
chord-p: Internal functions
chord-scale: Exported functions
clock-add: Internal functions
clock-clear-tasks: Internal functions
clock-loop: Exported functions
clock-process: Internal functions
clock-remove: Internal functions
combine-events: Exported functions
copy-chord: Internal functions
copy-event: Exported functions
copy-scale: Internal functions
copy-tuning: Internal functions
create-global-dictionary: Internal macros
cumulative-list: Internal functions
cycles: Exported macros
cycles-parse: Internal functions

D
db: Exported generic functions
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
define-tuning-aliases: Internal functions
defpattern: Exported macros
degree: Internal generic functions
degree: Internal generic functions
degree: Internal generic functions
degree-freq: Exported functions
degree-midinote: Exported functions
degree-note: Exported functions
delta: Exported generic 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
elt-wrap: Internal 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
ended-p: Internal generic functions
ended-p: Internal generic functions
event: Exported functions
event-equal: Exported functions
event-plist: Exported generic functions
event-plist: Exported generic functions
event-value: Exported functions
events-after-p: Internal generic functions
events-after-p: Internal generic 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
exponential-random-range: Exported functions

F
flatten-1: Internal functions
freq: Exported generic functions
freq: Exported generic functions
freq: Exported generic functions
freq-midinote: Exported functions
freq-octave: Exported functions
freq-rate: Exported functions
frequency-to-midi: Exported functions
Function, (setf chord-indexes): Exported functions
Function, (setf chord-name): Exported functions
Function, (setf chord-scale): Exported functions
Function, (setf event-value): Exported functions
Function, (setf scale-name): Exported functions
Function, (setf scale-notes): Exported functions
Function, (setf scale-tuning): Exported functions
Function, (setf task-nodes): Internal functions
Function, (setf tuning-name): Exported functions
Function, (setf tuning-octave-ratio): Exported functions
Function, (setf tuning-tuning): Exported 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, as-pstream-pairs: Internal functions
Function, bipolar-1-to-midi: Exported functions
Function, bjorklund: Exported functions
Function, chord-indexes: Exported functions
Function, chord-midinotes: Exported functions
Function, chord-name: Exported functions
Function, chord-note-numbers: Exported functions
Function, chord-p: Internal functions
Function, chord-scale: Exported functions
Function, clock-add: Internal functions
Function, clock-clear-tasks: Internal functions
Function, clock-loop: Exported functions
Function, clock-process: Internal functions
Function, clock-remove: Internal functions
Function, combine-events: Exported functions
Function, copy-chord: Internal functions
Function, copy-event: Exported functions
Function, copy-scale: Internal functions
Function, copy-tuning: Internal 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, define-tuning-aliases: Internal 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, elt-wrap: Internal functions
Function, enable-backend: Exported functions
Function, enabled-backends: Exported functions
Function, event: Exported functions
Function, event-equal: Exported functions
Function, event-value: Exported functions
Function, events-differing-keys: Exported functions
Function, events-lists-differing-keys: Exported functions
Function, every-event-equal: Exported functions
Function, exponential-random-range: Exported functions
Function, flatten-1: Internal functions
Function, freq-midinote: Exported functions
Function, freq-octave: Exported functions
Function, freq-rate: Exported functions
Function, frequency-to-midi: Exported functions
Function, get-event-value: Exported functions
Function, gete: Exported functions
Function, has-gate-p: Internal functions
Function, index-and-offset: Internal functions
Function, index-of-greater-than: Internal functions
Function, load-scala-scale: Exported functions
Function, make-chord: Internal functions
Function, make-clock: Exported functions
Function, make-default-event: Internal functions
Function, make-node-map: Internal functions
Function, make-scale: Internal functions
Function, make-tuning: Internal functions
Function, midi-ratio: Exported functions
Function, midi-truncate-clamp: Exported functions
Function, midinote-degree: Exported functions
Function, midinote-freq: Exported functions
Function, midinote-octave: Exported functions
Function, midinote-rate: Exported functions
Function, most-x: Internal functions
Function, next-beat-for-quant: Exported functions
Function, next-n: Exported functions
Function, next-upto-n: Exported functions
Function, normalized-sum: Internal functions
Function, note-midinote: Exported functions
Function, note-name: Exported functions
Function, note-number: Exported functions
Function, p*: Exported functions
Function, p+: Exported functions
Function, p-: Exported functions
Function, p/: Exported functions
Function, parp: Exported functions
Function, pattern-as-pstream: Internal functions
Function, pbeat: Exported functions
Function, pbind: Exported functions
Function, pbjorklund: Exported functions
Function, pbrown: Exported functions
Function, pchain: Exported functions
Function, pcycles: Exported functions
Function, pcycles-parse-list: Internal functions
Function, pdef: Exported functions
Function, pdef-ref: Internal functions
Function, pdef-ref-get: Internal functions
Function, pdef-ref-set: Internal functions
Function, pdefs-playing: Exported functions
Function, pdelta: Exported functions
Function, pdiff: Exported functions
Function, pdrop: Exported functions
Function, pdurstutter: Exported functions
Function, peek-n: Exported functions
Function, peek-upto-n: Exported functions
Function, pexprand: Exported functions
Function, pfin: Exported functions
Function, pfindur: Exported functions
Function, pfunc: Exported functions
Function, pfuture: Exported functions
Function, pgeom: Exported functions
Function, phistory: Exported functions
Function, pif: Exported functions
Function, pindex: Exported functions
Function, pk: Exported functions
Function, place: Exported functions
Function, play-or-end: Exported functions
Function, play-or-stop: Exported functions
Function, play-test: Internal functions
Function, plazy: Exported functions
Function, plazyn: Exported functions
Function, plist-set: Internal functions
Function, pmeta: Exported functions
Function, pmono: Exported functions
Function, pn: Exported functions
Function, pnary: Exported functions
Function, ppar: Exported functions
Function, ppatlace: Exported functions
Function, pr: Exported functions
Function, prand: Exported functions
Function, prun: Exported functions
Function, pscratch: Exported functions
Function, pseq: Exported functions
Function, pser: Exported functions
Function, pseries: Exported functions
Function, pshift: Internal functions
Function, pshuf: Exported functions
Function, pslide: Exported functions
Function, pstream-elt: Exported functions
Function, pstream-elt-future: Exported functions
Function, pstream-nth: Exported functions
Function, pstream-nth-future: Exported functions
Function, pstutter: Exported functions
Function, psym: Exported functions
Function, psync: Exported functions
Function, ptime: Exported functions
Function, ptrace: Exported functions
Function, ptracker: Exported functions
Function, pts: Exported functions
Function, pwalk: Exported functions
Function, pwhite: Exported functions
Function, pwrand: Exported functions
Function, pwxrand: Exported functions
Function, pxrand: Exported functions
Function, random-coin: Exported functions
Function, random-range: Exported functions
Function, random-range.new: Internal functions
Function, rate-freq: Exported functions
Function, rate-midinote: Exported functions
Function, ratio-midi: Exported functions
Function, raw-event-value: Internal functions
Function, raw-set-event-value: Internal functions
Function, register-backend: Exported functions
Function, remaining-p: Internal functions
Function, remove-event-value: Exported functions
Function, round-up: Internal functions
Function, scale-midinotes: Exported functions
Function, scale-name: Exported functions
Function, scale-notes: Exported functions
Function, scale-p: Internal functions
Function, scale-tuning: Exported functions
Function, seq: Exported functions
Function, seq-range: Exported functions
Function, set-event-value: Exported functions
Function, set-parents: Internal functions
Function, sharp-or-flat: Internal functions
Function, sign: Internal functions
Function, split-event-by-lists: Exported functions
Function, start-clock-loop: Exported functions
Function, string-keyword: Internal functions
Function, string-reader: Internal functions
Function, t-pstream: Internal functions
Function, t-short: Internal functions
Function, task-nodes: Internal functions
Function, time-dur: Exported functions
Function, tracker-shorthand: Internal functions
Function, tuning-name: Exported functions
Function, tuning-octave-ratio: Exported functions
Function, tuning-p: Internal functions
Function, tuning-tuning: Exported functions
Function, unipolar-1-to-midi: Exported functions
Function, value-remaining-p: Internal functions
Function, wrap: Internal functions

G
Generic Function, (setf amp): Exported generic functions
Generic Function, (setf beat): Exported generic functions
Generic Function, (setf db): Exported generic functions
Generic Function, (setf degree): Internal generic functions
Generic Function, (setf delta): Exported generic functions
Generic Function, (setf dur): Exported generic functions
Generic Function, (setf freq): Exported generic functions
Generic Function, (setf instrument): Exported generic functions
Generic Function, (setf legato): Exported generic functions
Generic Function, (setf loop-p): Exported generic functions
Generic Function, (setf midinote): Exported generic functions
Generic Function, (setf octave): Internal generic functions
Generic Function, (setf pan): Exported generic functions
Generic Function, (setf quant): Internal generic functions
Generic Function, (setf root): Internal generic functions
Generic Function, (setf sustain): Exported generic functions
Generic Function, (setf tempo): Exported generic functions
Generic Function, amp: Exported generic functions
Generic Function, as-pstream: Exported generic functions
Generic Function, backend-play-event: Internal generic functions
Generic Function, backend-plays-event-p: Internal generic functions
Generic Function, backend-task-removed: Internal generic functions
Generic Function, beat: Exported generic functions
Generic Function, chord: Exported generic functions
Generic Function, db: Exported generic functions
Generic Function, degree: Internal generic functions
Generic Function, delta: Exported generic functions
Generic Function, dur: Exported generic functions
Generic Function, end: Exported generic functions
Generic Function, ended-p: Internal generic functions
Generic Function, event-plist: Exported generic functions
Generic Function, events-after-p: Internal generic functions
Generic Function, events-in-range: Internal generic functions
Generic Function, freq: Exported generic functions
Generic Function, instrument: Exported generic functions
Generic Function, keys: Exported generic functions
Generic Function, last-output: Internal generic functions
Generic Function, launch: Exported generic functions
Generic Function, legato: Exported generic functions
Generic Function, loop-p: Exported generic functions
Generic Function, midinote: Exported generic functions
Generic Function, next: Exported generic functions
Generic Function, octave: Internal generic functions
Generic Function, pan: Exported generic functions
Generic Function, parent-pattern: Exported generic functions
Generic Function, parent-pbind: Exported generic functions
Generic Function, pdef-key: Internal generic functions
Generic Function, pdef-pattern: Exported generic functions
Generic Function, peek: Exported generic functions
Generic Function, play: Exported generic functions
Generic Function, playing-p: Exported generic functions
Generic Function, pstream-count: Exported generic functions
Generic Function, pstream-elt-index: Internal generic functions
Generic Function, quant: Internal generic functions
Generic Function, root: Internal generic functions
Generic Function, scale: Exported generic functions
Generic Function, start-backend: Exported generic functions
Generic Function, stop: Exported generic functions
Generic Function, stop-backend: Exported generic functions
Generic Function, sustain: Exported generic functions
Generic Function, synth-controls: Internal generic functions
Generic Function, tempo: Exported generic functions
Generic Function, tuning: Exported generic functions
get-event-value: Exported functions
gete: Exported functions

H
has-gate-p: Internal functions

I
index-and-offset: Internal functions
index-of-greater-than: Internal functions
instrument: Exported generic functions
instrument: Exported generic functions
instrument: Exported generic functions

K
keys: Exported generic functions
keys: Exported generic functions
keys: Exported generic functions
keys: Exported generic functions
keys: Exported generic functions

L
last-output: Internal generic functions
last-output: Internal generic functions
launch: Exported generic functions
launch: Exported generic functions
launch: Exported generic functions
launch: Exported generic functions
launch: Exported generic functions
legato: Exported generic functions
legato: Exported generic functions
legato: Exported generic functions
load-scala-scale: Exported functions
loop-p: Exported generic functions
loop-p: Exported generic functions
loop-p: Exported generic functions

M
Macro, create-global-dictionary: Internal macros
Macro, cycles: Exported macros
Macro, define-event-special-key: Internal macros
Macro, define-pbind-special-init-key: Internal macros
Macro, define-pbind-special-process-key: Internal macros
Macro, define-pbind-special-wrap-key: Internal macros
Macro, defpattern: Exported macros
Macro, pb: Exported macros
Macro, pf: Exported macros
Macro, pt: Exported macros
make-chord: Internal functions
make-clock: Exported functions
make-default-event: Internal functions
make-node-map: Internal functions
make-scale: Internal functions
make-tuning: Internal functions
Method, (setf amp): Exported generic functions
Method, (setf beat): Exported generic functions
Method, (setf db): Exported generic functions
Method, (setf degree): Internal generic functions
Method, (setf delta): Exported generic functions
Method, (setf dur): Exported generic functions
Method, (setf freq): Exported generic functions
Method, (setf instrument): Exported generic functions
Method, (setf legato): Exported generic functions
Method, (setf loop-p): Exported generic functions
Method, (setf midinote): Exported generic functions
Method, (setf octave): Internal generic functions
Method, (setf pan): Exported generic functions
Method, (setf quant): Internal generic functions
Method, (setf quant): Internal generic functions
Method, (setf root): Internal generic functions
Method, (setf sustain): Exported generic functions
Method, (setf tempo): Exported generic functions
Method, amp: Exported generic functions
Method, amp: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, as-pstream: Exported generic functions
Method, beat: Exported generic functions
Method, beat: Exported generic functions
Method, beat: Exported generic functions
Method, beat: Exported generic functions
Method, chord: Exported generic functions
Method, chord: Exported generic functions
Method, chord: Exported generic functions
Method, db: Exported generic functions
Method, db: Exported generic functions
Method, degree: Internal generic functions
Method, degree: Internal generic functions
Method, delta: Exported generic functions
Method, delta: Exported generic functions
Method, dur: Exported generic functions
Method, dur: Exported generic functions
Method, end: Exported generic functions
Method, end: Exported generic functions
Method, end: Exported generic functions
Method, ended-p: Internal generic functions
Method, event-plist: Exported generic functions
Method, events-after-p: Internal generic functions
Method, events-in-range: Internal generic functions
Method, events-in-range: Internal generic functions
Method, freq: Exported generic functions
Method, freq: Exported generic functions
Method, instrument: Exported generic functions
Method, instrument: Exported generic functions
Method, keys: Exported generic functions
Method, keys: Exported generic functions
Method, keys: Exported generic functions
Method, keys: Exported generic functions
Method, last-output: Internal generic functions
Method, launch: Exported generic functions
Method, launch: Exported generic functions
Method, launch: Exported generic functions
Method, launch: Exported generic functions
Method, legato: Exported generic functions
Method, legato: Exported generic functions
Method, loop-p: Exported generic functions
Method, loop-p: Exported generic functions
Method, midinote: Exported generic functions
Method, midinote: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, next: Exported generic functions
Method, octave: Internal generic functions
Method, octave: Internal generic functions
Method, pan: Exported generic functions
Method, pan: Exported generic functions
Method, parent-pattern: Exported generic functions
Method, parent-pbind: Exported generic functions
Method, pdef-key: Internal generic functions
Method, pdef-pattern: Exported generic functions
Method, peek: Exported generic functions
Method, play: Exported generic functions
Method, play: Exported generic functions
Method, play: Exported generic functions
Method, play: Exported generic functions
Method, playing-p: Exported generic functions
Method, playing-p: Exported generic functions
Method, playing-p: Exported generic functions
Method, pstream-count: Exported generic functions
Method, pstream-count: Exported generic functions
Method, pstream-elt-index: Internal generic functions
Method, quant: Internal generic functions
Method, quant: Internal generic functions
Method, quant: Internal generic functions
Method, quant: Internal generic functions
Method, root: Internal generic functions
Method, root: Internal generic functions
Method, scale: Exported generic functions
Method, scale: Exported generic functions
Method, scale: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, stop: Exported generic functions
Method, sustain: Exported generic functions
Method, sustain: Exported generic functions
Method, tempo: Exported generic functions
Method, tempo: Exported generic functions
Method, tuning: Exported generic functions
Method, tuning: Exported generic functions
Method, tuning: Exported generic functions
midi-ratio: Exported functions
midi-truncate-clamp: Exported functions
midinote: Exported generic functions
midinote: Exported generic functions
midinote: Exported generic functions
midinote-degree: Exported functions
midinote-freq: Exported functions
midinote-octave: Exported functions
midinote-rate: Exported functions
most-x: Internal functions

N
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next: Exported generic functions
next-beat-for-quant: Exported functions
next-n: Exported functions
next-upto-n: Exported functions
normalized-sum: Internal functions
note-midinote: Exported functions
note-name: Exported functions
note-number: Exported functions

O
octave: Internal generic functions
octave: Internal generic functions
octave: Internal generic functions

P
p*: Exported functions
p+: Exported functions
p-: Exported functions
p/: Exported functions
pan: Exported generic functions
pan: Exported generic functions
pan: Exported generic functions
parent-pattern: Exported generic functions
parent-pattern: Exported generic functions
parent-pbind: Exported generic functions
parent-pbind: Exported generic functions
parp: Exported functions
pattern-as-pstream: Internal functions
pb: Exported macros
pbeat: Exported functions
pbind: Exported functions
pbjorklund: Exported functions
pbrown: Exported functions
pchain: Exported functions
pcycles: Exported functions
pcycles-parse-list: Internal functions
pdef: Exported functions
pdef-key: Internal generic functions
pdef-key: Internal generic functions
pdef-pattern: Exported generic functions
pdef-pattern: Exported generic functions
pdef-ref: Internal functions
pdef-ref-get: Internal functions
pdef-ref-set: Internal functions
pdefs-playing: Exported functions
pdelta: Exported functions
pdiff: Exported functions
pdrop: Exported functions
pdurstutter: Exported functions
peek: Exported generic functions
peek: Exported generic functions
peek-n: Exported functions
peek-upto-n: Exported functions
pexprand: Exported functions
pf: Exported macros
pfin: Exported functions
pfindur: Exported functions
pfunc: Exported functions
pfuture: Exported functions
pgeom: Exported functions
phistory: Exported functions
pif: Exported functions
pindex: Exported functions
pk: Exported functions
place: Exported functions
play: Exported generic functions
play: Exported generic functions
play: Exported generic functions
play: Exported generic functions
play: Exported generic functions
play-or-end: Exported functions
play-or-stop: Exported functions
play-test: Internal functions
playing-p: Exported generic functions
playing-p: Exported generic functions
playing-p: Exported generic functions
playing-p: Exported generic functions
plazy: Exported functions
plazyn: Exported functions
plist-set: Internal functions
pmeta: Exported functions
pmono: Exported functions
pn: Exported functions
pnary: Exported functions
ppar: Exported functions
ppatlace: Exported functions
pr: Exported functions
prand: Exported functions
prun: Exported functions
pscratch: Exported functions
pseq: Exported functions
pser: Exported functions
pseries: Exported functions
pshift: Internal functions
pshuf: Exported functions
pslide: Exported functions
pstream-count: Exported generic functions
pstream-count: Exported generic functions
pstream-count: Exported generic functions
pstream-elt: Exported functions
pstream-elt-future: Exported functions
pstream-elt-index: Internal generic functions
pstream-elt-index: Internal generic functions
pstream-nth: Exported functions
pstream-nth-future: Exported functions
pstutter: Exported functions
psym: Exported functions
psync: Exported functions
pt: Exported macros
ptime: Exported functions
ptrace: Exported functions
ptracker: Exported functions
pts: Exported functions
pwalk: Exported functions
pwhite: Exported functions
pwrand: Exported functions
pwxrand: Exported functions
pxrand: Exported functions

Q
quant: Internal generic functions
quant: Internal generic functions
quant: Internal generic functions
quant: Internal generic functions
quant: Internal generic functions

R
random-coin: Exported functions
random-range: Exported functions
random-range.new: Internal functions
rate-freq: Exported functions
rate-midinote: Exported functions
ratio-midi: Exported functions
raw-event-value: Internal functions
raw-set-event-value: Internal functions
register-backend: Exported functions
remaining-p: Internal functions
remove-event-value: Exported functions
root: Internal generic functions
root: Internal generic functions
root: Internal generic functions
round-up: Internal functions

S
scale: Exported generic functions
scale: Exported generic functions
scale: Exported generic functions
scale: Exported generic functions
scale-midinotes: Exported functions
scale-name: Exported functions
scale-notes: Exported functions
scale-p: Internal functions
scale-tuning: Exported functions
seq: Exported functions
seq-range: Exported functions
set-event-value: Exported functions
set-parents: Internal functions
sharp-or-flat: Internal functions
sign: Internal functions
split-event-by-lists: Exported functions
start-backend: Exported generic functions
start-clock-loop: Exported functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop: Exported generic functions
stop-backend: Exported generic functions
string-keyword: Internal functions
string-reader: Internal functions
sustain: Exported generic functions
sustain: Exported generic functions
sustain: Exported generic functions
synth-controls: Internal generic functions

T
t-pstream: Internal functions
t-short: Internal functions
task-nodes: Internal functions
tempo: Exported generic functions
tempo: Exported generic functions
tempo: Exported generic functions
time-dur: Exported functions
tracker-shorthand: Internal functions
tuning: Exported generic functions
tuning: Exported generic functions
tuning: Exported generic functions
tuning: Exported generic functions
tuning-name: Exported functions
tuning-octave-ratio: Exported functions
tuning-p: Internal functions
tuning-tuning: Exported functions

U
unipolar-1-to-midi: Exported functions

V
value-remaining-p: Internal functions

W
wrap: Internal functions

Jump to:   (  
A   B   C   D   E   F   G   H   I   K   L   M   N   O   P   Q   R   S   T   U   V   W  

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

A.3 Variables

Jump to:   %   *  
A   B   C   D   E   F   G   H   I   K   L   M   N   O   P   Q   R   S   T   V   W  
Index Entry  Section

%
%beat: Exported classes

*
*backends*: Internal special variables
*chords*: Internal special variables
*clock*: Exported special variables
*enabled-backends*: Internal special variables
*event*: Exported special variables
*event-special-keys*: Internal special variables
*latency*: Internal special variables
*max-pattern-yield-length*: Exported special variables
*note-names*: Exported special variables
*pbind-special-init-keys*: Internal special variables
*pbind-special-process-keys*: Internal special variables
*pbind-special-wrap-keys*: Internal special variables
*pdef-dictionary*: Internal special variables
*performance-errors*: Exported special variables
*performance-errors-lock*: Internal special variables
*performance-mode*: Exported special variables
*scales*: Internal special variables
*tunings*: Internal special variables

A
arpeggiator: Exported classes

B
beat: Exported classes
beat: Internal classes
beat-at-tempo: Internal classes

C
cleanup-functions: Exported classes
clock: Internal classes
condition: Exported classes
count: Exported classes
current-arpeggiator-stream: Exported classes
current-direction: Exported classes
current-dur: Exported classes
current-elapsed: Exported classes
current-index: Exported classes
current-index: Exported classes
current-index: Exported classes
current-pattern-event: Exported classes
current-pstream: Exported classes
current-pstream: Exported classes
current-pstream: Exported classes
current-pstream: Exported classes
current-pstream: Exported classes
current-pstream: Exported classes
current-repeat: Exported classes
current-repeats: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-repeats-remaining: Exported classes
current-row: Exported classes
current-value: Exported classes
current-value: Exported classes
current-value: Exported classes
current-value: Exported classes
current-value: Exported classes
current-value: Exported classes
current-value: Exported classes
cycle: Exported classes

D
default: Exported classes
direction-pattern: Exported classes
dur: Exported classes
dur: Exported classes
dur: Exported classes
dur-history: Exported classes

E
elapsed-time: Exported classes
event-plist: Exported classes

F
false: Exported classes
func: Exported classes
func: Exported classes
func: Exported classes

G
grow: Exported classes

H
header: Exported classes
hi: Exported classes
hi: Exported classes
hi: Exported classes
history: Exported classes

I
index: Internal conditions
index-pat: Exported classes
indexes: Exported structures
item: Internal classes

K
key: Exported classes
key: Exported classes
key: Exported classes

L
last-beat-checked: Exported classes
last-result: Exported classes
len: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
length: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list: Exported classes
list-pat: Exported classes
lo: Exported classes
lo: Exported classes
lo: Exported classes
loop-p: Exported classes
loop-p: Exported classes
loop-p: Internal classes

M
maxdur: Exported classes

N
n: Exported classes
n: Exported classes
n: Exported classes
name: Exported structures
name: Exported structures
name: Exported structures
notes: Exported structures
number: Exported classes

O
octave-ratio: Exported structures
offset: Exported classes
offset: Exported classes
offset: Exported classes
operator: Exported classes

P
pairs: Exported classes
parent: Exported classes
parsed-list: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: Exported classes
pattern: