This is the cl-patterns Reference Manual, version 0.7, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:19:45 2024 GMT+0.
cl-patterns/cl-patterns.asd
cl-patterns/package.lisp
cl-patterns/utility.lisp
cl-patterns/conversions.lisp
cl-patterns/scales.lisp
cl-patterns/event.lisp
cl-patterns/patterns/patterns.lisp
cl-patterns/patterns/pdef.lisp
cl-patterns/patterns/pmeta.lisp
cl-patterns/patterns/bjorklund.lisp
cl-patterns/patterns/cycles.lisp
cl-patterns/patterns/track.lisp
cl-patterns/patterns/export.lisp
cl-patterns/eseq.lisp
cl-patterns/backend.lisp
cl-patterns/render.lisp
cl-patterns/clock.lisp
cl-patterns/extensions/sequence.lisp
The main system appears first, followed by any subsystem dependency.
cl-patterns
Pattern library for algorithmic music composition and performance in Common Lisp
modula t.
(GIT git@github.com:defaultxr/cl-patterns.git)
MIT
0.7
alexandria
(system).
mutility
(system).
mutility/loopy
(system).
bordeaux-threads
(system).
closer-mop
(system).
named-readtables
(system).
local-time
(system).
dissect
(system).
package.lisp
(file).
utility.lisp
(file).
conversions.lisp
(file).
scales.lisp
(file).
event.lisp
(file).
patterns
(module).
eseq.lisp
(file).
backend.lisp
(file).
render.lisp
(file).
clock.lisp
(file).
extensions/sequence.lisp
(file).
Modules are listed depth-first from the system components tree.
cl-patterns/patterns
event.lisp
(file).
cl-patterns
(system).
patterns.lisp
(file).
pdef.lisp
(file).
pmeta.lisp
(file).
bjorklund.lisp
(file).
cycles.lisp
(file).
track.lisp
(file).
export.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-patterns/cl-patterns.asd
cl-patterns/package.lisp
cl-patterns/utility.lisp
cl-patterns/conversions.lisp
cl-patterns/scales.lisp
cl-patterns/event.lisp
cl-patterns/patterns/patterns.lisp
cl-patterns/patterns/pdef.lisp
cl-patterns/patterns/pmeta.lisp
cl-patterns/patterns/bjorklund.lisp
cl-patterns/patterns/cycles.lisp
cl-patterns/patterns/track.lisp
cl-patterns/patterns/export.lisp
cl-patterns/eseq.lisp
cl-patterns/backend.lisp
cl-patterns/render.lisp
cl-patterns/clock.lisp
cl-patterns/extensions/sequence.lisp
cl-patterns/utility.lisp
package.lisp
(file).
cl-patterns
(system).
*clock*
(special variable).
*event*
(special variable).
all-instruments
(function).
beat
(generic function).
end
(generic function).
end-quant
(generic function).
ended-p
(generic function).
eop
(special variable).
eop-p
(generic function).
launch
(generic function).
loop-p
(generic function).
multi-channel-funcall
(function).
next-beat-for-quant
(function).
note-name-and-octave
(function).
pattern
(method combination).
play
(generic function).
play-or-end
(function).
play-or-stop
(function).
play-quant
(generic function).
play-solo
(function).
play-swap
(function).
playing-nodes
(function).
playing-p
(generic function).
pyramid
(function).
quant
(generic function).
(setf quant)
(method).
rerange
(function).
rest-p
(generic function).
stop
(generic function).
tempo
(generic function).
transpose
(function).
*dictionary-lookup-functions*
(special variable).
cumulative-list
(function).
find-buffer-symbol
(function).
find-object-by-id
(function).
from-range
(function).
index-of-greater-than
(function).
last-dur
(generic function).
mapcar-longest
(function).
near-p
(function).
nearest
(function).
normalized-sum
(function).
pattern-pstream-class-name
(function).
plist-set
(function).
string-replace
(function).
to-range
(function).
cl-patterns/conversions.lisp
utility.lisp
(file).
cl-patterns
(system).
*c4-midinote*
(special variable).
*note-names*
(special variable).
amp-db
(function).
bipolar-1-to-midi
(function).
bipolar-unipolar
(function).
chromatic-index-degree
(function).
chromatic-index-freq
(function).
chromatic-index-midinote
(function).
chromatic-index-note
(function).
db-amp
(function).
degree-chromatic-index
(function).
degree-freq
(function).
degree-key
(function).
degree-midinote
(function).
degree-note
(function).
degree-octave
(function).
dur-freq
(function).
dur-time
(function).
freq-chromatic-index
(function).
freq-degree
(function).
freq-dur
(function).
freq-midinote
(function).
freq-note
(function).
freq-octave
(function).
freq-rate
(function).
frequency-to-midi
(function).
midi-ratio
(function).
midi-truncate-clamp
(function).
midinote-chromatic-index
(function).
midinote-degree
(function).
midinote-freq
(function).
midinote-note
(function).
midinote-octave
(function).
midinote-rate
(function).
note-chromatic-index
(function).
note-degree
(function).
note-freq
(function).
note-midinote
(function).
note-octave
(function).
octave-degree
(function).
octave-freq
(function).
octave-midinote
(function).
octave-note
(function).
rate-freq
(function).
rate-midinote
(function).
ratio-midi
(function).
time-dur
(function).
unipolar-1-to-midi
(function).
unipolar-bipolar
(function).
*conversions*
(special variable).
boolean-to-midi
(function).
defconversion
(macro).
cl-patterns/scales.lisp
conversions.lisp
(file).
cl-patterns
(system).
all-chords
(function).
all-scales
(function).
all-tunings
(function).
chord
(generic function).
chord
(class).
chord-indexes
(generic function).
(setf chord-indexes)
(writer method).
chord-midinotes
(function).
chord-name
(generic function).
(setf chord-name)
(writer method).
chord-notes
(function).
chord-scale
(generic function).
(setf chord-scale)
(writer method).
define-chord
(function).
define-scale
(function).
define-tuning
(function).
describe-object
(method).
load-scala-scale
(function).
print-object
(method).
print-object
(method).
print-object
(method).
scale
(generic function).
scale
(class).
scale-midinotes
(function).
scale-name
(generic function).
(setf scale-name)
(writer method).
scale-notes
(generic function).
(setf scale-notes)
(writer method).
scale-steps-per-octave
(generic function).
scale-tuning
(generic function).
(setf scale-tuning)
(writer method).
tone-matrix
(function).
tuning
(generic function).
tuning
(class).
tuning-name
(generic function).
(setf tuning-name)
(writer method).
tuning-octave-ratio
(generic function).
(setf tuning-octave-ratio)
(writer method).
tuning-pitches
(generic function).
(setf tuning-pitches)
(writer method).
tuning-steps-per-octave
(generic function).
*abbreviations*
(special variable).
*chords*
(special variable).
*scales*
(special variable).
*tunings*
(special variable).
generate-aliases
(function).
index-and-offset
(function).
sharp-or-flat
(function).
cl-patterns/event.lisp
scales.lisp
(file).
cl-patterns
(system).
amp
(generic function).
(setf amp)
(method).
beat
(method).
(setf beat)
(method).
combine-events
(function).
combine-events-via-lists
(function).
copy-event
(function).
db
(generic function).
(setf db)
(method).
delta
(generic function).
(setf delta)
(method).
dur
(generic function).
(setf dur)
(method).
e
(function).
(setf e)
(function).
eop-p
(method).
event
(function).
event
(class).
event-equal
(function).
event-p
(function).
event-plist
(generic reader).
event-value
(function).
(setf event-value)
(function).
events-differing-keys
(function).
events-lists-differing-keys
(compiler macro).
events-lists-differing-keys
(function).
every-event-equal
(function).
freq
(generic function).
(setf freq)
(method).
instrument
(generic function).
(setf instrument)
(method).
keys
(method).
legato
(generic function).
(setf legato)
(method).
loop-p
(method).
(setf loop-p)
(method).
midinote
(generic function).
(setf midinote)
(method).
pan
(generic function).
(setf pan)
(method).
play
(method).
play-quant
(method).
(setf play-quant)
(method).
print-object
(method).
quant
(method).
(setf quant)
(method).
rate
(generic function).
(setf rate)
(method).
remove-event-value
(function).
rest-p
(method).
(setf rest-p)
(method).
scale
(method).
(setf scale)
(method).
split-event-by-lists
(function).
sustain
(generic function).
(setf sustain)
(method).
tempo
(method).
(setf tempo)
(method).
%beat
(reader method).
(setf %beat)
(function).
*deprecated-function-error-events-lists-differing-keys-notified-p*
(special variable).
*event-special-keys*
(special variable).
define-event-special-key
(macro).
raw-event-value
(function).
(setf raw-event-value)
(function).
cl-patterns/patterns/patterns.lisp
patterns
(module).
*default-pattern-length*
(special variable).
*default-pattern-repeats*
(special variable).
*display-server*
(special variable).
*max-pattern-yield-length*
(special variable).
*post-pattern-output-processors*
(special variable).
*screen-size*
(special variable).
all-patterns
(function).
as-pstream
(generic function).
beat
(reader method).
bsubseq
(generic function).
defpattern
(macro).
dur
(method).
end-quant
(reader method).
(setf end-quant)
(writer method).
ended-p
(method).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
instrument-mapping
(function).
(setf instrument-mapping)
(function).
ipstream
(function).
ipstream
(class).
ipstream-insert
(generic function).
ipstream-pstream
(class).
keys
(method).
launch
(method).
loop-p
(method).
loop-p
(method).
(setf loop-p)
(method).
mouse-location
(function).
next
(generic function).
next-n
(function).
next-upto-n
(function).
p*
(function).
p+
(function).
p-
(function).
p/
(function).
p/=
(function).
p<
(function).
p<=
(function).
p=
(function).
p>
(function).
p>=
(function).
paccum
(function).
paccum
(class).
paccum-pstream
(class).
paclump
(function).
paclump
(class).
paclump-pstream
(class).
parp
(function).
parp
(class).
parp-pstream
(class).
pattern
(class).
pattern-as-pstream
(function).
pattern-children
(function).
pattern-metadata
(generic function).
(setf pattern-metadata)
(function).
pattern-p
(function).
pattern-parent
(function).
pattern-source
(generic reader).
(setf pattern-source)
(writer method).
pb
(macro).
pbeat
(function).
pbeat
(class).
pbeat*
(function).
pbeat*
(class).
pbeat*-pstream
(class).
pbeat-pstream
(class).
pbind
(function).
pbind
(class).
pbind-pstream
(class).
pbrown
(function).
pbrown
(class).
pbrown-pstream
(class).
pchain
(function).
pchain
(class).
pchain-pstream
(class).
pclump
(function).
pclump
(class).
pclump-pstream
(class).
pdelta
(function).
pdelta
(class).
pdelta-pstream
(class).
pdiff
(function).
pdiff
(class).
pdiff-pstream
(class).
pdrop
(function).
pdrop
(class).
pdrop-pstream
(class).
pdurstutter
(function).
pdurstutter
(class).
pdurstutter-pstream
(class).
peek
(generic function).
peek-n
(function).
peek-upto-n
(function).
peql
(function).
pexprand
(function).
pexprand
(class).
pexprand-pstream
(class).
pf
(macro).
pfilter
(function).
pfilter
(class).
pfilter-out
(function).
pfilter-pstream
(class).
pfin
(function).
pfin
(class).
pfin-pstream
(class).
pfindur
(function).
pfindur
(class).
pfindur-pstream
(class).
pfunc
(function).
pfunc
(class).
pfunc-pstream
(class).
pgauss
(function).
pgauss
(class).
pgauss-pstream
(class).
pgeom
(function).
pgeom
(class).
pgeom*
(function).
pgeom-pstream
(class).
phistory
(function).
phistory
(class).
phistory-pstream
(class).
pif
(function).
pif
(class).
pif-pstream
(class).
pindex
(function).
pindex
(class).
pindex-pstream
(class).
pk
(function).
pk
(class).
pk-pstream
(class).
place
(function).
place
(class).
place-pstream
(class).
play
(method).
play-quant
(method).
(setf play-quant)
(method).
playing-p
(method).
plazy
(function).
plazy
(class).
plazy-pstream
(class).
pmono
(function).
pmouse
(function).
pmouse
(class).
pmouse-pstream
(class).
pmousex
(function).
pmousey
(function).
pn
(function).
pn
(class).
pn-pstream
(class).
pnary
(function).
pnary
(class).
pnary-pstream
(class).
ppar
(function).
ppar
(class).
ppar-pstream
(class).
pparchain
(function).
pparchain
(class).
pparchain-pstream
(class).
ppatlace
(function).
ppatlace
(class).
ppatlace-pstream
(class).
ppc
(macro).
pr
(function).
pr
(class).
pr-pstream
(class).
prand
(function).
prand
(class).
prand-pstream
(class).
prerange
(function).
prerange
(class).
prerange-pstream
(class).
prest
(function).
prest
(class).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
protate
(function).
protate
(class).
protate-pstream
(class).
prs
(function).
prun
(function).
prun
(class).
prun-pstream
(class).
ps
(function).
ps
(class).
ps-pstream
(class).
pscratch
(function).
pscratch
(class).
pscratch-pstream
(class).
pseq
(function).
pseq
(class).
pseq-pstream
(class).
pser
(function).
pser
(class).
pser-pstream
(class).
pseries
(function).
pseries
(class).
pseries*
(function).
pseries-pstream
(class).
pshuf
(function).
pshuf
(class).
pshuf-pstream
(class).
pslide
(function).
pslide
(class).
pslide-pstream
(class).
pstream
(class).
pstream-count
(generic reader).
(setf pstream-count)
(writer method).
(setf pstream-count)
(writer method).
pstream-elt
(function).
pstream-elt-future
(function).
pstream-p
(function).
psym
(function).
psym
(class).
psym-pstream
(class).
psync
(function).
psync
(class).
psync-pstream
(class).
ptime
(function).
ptime
(class).
ptime-pstream
(class).
ptrace
(function).
ptrace
(class).
ptrace-pstream
(class).
pts
(function).
pts
(class).
pts-pstream
(class).
pwalk
(function).
pwalk
(class).
pwalk-pstream
(class).
pwhite
(function).
pwhite
(class).
pwhite-pstream
(class).
pwrand
(function).
pwrand
(class).
pwrand-pstream
(class).
pwrap
(function).
pwxrand
(function).
pwxrand
(class).
pwxrand-pstream
(class).
pxrand
(function).
pxrand
(class).
pxrand-pstream
(class).
rest-p
(method).
screen-size
(function).
t-pstream
(function).
t-pstream
(class).
t-pstream-length
(generic reader).
(setf t-pstream-length)
(writer method).
t-pstream-p
(function).
t-pstream-value
(generic reader).
(setf t-pstream-value)
(writer method).
%pattern-children
(method).
%pattern-children
(method).
%pattern-children
(method).
*instrument-map*
(special variable).
*pattern-function-translations*
(special variable).
*patterns*
(special variable).
*pbind-special-init-keys*
(special variable).
*pbind-special-process-keys*
(special variable).
*pbind-special-wrap-keys*
(special variable).
decf-remaining
(function).
define-pattern-function-translation
(macro).
define-pbind-special-init-key
(macro).
define-pbind-special-process-key
(macro).
define-pbind-special-wrap-key
(macro).
end-condition
(reader method).
(setf end-condition)
(writer method).
events-in-range
(generic function).
last-output
(generic function).
make-default-event
(function).
make-pattern-for-function
(function).
mouse-location*
(generic function).
pattern-translate-sexp
(function).
pb-translate-body-functions
(function).
pbind-pairs
(reader method).
(setf pbind-pairs)
(writer method).
pstream-elt-index
(reader method).
pstream-elt-index-to-history-index
(function).
pstream-history-advance-by
(function).
pstream-out-of-range
(condition).
remaining-p
(function).
remap-instrument-to-parameters
(function).
screen-size*
(generic function).
set-parents
(function).
value-remaining-p
(function).
cl-patterns/patterns/pdef.lisp
patterns
(module).
all-pdef-names
(function).
all-pdefs
(function).
as-pstream
(method).
end
(method).
end-quant
(method).
find-pdef
(function).
(setf find-pdef)
(function).
keys
(method).
launch
(method).
loop-p
(method).
next
(method).
pdef
(function).
pdef
(class).
pdef-name
(generic function).
(setf pdef-name)
(method).
(setf pdef-name)
(method).
pdef-p
(function).
pdef-pattern
(generic function).
(setf pdef-pattern)
(writer method).
pdef-pstream
(generic function).
(setf pdef-pstream)
(method).
(setf pdef-pstream)
(writer method).
pdef-pstream
(class).
pdef-task
(generic function).
(setf pdef-task)
(writer method).
play
(method).
play-quant
(method).
playing-p
(method).
playing-pdef-names
(function).
playing-pdefs
(function).
print-object
(method).
print-object
(method).
stop
(method).
*pdef-dictionary*
(special variable).
pdef-names
(function).
cl-patterns/patterns/pmeta.lisp
patterns
(module).
as-pstream
(method).
next
(method).
pmeta
(function).
pmeta
(class).
pmeta-pstream
(class).
print-object
(method).
pmeta-ensure-pattern-value
(function).
process-pattern-key-value
(generic function).
cl-patterns/patterns/bjorklund.lisp
patterns
(module).
as-pstream
(method).
bjorklund
(function).
next
(method).
pbjorklund
(function).
pbjorklund
(class).
pbjorklund-pstream
(class).
print-object
(method).
cl-patterns/patterns/cycles.lisp
patterns
(module).
as-pstream
(method).
cycles
(macro).
next
(method).
pcycles
(function).
pcycles
(class).
pcycles-pstream
(class).
print-object
(method).
cycles-parse
(function).
pcycles-parse-list
(function).
cl-patterns/patterns/track.lisp
patterns
(module).
as-pstream
(method).
next
(method).
print-object
(method).
pt
(macro).
ptrack
(function).
ptrack
(class).
ptrack-cell
(generic function).
(setf ptrack-cell)
(generic function).
ptrack-pstream
(class).
ptrack-row
(generic function).
(setf ptrack-row)
(method).
ptrack-rows
(generic function).
ptrack-does-not-exist
(function).
string-reader
(function).
t-short
(function).
track-shorthand
(function).
cl-patterns/eseq.lisp
patterns
(module).
cl-patterns
(system).
as-eseq
(generic function).
as-pstream
(method).
bsubseq
(method).
bsubseq
(method).
dur
(method).
end-quant
(method).
(setf end-quant)
(method).
eseq
(function).
eseq
(class).
eseq-add
(generic function).
eseq-events
(generic reader).
(setf eseq-events)
(method).
eseq-length
(function).
eseq-p
(function).
eseq-pstream
(class).
eseq-remove
(generic function).
loop-p
(method).
(setf loop-p)
(method).
next
(method).
pattern-metadata
(method).
play-quant
(method).
(setf play-quant)
(method).
print-object
(method).
last-dur
(method).
next.events-ordered
(method).
cl-patterns/backend.lisp
eseq.lisp
(file).
cl-patterns
(system).
all-backend-types
(function).
all-backends
(function).
backend
(class).
backend-p
(function).
backend-start
(generic function).
backend-stop
(generic function).
enabled-backends
(function).
find-backend
(function).
initialize-instance
(method).
make-backend
(generic function).
*backends*
(special variable).
backend-all-instruments
(generic function).
backend-all-nodes
(generic function).
backend-control-node-at
(generic function).
backend-convert-object
(generic function).
backend-enabled-p
(reader method).
(setf backend-enabled-p)
(writer method).
backend-input-processors
(reader method).
(setf backend-input-processors)
(writer method).
backend-instrument-args-list
(generic function).
backend-instrument-controls
(generic function).
backend-instrument-has-gate-p
(function).
backend-metadata
(reader method).
(setf backend-metadata)
(writer method).
backend-name
(reader method).
(setf backend-name)
(writer method).
backend-node-p
(generic function).
backend-panic
(generic function).
backend-play-event
(generic function).
backend-proxys-node
(generic function).
backend-responds-p
(generic function).
backend-started-p
(reader method).
(setf backend-started-p)
(writer method).
backend-task-added
(generic function).
backend-task-removed
(generic function).
backend-tempo-change-at
(generic function).
backend-timestamps-for-event
(generic function).
event-backends
(function).
task-nodes
(function).
(setf task-nodes)
(function).
cl-patterns/render.lisp
backend.lisp
(file).
cl-patterns
(system).
*cl-patterns-temporary-directory*
(special variable).
render
(generic function).
find-backend-supporting-render
(function).
cl-patterns/clock.lisp
render.lisp
(file).
cl-patterns
(system).
beat
(reader method).
beat
(method).
(setf beat)
(writer method).
clock-caught-conditions
(function).
(setf clock-caught-conditions)
(function).
clock-condition-handler
(function).
(setf clock-condition-handler)
(function).
clock-latency
(function).
(setf clock-latency)
(function).
clock-loop
(function).
clock-process
(function).
clock-tasks
(function).
(setf clock-tasks)
(function).
end
(method).
loop-p
(method).
make-clock
(function).
pattern-tasks
(function).
playing-p
(method).
print-object
(method).
print-object
(method).
start-clock-loop
(function).
stop
(method).
task-pattern
(function).
tempo
(method).
tempo
(reader method).
(setf tempo)
(method).
absolute-beats-to-timestamp
(function).
can-swap-now-p
(function).
clock
(class).
clock-add
(function).
clock-clear-tasks
(function).
clock-process-event
(function).
clock-remove
(function).
event-with-raw-timing
(function).
real-beat
(method).
task
(class).
task-clock
(reader method).
(setf task-clock)
(writer method).
task-item
(reader method).
(setf task-item)
(writer method).
cl-patterns/extensions/sequence.lisp
clock.lisp
(file).
cl-patterns
(system).
Packages are listed by definition order.
cl-patterns
alexandria
.
common-lisp
.
mutility
.
*c4-midinote*
(special variable).
*cl-patterns-temporary-directory*
(special variable).
*clock*
(special variable).
*default-pattern-length*
(special variable).
*default-pattern-repeats*
(special variable).
*display-server*
(special variable).
*event*
(special variable).
*max-pattern-yield-length*
(special variable).
*note-names*
(special variable).
*post-pattern-output-processors*
(special variable).
*screen-size*
(special variable).
all-backend-types
(function).
all-backends
(function).
all-chords
(function).
all-instruments
(function).
all-patterns
(function).
all-pdef-names
(function).
all-pdefs
(function).
all-scales
(function).
all-tunings
(function).
amp
(generic function).
(setf amp)
(generic function).
amp-db
(function).
as-eseq
(generic function).
as-pstream
(generic function).
backend
(class).
backend-p
(function).
backend-start
(generic function).
backend-stop
(generic function).
beat
(generic function).
(setf beat)
(generic function).
bipolar-1-to-midi
(function).
bipolar-unipolar
(function).
bjorklund
(function).
bsubseq
(generic function).
chord
(generic function).
chord
(class).
chord-indexes
(generic function).
(setf chord-indexes)
(generic writer).
chord-midinotes
(function).
chord-name
(generic function).
(setf chord-name)
(generic writer).
chord-notes
(function).
chord-scale
(generic function).
(setf chord-scale)
(generic writer).
chromatic-index-degree
(function).
chromatic-index-freq
(function).
chromatic-index-midinote
(function).
chromatic-index-note
(function).
clock-caught-conditions
(function).
(setf clock-caught-conditions)
(function).
clock-condition-handler
(function).
(setf clock-condition-handler)
(function).
clock-latency
(function).
(setf clock-latency)
(function).
clock-loop
(function).
clock-process
(function).
clock-tasks
(function).
(setf clock-tasks)
(function).
combine-events
(function).
combine-events-via-lists
(function).
copy-event
(function).
cycles
(macro).
db
(generic function).
(setf db)
(generic function).
db-amp
(function).
define-chord
(function).
define-scale
(function).
define-tuning
(function).
defpattern
(macro).
degree-chromatic-index
(function).
degree-freq
(function).
degree-key
(function).
degree-midinote
(function).
degree-note
(function).
degree-octave
(function).
delta
(generic function).
(setf delta)
(generic function).
dur
(generic function).
(setf dur)
(generic function).
dur-freq
(function).
dur-time
(function).
e
(function).
(setf e)
(function).
enabled-backends
(function).
end
(generic function).
end-quant
(generic function).
(setf end-quant)
(generic function).
ended-p
(generic function).
eop
(special variable).
eop-p
(generic function).
eseq
(function).
eseq
(class).
eseq-add
(generic function).
eseq-events
(generic reader).
(setf eseq-events)
(generic function).
eseq-length
(function).
eseq-p
(function).
eseq-pstream
(class).
eseq-remove
(generic function).
event
(function).
event
(class).
event-equal
(function).
event-p
(function).
event-plist
(generic reader).
event-value
(function).
(setf event-value)
(function).
events-differing-keys
(function).
events-lists-differing-keys
(compiler macro).
events-lists-differing-keys
(function).
every-event-equal
(function).
find-backend
(function).
find-pdef
(function).
(setf find-pdef)
(function).
freq
(generic function).
(setf freq)
(generic function).
freq-chromatic-index
(function).
freq-degree
(function).
freq-dur
(function).
freq-midinote
(function).
freq-note
(function).
freq-octave
(function).
freq-rate
(function).
frequency-to-midi
(function).
instrument
(generic function).
(setf instrument)
(generic function).
instrument-mapping
(function).
(setf instrument-mapping)
(function).
ipstream
(function).
ipstream
(class).
ipstream-insert
(generic function).
ipstream-pstream
(class).
launch
(generic function).
legato
(generic function).
(setf legato)
(generic function).
load-scala-scale
(function).
loop-p
(generic function).
(setf loop-p)
(generic function).
make-backend
(generic function).
make-clock
(function).
midi-ratio
(function).
midi-truncate-clamp
(function).
midinote
(generic function).
(setf midinote)
(generic function).
midinote-chromatic-index
(function).
midinote-degree
(function).
midinote-freq
(function).
midinote-note
(function).
midinote-octave
(function).
midinote-rate
(function).
mouse-location
(function).
multi-channel-funcall
(function).
next
(generic function).
next-beat-for-quant
(function).
next-n
(function).
next-upto-n
(function).
note-chromatic-index
(function).
note-degree
(function).
note-freq
(function).
note-midinote
(function).
note-name-and-octave
(function).
note-octave
(function).
octave-degree
(function).
octave-freq
(function).
octave-midinote
(function).
octave-note
(function).
p*
(function).
p+
(function).
p-
(function).
p/
(function).
p/=
(function).
p<
(function).
p<=
(function).
p=
(function).
p>
(function).
p>=
(function).
paccum
(function).
paccum
(class).
paccum-pstream
(class).
paclump
(function).
paclump
(class).
paclump-pstream
(class).
pan
(generic function).
(setf pan)
(generic function).
parp
(function).
parp
(class).
parp-pstream
(class).
pattern
(method combination).
pattern
(class).
pattern-as-pstream
(function).
pattern-children
(function).
pattern-metadata
(generic function).
(setf pattern-metadata)
(function).
pattern-p
(function).
pattern-parent
(function).
pattern-source
(generic reader).
(setf pattern-source)
(generic writer).
pattern-tasks
(function).
pb
(macro).
pbeat
(function).
pbeat
(class).
pbeat*
(function).
pbeat*
(class).
pbeat*-pstream
(class).
pbeat-pstream
(class).
pbind
(function).
pbind
(class).
pbind-pstream
(class).
pbjorklund
(function).
pbjorklund
(class).
pbjorklund-pstream
(class).
pbrown
(function).
pbrown
(class).
pbrown-pstream
(class).
pchain
(function).
pchain
(class).
pchain-pstream
(class).
pclump
(function).
pclump
(class).
pclump-pstream
(class).
pcycles
(function).
pcycles
(class).
pcycles-pstream
(class).
pdef
(function).
pdef
(class).
pdef-name
(generic function).
(setf pdef-name)
(generic function).
pdef-p
(function).
pdef-pattern
(generic function).
(setf pdef-pattern)
(generic writer).
pdef-pstream
(generic function).
(setf pdef-pstream)
(generic function).
pdef-pstream
(class).
pdef-task
(generic function).
(setf pdef-task)
(generic writer).
pdelta
(function).
pdelta
(class).
pdelta-pstream
(class).
pdiff
(function).
pdiff
(class).
pdiff-pstream
(class).
pdrop
(function).
pdrop
(class).
pdrop-pstream
(class).
pdurstutter
(function).
pdurstutter
(class).
pdurstutter-pstream
(class).
peek
(generic function).
peek-n
(function).
peek-upto-n
(function).
peql
(function).
pexprand
(function).
pexprand
(class).
pexprand-pstream
(class).
pf
(macro).
pfilter
(function).
pfilter
(class).
pfilter-out
(function).
pfilter-pstream
(class).
pfin
(function).
pfin
(class).
pfin-pstream
(class).
pfindur
(function).
pfindur
(class).
pfindur-pstream
(class).
pfunc
(function).
pfunc
(class).
pfunc-pstream
(class).
pgauss
(function).
pgauss
(class).
pgauss-pstream
(class).
pgeom
(function).
pgeom
(class).
pgeom*
(function).
pgeom-pstream
(class).
phistory
(function).
phistory
(class).
phistory-pstream
(class).
pif
(function).
pif
(class).
pif-pstream
(class).
pindex
(function).
pindex
(class).
pindex-pstream
(class).
pk
(function).
pk
(class).
pk-pstream
(class).
place
(function).
place
(class).
place-pstream
(class).
play
(generic function).
play-or-end
(function).
play-or-stop
(function).
play-quant
(generic function).
(setf play-quant)
(generic function).
play-solo
(function).
play-swap
(function).
playing-nodes
(function).
playing-p
(generic function).
playing-pdef-names
(function).
playing-pdefs
(function).
plazy
(function).
plazy
(class).
plazy-pstream
(class).
pmeta
(function).
pmeta
(class).
pmeta-pstream
(class).
pmono
(function).
pmouse
(function).
pmouse
(class).
pmouse-pstream
(class).
pmousex
(function).
pmousey
(function).
pn
(function).
pn
(class).
pn-pstream
(class).
pnary
(function).
pnary
(class).
pnary-pstream
(class).
ppar
(function).
ppar
(class).
ppar-pstream
(class).
pparchain
(function).
pparchain
(class).
pparchain-pstream
(class).
ppatlace
(function).
ppatlace
(class).
ppatlace-pstream
(class).
ppc
(macro).
pr
(function).
pr
(class).
pr-pstream
(class).
prand
(function).
prand
(class).
prand-pstream
(class).
prerange
(function).
prerange
(class).
prerange-pstream
(class).
prest
(function).
prest
(class).
protate
(function).
protate
(class).
protate-pstream
(class).
prs
(function).
prun
(function).
prun
(class).
prun-pstream
(class).
ps
(function).
ps
(class).
ps-pstream
(class).
pscratch
(function).
pscratch
(class).
pscratch-pstream
(class).
pseq
(function).
pseq
(class).
pseq-pstream
(class).
pser
(function).
pser
(class).
pser-pstream
(class).
pseries
(function).
pseries
(class).
pseries*
(function).
pseries-pstream
(class).
pshuf
(function).
pshuf
(class).
pshuf-pstream
(class).
pslide
(function).
pslide
(class).
pslide-pstream
(class).
pstream
(class).
pstream-count
(generic reader).
(setf pstream-count)
(generic writer).
pstream-elt
(function).
pstream-elt-future
(function).
pstream-p
(function).
psym
(function).
psym
(class).
psym-pstream
(class).
psync
(function).
psync
(class).
psync-pstream
(class).
pt
(macro).
ptime
(function).
ptime
(class).
ptime-pstream
(class).
ptrace
(function).
ptrace
(class).
ptrace-pstream
(class).
ptrack
(function).
ptrack
(class).
ptrack-cell
(generic function).
(setf ptrack-cell)
(generic function).
ptrack-pstream
(class).
ptrack-row
(generic function).
(setf ptrack-row)
(generic function).
ptrack-rows
(generic function).
pts
(function).
pts
(class).
pts-pstream
(class).
pwalk
(function).
pwalk
(class).
pwalk-pstream
(class).
pwhite
(function).
pwhite
(class).
pwhite-pstream
(class).
pwrand
(function).
pwrand
(class).
pwrand-pstream
(class).
pwrap
(function).
pwxrand
(function).
pwxrand
(class).
pwxrand-pstream
(class).
pxrand
(function).
pxrand
(class).
pxrand-pstream
(class).
pyramid
(function).
quant
(generic function).
(setf quant)
(generic function).
rate
(generic function).
(setf rate)
(generic function).
rate-freq
(function).
rate-midinote
(function).
ratio-midi
(function).
remove-event-value
(function).
render
(generic function).
rerange
(function).
rest-p
(generic function).
(setf rest-p)
(generic function).
scale
(generic function).
(setf scale)
(generic function).
scale
(class).
scale-midinotes
(function).
scale-name
(generic function).
(setf scale-name)
(generic writer).
scale-notes
(generic function).
(setf scale-notes)
(generic writer).
scale-steps-per-octave
(generic function).
scale-tuning
(generic function).
(setf scale-tuning)
(generic writer).
screen-size
(function).
split-event-by-lists
(function).
start-clock-loop
(function).
stop
(generic function).
sustain
(generic function).
(setf sustain)
(generic function).
t-pstream
(function).
t-pstream
(class).
t-pstream-length
(generic reader).
(setf t-pstream-length)
(generic writer).
t-pstream-p
(function).
t-pstream-value
(generic reader).
(setf t-pstream-value)
(generic writer).
task-pattern
(function).
tempo
(generic function).
(setf tempo)
(generic function).
time-dur
(function).
tone-matrix
(function).
transpose
(function).
tuning
(generic function).
tuning
(class).
tuning-name
(generic function).
(setf tuning-name)
(generic writer).
tuning-octave-ratio
(generic function).
(setf tuning-octave-ratio)
(generic writer).
tuning-pitches
(generic function).
(setf tuning-pitches)
(generic writer).
tuning-steps-per-octave
(generic function).
unipolar-1-to-midi
(function).
unipolar-bipolar
(function).
%beat
(generic reader).
(setf %beat)
(function).
%pattern-children
(generic function).
*abbreviations*
(special variable).
*backends*
(special variable).
*chords*
(special variable).
*conversions*
(special variable).
*deprecated-function-error-events-lists-differing-keys-notified-p*
(special variable).
*dictionary-lookup-functions*
(special variable).
*event-special-keys*
(special variable).
*instrument-map*
(special variable).
*pattern-function-translations*
(special variable).
*patterns*
(special variable).
*pbind-special-init-keys*
(special variable).
*pbind-special-process-keys*
(special variable).
*pbind-special-wrap-keys*
(special variable).
*pdef-dictionary*
(special variable).
*scales*
(special variable).
*tunings*
(special variable).
absolute-beats-to-timestamp
(function).
backend-all-instruments
(generic function).
backend-all-nodes
(generic function).
backend-control-node-at
(generic function).
backend-convert-object
(generic function).
backend-enabled-p
(generic reader).
(setf backend-enabled-p)
(generic writer).
backend-input-processors
(generic reader).
(setf backend-input-processors)
(generic writer).
backend-instrument-args-list
(generic function).
backend-instrument-controls
(generic function).
backend-instrument-has-gate-p
(function).
backend-metadata
(generic reader).
(setf backend-metadata)
(generic writer).
backend-name
(generic reader).
(setf backend-name)
(generic writer).
backend-node-p
(generic function).
backend-panic
(generic function).
backend-play-event
(generic function).
backend-proxys-node
(generic function).
backend-responds-p
(generic function).
backend-started-p
(generic reader).
(setf backend-started-p)
(generic writer).
backend-task-added
(generic function).
backend-task-removed
(generic function).
backend-tempo-change-at
(generic function).
backend-timestamps-for-event
(generic function).
boolean-to-midi
(function).
can-swap-now-p
(function).
clock
(class).
clock-add
(function).
clock-clear-tasks
(function).
clock-process-event
(function).
clock-remove
(function).
cumulative-list
(function).
cycles-parse
(function).
decf-remaining
(function).
defconversion
(macro).
define-event-special-key
(macro).
define-pattern-function-translation
(macro).
define-pbind-special-init-key
(macro).
define-pbind-special-process-key
(macro).
define-pbind-special-wrap-key
(macro).
end-condition
(generic reader).
(setf end-condition)
(generic writer).
event-backends
(function).
event-with-raw-timing
(function).
events-in-range
(generic function).
find-backend-supporting-render
(function).
find-buffer-symbol
(function).
find-object-by-id
(function).
from-range
(function).
generate-aliases
(function).
index-and-offset
(function).
index-of-greater-than
(function).
last-dur
(generic function).
last-output
(generic function).
make-default-event
(function).
make-pattern-for-function
(function).
mapcar-longest
(function).
mouse-location*
(generic function).
near-p
(function).
nearest
(function).
next.events-ordered
(generic function).
normalized-sum
(function).
pattern-pstream-class-name
(function).
pattern-translate-sexp
(function).
pb-translate-body-functions
(function).
pbind-pairs
(generic reader).
(setf pbind-pairs)
(generic writer).
pcycles-parse-list
(function).
pdef-names
(function).
plist-set
(function).
pmeta-ensure-pattern-value
(function).
process-pattern-key-value
(generic function).
pstream-elt-index
(generic reader).
pstream-elt-index-to-history-index
(function).
pstream-history-advance-by
(function).
pstream-out-of-range
(condition).
ptrack-does-not-exist
(function).
raw-event-value
(function).
(setf raw-event-value)
(function).
real-beat
(generic function).
remaining-p
(function).
remap-instrument-to-parameters
(function).
screen-size*
(generic function).
set-parents
(function).
sharp-or-flat
(function).
string-reader
(function).
string-replace
(function).
t-short
(function).
task
(class).
task-clock
(generic reader).
(setf task-clock)
(generic writer).
task-item
(generic reader).
(setf task-item)
(generic writer).
task-nodes
(function).
(setf task-nodes)
(function).
to-range
(function).
track-shorthand
(function).
value-remaining-p
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The MIDI note number of note C, octave 4. This sets the global tuning of the various pitch conversion functions.
The default directory to store ‘render’ed files in.
The default clock to run tasks on.
The default value of a pattern’s LENGTH parameter.
The default value of a pattern’s REPEATS parameter.
The display server type that ‘mouse-location’ should default to. Attempts to auto-detect the correct display server on load.
The event special variable. Can be referenced inside a pattern’s code.
The default maximum number of events or values that will be used by functions like ‘next-n’ or patterns like ‘protate’, in order to prevent hangs caused by infinite-length patterns.
List of note names in the equal temperament 12-tone tuning.
List of functions that are applied as the last step of pattern output generation. Each output yielded by an "outermost" pattern (i.e. one without a ‘pattern-parent’) will be processed (along with the pstream as a second argument) through each function in this list, allowing for arbitrary transformations of the generated outputs. The return value of each function is used as the input to the next function, and the return value of the last function is used as the output yielded by the pattern.
This can be used, for example, to implement mappings from friendly instrument names to the full parameters needed to specify the instrument in question for backends such as MIDI which require it; in fact this feature is already implemented more conveniently with the setf-able ‘instrument-mapping’ function.
See also: ‘*instrument-map*’, ‘remap-instrument-to-parameters’
The combined size of all monitors plugged into the machine that cl-patterns is running on. If you add or remove displays after loading cl-patterns, you may have to update this variable. To set the correct value, run (setf *screen-size* (screen-size)).
See also: ‘*display-server*’, ‘screen-size’, ‘mouse-location’, ‘pmouse’
End Of Pattern; the symbol yielded by patterns after their last output.
Convenience macro to specify a rhythm or melody using symbols. Outputs a list of events with :type, :dur, and another parameter which is specifiable. Usually used to :embed into a pattern.
SPEC is a symbol representing the type of output you’re going to send. It can be midinote, freq, note, instrument, or buffer/bufnum. It can also be a list, which provides the spec as the first element, and keywords (such as :dur for the total dur) for the rest.
MAP is a plist specifying the mapping from symbols to SPEC’s parameter. It can be blank if you’re just making a melody. By default, the map includes keys that map - and _ to rests.
LIST is the actual pattern to generate.
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 :initform key as usual, and you can set a slot as a state slot (which only appears in the pattern’s pstream class) by setting the :state key to t.
DOCUMENTATION is a docstring describing the pattern. We recommend providing at least one example, and a "See also" section to refer to similar pattern classes.
DEFUN can either be a full defun form for the pattern, or an expression which will be inserted into the pattern creation function prior to initialization of the instance. Typically you’d use this for inserting ‘assert’ statements, for example.
See also: ‘pattern’, ‘pdef’, ‘all-patterns’
pb is a convenience macro, wrapping the functionality of ‘pbind’ and ‘pdef’ while also providing additional syntax sugar. NAME 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’.
The expressions in PAIRS are also automatically translated to equivalent patterns if applicable; for example:
;; (pb :foo :bar (+ (pseries) (pseq (list -1 0 1))))
...is the same as:
;; (pb :foo :bar (p+ (pseries) (pseq (list -1 0 1))))
See also: ‘pbind’, ‘pdef’
Convenience macro for ‘pfunc’ that automatically wraps BODY in a lambda.
Syntax sugar for ‘pparchain’ that automatically splits PAIRS by :- symbols.
Example:
;; (ppc :foo (pseq (list 1 2 3) 1)
;; :-
;; :bar (p+ (pk :foo) 2))
;; ;=> (((EVENT :FOO 1) (EVENT :FOO 1 :BAR 3))
;; ((EVENT :FOO 2) (EVENT :FOO 2 :BAR 4))
;; ((EVENT :FOO 3) (EVENT :FOO 3 :BAR 5)))
See also: ‘pparchain’
Syntax sugar for ‘ptrack’. Avoids the need to quote or use ‘list’.
Example:
;; (pt (:foo 1 :bar (pseries) :dur 1/4)
;; (2) ; (:foo 2 :bar 0 :dur 1/4)
;; () ; (:foo 1 :bar 1 :dur 1/4)
;; (9 :bar 90) ; (:foo 9 :bar 90 :dur 1/2)
;; (-) ; extends the previous note by 1/4 beat
;; :r ; (:foo 1 :bar 4 :dur 1/4 :type :rest)
;; )
See also: ‘ptrack’
Get a list of names of all defined backend types. A backend type is any class that inherits from ‘backend’.
See also: ‘all-backends’, ‘enabled-backends’
Get a list of all backends made with ‘make-backend’ or ‘backend-start’. ENABLED-P and STARTED-P can be used to limit the results only to backends with matching status.
See also: ‘all-backend-types’, ‘enabled-backends’
Get a list of all defined chords.
Get a list of the names of all instruments defined for BACKEND, or all enabled backends if none specified.
See also: ‘playing-nodes’, ‘all-patterns’, ‘all-pdefs’, ‘enabled-backends’
Get a list of the names of all defined pattern classes.
See also: ‘all-pdefs’
Get a list of the names of all defined pdef objects.
See also: ‘all-pdefs’, ‘pdef-names’
Get a list of all defined pdef objects in DICTIONARY. With PACKAGE, get only pdefs whose name is a symbol in that package.
See also: ‘all-pdef-names’, ‘pdef-names’, ‘find-pdef’
Get a list of all defined scales.
Get a list of all defined tunings.
Convert amplitude to decibels.
Test whether OBJECT is a ‘backend’.
See also: ‘find-backend’, ‘all-backends’
Convert the range -1..1 to 0..127.
Convert a bipolar number (-1 to 1) to a unipolar number (0 to 1).
See also: ‘unipolar-bipolar’
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’
Get a list of the midi note numbers in the specified chord.
Return a list consisting of the note numbers for CHORD.
Get the degree of CHROMATIC-INDEX.
Get the frequency of CHROMATIC-INDEX.
Get the midinote of CHROMATIC-INDEX.
Get the note of CHROMATIC-INDEX.
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".
A list of conditions caught by the clock while processing tasks when its condition-handler is non-nil. Each entry in the list is a plist containing the the condition and the stack trace.
See also: ‘clock-condition-handler’
The restart to invoke when a condition occurs during task processing. If nil, the clock will not attempt to handle any conditions. If non-nil, all conditions signaled within a task will be caught and the specified restart will be invoked automatically to prevent the clock from pausing. Caught conditions will be printed as a warning and recorded with their stack trace in the clock’s caught-conditions slot.
See also: ‘clock-caught-conditions’
The default latency for events played on the clock; the number of seconds added onto the event’s scheduled time, in order to allow the backend to process it without being "late".
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’
Process tasks on CLOCK for the next BEATS beats.
See also: ‘clock-loop’, ‘clock-tasks’, ‘make-clock’
Get a list of all tasks running on CLOCK.
See also: ‘pattern-tasks’
Get a new event that inserts all the items in each event of EVENTS. Keys from the events listed first will be overwritten by later events.
See also: ‘copy-event’, ‘split-event-by-lists’, ‘combine-events-via-lists’
Combine EVENTS together to produce one event. Any keys that differ between the events will have be set to lists containing all the values from each event (unless the value is null). This is the opposite of ‘split-event-by-lists’.
Example:
;; (combine-events-via-lists (event :foo 1 :bar 2 :qux 4) (event :foo 1 :bar 3 :baz 5))
;; => (EVENT :FOO 1 :BAR (2 3) :QUX 4 :BAZ 5)
See also: ‘split-event-by-lists’, ‘combine-events’
Get a new event that is a copy of EVENT.
See also: ‘combine-events’
Convert decibels to amplitude.
Define a musical chord.
See also: ‘scale’, ‘define-tuning’, ‘define-scale’
Define a musical scale.
See also: ‘scale’, ‘define-tuning’, ‘define-chord’
Define a musical tuning.
See also: ‘tuning’, ‘define-scale’, ‘define-chord’
Get the chromatic index of DEGREE.
Get the frequency of DEGREE, based on the ROOT, OCTAVE, and SCALE, if provided.
Get the note in SCALE at the index DEGREE, possibly overriding STEPS-PER-OCTAVE.
Get the midi note number of DEGREE, taking into account the ROOT, OCTAVE, and SCALE, if provided.
Get the note number of DEGREE in SCALE.
Get the octave of DEGREE.
Convert DUR in beats to frequency in Hz according to TEMPO in beats per second.
Convert DUR in beats to time in seconds according to TEMPO in beats per second.
Syntax sugar; like ‘event-value’, but always gets the value from ‘*event*’.
See also: ‘event-value’, ‘event’, ‘*event*’
Get a list of all enabled backends.
See also: ‘all-backends’, ‘backend-enabled-p’
Create an eseq containing the specified events and metadata.
Get the number of events in ESEQ.
True if OBJECT is an eseq.
See also: ‘eseq’
Create an event, using the PARAMS as its keys/values.
See also: ‘event-value’, ‘event-p’, ‘e’, ‘*event*’
Test if EVENT-1 and EVENT-2 are equivalent.
See also: ‘every-event-equal’
True if OBJECT is an event.
See also: ‘event’, ‘event-value’
Get the value of KEY in EVENT, running any necessary conversion functions.
Returns 2 values: the value of the key, and the name of the key the value was derived from (or t if the default value of the key was used, or nil if no value or default was provided).
See also: ‘event’, ‘e’, ‘raw-event-value’
Set the value of KEY to VALUE in EVENT, running any conversion functions that exist.
Get a list of keys that differ between EVENTS.
See also: ‘every-event-equal’
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’
Test if all the events in LISTS are equivalent. Like (every #’event-equal LIST-1 LIST-2 ...) but returns false if the lists are not the same length.
See also: ‘event-equal’, ‘events-differing-keys’
Find a registered backend whose name or type matches BACKEND. With ENABLED-P, only search through currently enabled backends.
See also: ‘all-backends’, ‘enabled-backends’
Get the object named NAME in the pdef dictionary. If ERRORP is true, signals an error when NAME isn’t found in the dictionary. Returns t or nil as a second value showing whether the symbol was found.
See also: ‘pdef-p’, ‘all-pdefs’, ‘all-pdef-names’
Get the chromatic index of FREQ.
Convert a frequency to a scale degree.
Convert FREQ in Hz to duration in beats according to TEMPO in beats per second.
Convert a frequency to a midi note number.
Get the note for the frequency provided.
Get the octave number that the frequency FREQ occurs in.
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.
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.
Get a mapping from INSTRUMENT (an instrument name as a string or symbol) to a plist of parameters which should be set in the event by ‘remap-instrument-to-parameters’.
See also: ‘remap-instrument-to-parameters’, ‘*instrument-map*’
Set a mapping from INSTRUMENT (an instrument name as a string or symbol) to a plist of parameters which will be set in the event by ‘remap-instrument-to-parameters’. Setting an instrument to nil with this function removes it from the map.
See also: ‘instrument-mapping’, ‘remap-instrument-to-parameters’, ‘*instrument-map*’
Insertable pstream; a pstream that can be changed while it’s running by inserting new patterns at a specified beat.
Load a Scala (.scl) scale file and define a tuning and scale from it.
Note that Scala refers to these as "scales" but in cl-patterns they are known as tunings.
Create a clock with a tempo of TEMPO in beats per second (Hz).
To start the clock so that it begins processing its tasks in a new thread, you can use ‘start-clock-loop’. Alternatively, you can call ‘clock-loop’ yourself to start the loop in the current thread. The clock can also be advanced manually an arbitrary number of beats at a time with the ‘clock-process’ function.
See also: ‘clock-process’, ‘clock-loop’, ‘start-clock-loop’
Convert a MIDI note number difference to a frequency ratio.
Truncate NUMBER and clamp it to the range 0..MAX (default 127).
Get the chromatic index of MIDINOTE.
Get the degree of MIDINOTE, taking into account the ROOT, OCTAVE, and SCALE, if provided.
Convert a midi note number to a frequency.
Get the note name of MIDINOTE.
Get the octave number that MIDINOTE occurs in.
Convert a midinote to a playback rate.
Get a plist of the mouse location, total display size, and other information gleaned about DISPLAY-SERVER. DISPLAY-SERVER can be :x, :wayland, etc, but should default to the correct display server detected when cl-patterns is loaded. Will signal an error if the information cannot be determined (i.e. when the display server is not detected or not supported).
NOTE: This is currently only implemented on X-based systems, so will not work on Windows, MacOS, and Wayland.
Call FUNCTION on the provided arguments. If one or more of the arguments is a list, funcall for each element of the list(s). The length of the resulting list will be the same as the longest input list.
Example:
;; (multi-channel-funcall #’+ 1 (list 1 2 3))
;; => (2 3 4)
See also: ‘mapcar-longest’, ‘split-event-by-lists’
Get the next valid beat for QUANT after BEAT. If DIRECTION is negative, finds the previous valid beat for QUANT.
See also: ‘quant’
Get the next N outputs of a pstream, function, or other object, advancing the pstream forward N times in the process.
See also: ‘next’, ‘next-upto-n’, ‘peek’, ‘peek-n’
Get a list of up to N results from PSTREAM, not including the end of pattern.
See also: ‘next’, ‘next-n’, ‘peek’, ‘peek-upto-n’
Get the chromatic index of NOTE.
Get the degree of a note in the provided scale. If the note is not in the provided scale, truncate to the nearest note that is.
Given a note, return its frequency in hertz, taking into account the ROOT and OCTAVE if provided.
See also: ‘note-midinote’
Given a note, return its midi note number, taking into account the OCTAVE if provided.
See also: ‘note-freq’
Given a note name, return a list consisting of its note number and its octave (defaulting to 4 if it’s not specified).
Examples:
;; (note-name-and-octave :c4) ;=> (:C 4)
;; (note-name-and-octave :a#7) ;=> (:A# 7)
;; (note-name-and-octave :c-1) ;=> (:C -1)
;; (note-name-and-octave :d) ;=> (:D 4)
See also: ‘note-midinote’, ‘chromatic-index-note’
Get the octave of NOTE.
Get the degree of OCTAVE.
Get the base frequency of OCTAVE.
Get the base (lowest) midi note number for OCTAVE.
Get the note of OCTAVE.
Syntax sugar for (pnary #’* ...).
See also: ‘pnary’, ‘common-lisp:*’
Syntax sugar for (pnary #’+ ...).
See also: ‘pnary’, ‘common-lisp:+’
Syntax sugar for (pnary #’- ...).
See also: ‘pnary’, ‘common-lisp:-’
Syntax sugar for (pnary #’/ ...).
See also: ‘pnary’, ‘common-lisp:/’
Syntax sugar for (pnary #’/= ...).
See also: ‘pnary’, ‘common-lisp:/=’
Syntax sugar for (pnary #’< ...).
See also: ‘pnary’, ‘common-lisp:<’
Syntax sugar for (pnary #’<= ...).
See also: ‘pnary’, ‘common-lisp:<=’
Syntax sugar for (pnary #’= ...).
See also: ‘pnary’, ‘common-lisp:=’
Syntax sugar for (pnary #’> ...).
See also: ‘pnary’, ‘common-lisp:>’
Syntax sugar for (pnary #’>= ...).
See also: ‘pnary’, ‘common-lisp:>=’
Numeric accumulator. Each output and STEP is used as the input for OPERATOR to generate the next output. When LO, HI, and BOUND-BY are provided, outputs that fall outside the range LO..HI are wrapped back inside with the BOUND-BY function; the value is provided as its first argument, and LO and HI are provided as its second and third.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-upto-n (paccum #’+ 0 1) 5) ; same as (pseries 0 1)
;; ;=> (0 1 2 3 4)
;; (next-upto-n (paccum #’+ 0 1 :inf :lo 0 :hi 3 :bound-by #’wrap) 9) ; same as above, wrapping between 0 and 3.
;; ;=> (0 1 2 0 1 2 0 1 2)
See also: ‘pseries’, ‘pgeom’, ‘pwalk’
Automatically group outputs of the source pattern into lists of up to N items each. Unlike ‘pclump’, clump size is automatically set to the length of the longest list in the values of ‘*event*’, or 1 if there are no lists.
Example:
;; (next-upto-n (pbind :foo (pseq ’((1) (1 2) (1 2 3)) 1) :bar (paclump (pseries))))
;; ;=> ((EVENT :FOO (1) :BAR (0)) (EVENT :FOO (1 2) :BAR (1 2)) (EVENT :FOO (1 2 3) :BAR (3 4 5)))
See also: ‘pclump’
Arpeggiator pattern; each event yielded by PATTERN is bound to ‘*event*’ and then the entirety of the ARPEGGIATOR pattern is yielded.
Example:
;; (next-upto-n (parp (pbind :foo (pseq ’(1 2 3) 1))
;; (pbind :bar (pseq ’(4 5 6) 1))))
;; ;=> ((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’, ‘pr’
Like ‘as-pstream’, but only converts THING to a pstream if it is a pattern.
Get a list of all the direct child patterns of PATTERN, including any in slots or lists.
See also: ‘pattern-parent’
True if OBJECT is a pattern.
See also: ‘pattern’, ‘defpattern’
Get the NUM-th containing pattern of PATTERN, or nil if there isn’t one. If CLASS is specified, only consider patterns of that class.
See also: ‘pattern-children’
Attempt to get the tasks on CLOCK that are playing PATTERN.
See also: ‘task-pattern’, ‘clock-tasks’
Yield the number of beats elapsed since the pbeat was embedded in the pstream.
Example:
;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 2 :FOO 1) (EVENT :DUR 3 :FOO 3))
See also: ‘pbeat*’, ‘beat’, ‘prun’
Yield the number of beats on the ‘*clock*’ of the current pattern. In other words, pbeat* is clock-synced, unlike ‘pbeat’, which is pattern-synced.
Example:
;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat*)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 200) (EVENT :DUR 2 :FOO 201) (EVENT :DUR 3 :FOO 203))
See also: ‘pbeat’, ‘beat’, ‘prun’
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) EOP)
See also: ‘pmono’, ‘pb’
pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, and STEPS is number of steps in the sequence. Additionally, OFFSET is the number to rotate the sequence by, DUR is the total duration one repeat of the sequence should be, and REPEATS is the number of repeats that should be yielded. This pattern outputs events which can be embedded into another pattern. Each pulse is a note, and each subdivision of the sequence that is not a pulse is a rest. If you just want the raw output from the Bjorklund algorithm (not in pattern form), use ‘bjorklund’ instead.
Example:
;; (next-upto-n (pbjorklund 3 7))
;; => ((EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7))
See also: ‘bjorklund’
Brownian motion within a range; each output randomly a maximum of STEP away from the previous. LO and HI define the lower and upper bounds of the range. STEP defaults to 1 if LO and HI are integers.
Example:
;; (next-upto-n (pbrown 0 10 1 10))
;; ;=> (2 3 3 3 4 3 4 5 6 5)
See also: ‘pwhite’, ‘pexprand’, ‘pgauss’
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
Group outputs of the source pattern into lists of up to N items each.
Example:
;; (next-upto-n (pclump (pseries 0 1 5) 2))
;; ;=> ((0 1) (2 3) (4))
See also: ‘paclump’
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.
Define a named pattern, with NAME being the name of the pattern and PATTERN the pattern itself. Named patterns are stored in a global dictionary and can be referred back to by calling ‘pdef’ without supplying PATTERN. The global dictionary also keeps track of the pdef’s pstream when ‘play’ is called on it. If a pdef is redefined while it is being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘end-quant’ time is reached (if non-nil). Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).
Example:
;; (pdef :foo (pbind :degree (pseries 0 1 4)))
;;
;; (play (pdef :foo))
;; ;; redefine the pdef’s pattern... note that the redefinition doesn’t become audible until the current loop finishes playing:
;; (pdef :foo (pbind :degree (pseries 4 -1 4)))
See also: ‘find-pdef’, ‘all-pdefs’, ‘pb’, ‘pmeta’, ‘ps’
Test whether OBJECT is a pdef.
See also: ‘find-pdef’
Output the difference between successive outputs of PATTERN, assuming PATTERN restarts every CYCLE outputs.
Unlike ‘pdiff’, pdelta is written with its use as input for ‘pbind”s :delta key in mind. If PATTERN’s successive values would result in a negative difference, pdelta instead wraps the delta around to the next multiple of CYCLE. This would allow you to, for example, supply the number of the beat that each event occurs on, rather than specifying the delta between each event. This is of course achievable using pbind’s :beat key as well, however that method requires the pbind to peek at future values, which is not always desirable.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-n (pdelta (pseq ’(0 1 2 3)) 4) 8)
;;
;; ;=> (1 1 1 1 1 1 1 1)
;;
;; (next-n (pdelta (pseq ’(0 1 2 5)) 4) 8)
;;
;; ;=> (1 1 3 3 1 1 3 3)
See also: ‘pdiff’, ‘pbind”s :beat key
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’
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: ‘protate’
Yield each output from PATTERN N times, dividing it by N. If the output from PATTERN is an event, its dur is divided; if it’s a number, the number itself is divided instead of being yielded directly.
Example:
;; (next-n (pdurstutter (pseq ’(1 2 3 4 5)) (pseq ’(3 2 1 0 2))) 9)
;; ;=> (1/3 1/3 1/3 1 1 3 5/2 5/2 NIL)
;;
;; (next-n (pdurstutter (pbind :dur (pseq ’(1 2 3 4 5)))
;; (pseq ’(3 2 1 0 2)))
;; 9)
;; ;=> ((EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1) (EVENT :DUR 1) (EVENT :DUR 3) (EVENT :DUR 5/2) (EVENT :DUR 5/2) NIL)
See also: ‘pr’
Peek at the next N results of a pstream, without advancing it forward in the process.
See also: ‘peek’, ‘peek-upto-n’, ‘next’, ‘next-n’
Peek at up to the next N results of a pstream, without advancing it forward in the process.
See also: ‘peek’, ‘peek-n’, ‘next’, ‘next-upto-n’
Syntax sugar for (pnary #’eql ...).
See also: ‘pnary’, ‘common-lisp:eql’
Exponentially-distributed random numbers between LO and HI. Note that LO and HI cannot be 0, and that LO and HI must have the same sign or else complex numbers will be output.
Example:
;; (next-upto-n (pexprand 1.0 8.0 4))
;; ;=> (1.0420843091865208d0 1.9340168112124456d0 2.173209129035095d0 4.501371557329618d0)
See also: ‘pwhite’, ‘pbrown’, ‘pgauss’, ‘prand’
Skip elements of a source pattern that PREDICATE returns false for. If PREDICATE is not a function, skip items that are ‘eql’ to it.
Example:
;; (next-n (pfilter (pseq (list 1 2 3))
;; 2)
;; 6)
;; ;=> (1 3 1 3 1 3)
;; (next-n (pfilter (pseries 0 1) ’evenp)
;; 6)
;; ;=> (1 3 5 7 9 11)
See also: ‘pfilter-out’, ‘pr’, ‘pdurstutter’
Skip elements of a source pattern that PREDICATE returns true for. If PREDICATE is not a function, skip items that are ‘eql’ to it.
See also: ‘pfilter’
Yield up to COUNT outputs from PATTERN.
Example:
;; (next-n (pfin (pseq ’(1 2 3) :inf) 3) 5)
;; ;=> (1 2 3 NIL NIL)
See also: ‘pfindur’
Yield events from PATTERN until their total duration is within TOLERANCE of DUR, or greater than DUR. Any events that would end beyond DUR are cut short. If PATTERN outputs numbers, their total sum is limited instead.
Example:
;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) EOP)
;;
;; (next-upto-n (pfindur (pwhite 0 4) 16))
;; ;=> (1 3 0 1 2 2 1 3 0 1 2)
;; (reduce #’+ *)
;; ;=> 16
See also: ‘pfin’, ‘psync’
Yield the result of evaluating FUNC. Note that the current event of the parent pattern is still accessible via the ‘*event*’ special variable.
Example:
;; (next-upto-n (pfunc (lambda () (random 10)) 4))
;; ;=> ((5 2 8 9))
;;
;; (next-upto-n (pbind :foo (pwhite 0 10 4)
;; :bar (pfunc (lambda ()
;; (if (> (event-value *event* :foo) 5) :greater :lesser)))))
;; ;=> ((EVENT :FOO 0 :BAR :LESSER) (EVENT :FOO 6 :BAR :GREATER)
;; (EVENT :FOO 7 :BAR :GREATER) (EVENT :FOO 8 :BAR :GREATER))
See also: ‘pf’, ‘pnary’, ‘plazy’, ‘pif’
Random numbers distributed along a normal (gaussian) curve. MEAN is the "center" of the distribution, DEVIATION is the standard deviation (i.e. the higher the value, the further the outputs are spread from MEAN).
Example:
;; (next-n (pgauss) 4)
;; ;=> (0.08918811646370092d0 0.1745957067161632d0 0.7954678768273173d0 -1.2215823449671597d0)
See also: ‘pwhite’, ‘pexprand’, ‘pbrown’
Yield START, then generate subsequent outputs by multiplying by GROW, for a total of LENGTH outputs.
Example:
;; (next-upto-n (pgeom 1 2 4))
;; ;=> (1 2 4 8)
See also: ‘pseries’, ‘paccum’
Syntax sugar to generate a ‘pgeom’ whose values go from START to END exponentially over LENGTH steps. LENGTH cannot be infinite since delta calculation requires dividing by it.
Based on the Pgeom extension from the ddwPatterns SuperCollider library.
Example:
;; (pgeom* 1 100 8)
;; ;=> (pgeom 1 1.9306977 8)
;;
;; (next-upto-n *)
;; ;=> (1 1.9306977 3.7275934 7.196856 13.894953 26.826954 51.79474 99.999985)
;; ;; Note that due to floating point rounding errors the last output may not always be exactly END.
See also: ‘pgeom’, ‘pseries’, ‘pseries*’
Refer back to PATTERN’s history, yielding the output at the index provided by STEP-PATTERN.
Note that PATTERN is still advanced once per event, and if STEP-PATTERN yields a number pointing to an event in PATTERN that hasn’t been yielded yet (i.e. if PATTERN has only advanced once but STEP-PATTERN yields 3 for its output), phistory yields nil.
Example:
;; (next-n (phistory (pseries) (pseq ’(0 2 1))) 3)
;; ;=> (0 NIL 1)
See also: ‘pscratch’
"If" expression for patterns. TEST is evaluated for each step, and if it’s non-nil, the value of TRUE will be yielded, otherwise the value of FALSE will be. Note that TRUE and FALSE can be patterns, and if they are, they are only advanced in their respective cases, not for every step.
Example:
;; (next-n (pif (pseq ’(t t nil nil nil)) (pseq ’(1 2 3)) (pseq ’(9 8 7))) 8)
;; ;=> (1 2 9 8 7 3 1 9)
See also: ‘plazy’, ‘pfunc’
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’
Yield the value of KEY in the current ‘*event*’ context, returning DEFAULT if that value is nil.
Example:
;; (next-upto-n (pbind :foo (pseq ’(1 2 3) 1) :bar (pk :foo)))
;; ;=> ((EVENT :FOO 1 :BAR 1) (EVENT :FOO 2 :BAR 2) (EVENT :FOO 3 :BAR 3))
See also: ‘pbind’, ‘event-value’, ‘*event*’
Yield each value from LIST in sequence. If the value is a list, the first element of that list is yielded. The second time that sub-list is encountered, its second element will be yielded; the third time, the third element, and so on. REPEATS controls the number of times LIST is repeated.
Example:
;; (next-upto-n (place (list 1 2 (list 3 4 5)) 3))
;; ;=> (1 2 3 1 2 4 1 2 5)
See also: ‘ppatlace’
‘play’ an object, or ‘end’ it if it’s already playing. Returns the task if the object will start playing, or NIL if it will end.
‘play’ an object, or ‘stop’ it if it is already playing. Returns the task if the object will start playing, or NIL if it will stop.
End or stop all tasks on CLOCK and play OBJECT (or simply let it continue playing if it’s already playing).
See also: ‘play’, ‘end’, ‘stop’, ‘play-swap’
Play PLAY, and end (or stop) END.
See also: ‘play’, ‘end’, ‘stop’, ‘play-solo’
Get a list of all nodes on BACKEND that are currently playing. Without BACKEND, get all playing nodes on all backends.
See also: ‘all-instruments’, ‘playing-pdefs’, ‘playing-p’
Get a list of the names of all pdefs playing on CLOCK.
See also: ‘playing-pdefs’, ‘all-pdefs’, ‘playing-nodes’, ‘playing-p’
Get a list of the names of all pdefs playing on CLOCK.
See also: ‘playing-pdef-names’, ‘all-pdefs’, ‘playing-nodes’, ‘playing-p’
Evaluates FUNC to generate a pattern, which is then yielded from until its end, at which point FUNC is evaluated again to generate the next pattern. The pattern is generated a total of REPEATS times.
Example:
;; (next-n (plazy (lambda () (if (= 0 (random 2)) (pseq ’(1 2 3) 1) (pseq ’(9 8 7) 1)))) 6)
;; ;=> (9 8 7 1 2 3)
See also: ‘pfunc’
Meta-control patterns using the events output by PATTERN. In other words, instead of triggering synths directly, the events output by PATTERN are used to embed patterns into the pmeta’s pstream.
The following keys are supported:
- :pattern or :instrument - name of the source pattern for this "step".
- :dur - set the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).
- :findur - limit the duration of the embedded pattern.
- :sync - sync the duration of the embedded pattern to a multiple of the provided value, similar to ‘psync’
- :stretch - multiply the duration of each of the source pattern’s events.
- :ts or :fit - timestretch a pattern so its total duration is the number specified, a la ‘pts’.
- :r or :repeat - repeat each event the number of times returned by the function when the event is applied to it, similar to ‘pr’.
- :inject - inject key/value pairs from the output of this value into the source pattern.
- :step-inject or :sinject - inject one output from this value per step.
The following keys are planned for future implementation:
- :start or :end - adjust the start or end points of the source pattern (i.e. to skip the first half, set :start to 0.5).
- :start-beat or :end-beat - adjust the start or end points of the source pattern in number of beats (i.e. to end the pattern 2 beats early, set :end-beat to -2).
- :start-nth or :end-nth - adjust the start or end points of the source pattern by skipping the first or last N events.
- :filter or :remove-if-not - skip all events from the source pattern that return nil when applied to the specified function or pattern.
- :mapcar or :nary - process each event from the source pattern with a function or another pattern.
See doc/special-keys.org for more information on these keys.
Example:
;; ;; define a few patterns...
;; (pdef :foo (pbind :x (pseq ’(1 2 3) 1) :dur 1))
;; (pdef :bar (pbind :y (pseries) :dur (pwhite 0.1 1.0 3)))
;;
;; ;; use pmeta to play pattern foo and then pattern bar, ensuring each are 2 beats long in total by way of pmeta’s sync key, which works similarly to ‘psync’
;; (next-upto-n (pmeta :pattern (pseq (list :foo :bar) 1) :sync 2))
;; ;=> ((EVENT :X 1 :DUR 1) (EVENT :X 2 :DUR 1) ; from (pdef :foo)
;; (EVENT :Y 0 :DUR 0.76958686) (EVENT :Y 1 :DUR 0.94850993) (EVENT :Y 2 :DUR 0.28190327)) ; from (pdef :bar)
See also: ‘psym’, ‘parp’, ‘pdef’, ‘pbind’
pmono defines a mono instrument event pstream. It’s effectively the same as ‘pbind’ with its :type key set to :mono.
See also: ‘pbind’
Get the mouse position of the display server (GUI). ORIENTATION can be :x or :y, and FORMAT can be either :relative (in which case the output is a number from 0 to 1 as a fraction of total display size) or :absolute (in which case the output is the actual X or Y position of the mouse).
See also: ‘pmousex’, ‘pmousey’, ‘mouse-location’
Get the mouse’s x position on screen. FORMAT can be either :relative (in which case the output is a number from 0 to 1 as a fraction of total display size) or :absolute (in which case the output is the actual X or Y position of the mouse).
See also: ‘pmouse’, ‘pmousey’, ‘mouse-location’
Get the mouse’s y position on screen. FORMAT can be either :relative (in which case the output is a number from 0 to 1 as a fraction of total display size) or :absolute (in which case the output is the actual X or Y position of the mouse).
See also: ‘pmouse’, ‘pmousex’, ‘mouse-location’
Embed the full PATTERN into the pstream REPEATS times.
Example:
;; (next-upto-n (pn (pwhite 0 5 1) 5))
;; ;=> (2 4 2 1 0)
See also: ‘pr’
Yield the result of applying OPERATOR to each value yielded by each pattern in PATTERNS.
Example:
;; (next-upto-n (pnary (pseq (list ’+ ’- ’* ’/) 2) 2 2))
;; ;=> (4 0 4 1)
See also: ‘pfunc’, ‘p+’, ‘p-’, ‘p*’, ‘p/’
Combine multiple event patterns into one pstream with all events in temporal order. PATTERNS is the list of patterns, or a pattern yielding lists of patterns. The ppar ends when all of the patterns in PATTERNS 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) (EVENT :DUR 2/3 :DELTA 2/3))
See also: ‘psym’
Combine multiple patterns into several event streams. The event yielded by the first pattern will be used as the input event to the second pattern, and so on. The events yielded by each pattern will be collected into a list and yielded by the pparchain. This pattern is effectively ‘ppar’ and ‘pchain’ combined.
Example:
;; (next-upto-n (pparchain (pbind :foo (pseries 0 1 3)) (pbind :baz (p+ (pk :foo) 1) :foo (p+ (pk :foo) 3))))
;; ;=> (((EVENT :FOO 0) (EVENT :FOO 3 :BAZ 1))
;; ((EVENT :FOO 1) (EVENT :FOO 4 :BAZ 2))
;; ((EVENT :FOO 2) (EVENT :FOO 5 :BAZ 3)))
See also: ‘ppc’, ‘ppar’, ‘pchain’, ‘pbind”s :embed key
Yield each value from LIST in sequence, or one output from each pattern in LIST per cycle of the list. If one of the patterns embedded in LIST ends sooner than the others, it is simply removed and the ppatlace continues to yield from the rest of the LIST. The entire LIST is yielded through a total of REPEATS times.
Example:
;; (next-upto-n (ppatlace (list (pseq (list 1 2 3) 1)
;; (pseq (list 4 5 6) 2))))
;; ;=> (1 4 2 5 3 6 4 5 6)
See also: ‘place’
Repeat each value from PATTERN REPEATS times. If REPEATS is 0, the value is skipped.
Example:
;; (next-upto-n (pr (pseries) (pseq ’(1 3 0 2) 1)))
;; ;=> (0 1 1 1 3 3)
See also: ‘pdurstutter’, ‘pn’, ‘pdrop’, ‘parp’
Yield random values from LIST.
Example:
;; (next-n (prand ’(1 2 3) 5) 6)
;; ;=> (3 2 2 1 1 EOP)
See also: ‘pxrand’, ‘pwrand’, ‘pwxrand’
Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.
Note that this is effectively a convenience wrapper over ‘pnary’ and ‘rerange’; thus you should see ‘rerange’ for more information.
See also: ‘rerange’, ‘pnary’
Make a prest object, which, when used in a ‘pbind’ or similar event pattern, turns the current event into a rest and yields VALUE for the key’s value.
Note that this is not a pattern; it is just a regular function that returns a prest object.
Example:
;; (next-upto-n (pbind :degree (pseq (list 0 1 (prest 2) 3) 1)))
;; ;=> ((EVENT :DEGREE 0) (EVENT :DEGREE 1) (EVENT :TYPE :REST :DEGREE 2) (EVENT :DEGREE 3))
See also: ‘pbind’, ‘pbind”s :type key
Rotate PATTERN N outputs forward or backward, wrapping the shifted items to the other side, a la ‘alexandria:rotate’.
Example:
;; (next-upto-n (protate (pseq ’(1 2 3 4 5) 1) 2))
;; ;=> (4 5 1 2 3)
See also: ‘pdrop’, ‘phistory’, ‘pscratch’
Syntax sugar for (pr (ps PATTERN) REPEATS). Useful, for example, to ensure that each loop of a pattern only gets one value from the ‘ps’.
See also: ‘pr’, ‘ps’
Run PATTERN "independently" of its parent, holding each value for DUR beats. Each of PATTERN’s outputs is treated as if it lasted DUR beats, being continuously yielded during that time before moving on to the next output.
Example:
;; (next-upto-n (pbind :foo (pseq ’(1 2 3 4 5))
;; :bar (prun (pseq ’(4 5 6 7 8))
;; (pseq ’(1 2 0.5 0.5 1)))))
;; ;=> ((EVENT :FOO 1 :BAR 4)
;; (EVENT :FOO 2 :BAR 5)
;; (EVENT :FOO 3 :BAR 5)
;; (EVENT :FOO 4 :BAR 6)
;; (EVENT :FOO 5 :BAR 8))
See also: ‘beat’, ‘pbeat’
Preserve pstream state across subsequent calls to ‘as-pstream’. To reset the pstream, simply re-evaluate the ps definition.
Based on the pattern originally from the miSCellaneous SuperCollider library.
Example:
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
;;
;; (next-upto-n *pst* 4)
;; ;=> (4 5 6 7)
;;
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
See also: ‘prs’, ‘pdef’
"Scratches" across the values yielded by a pstream, similar in concept to how a DJ might scratch a record, altering the normal flow of playback. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-upto-n (pscratch (pseries) (pseq ’(0 1 1 -1 2) 2)))
;; ;=> (0 0 1 2 1 3 3 4 5 4)
See also: ‘phistory’
Sequentially yield items from LIST, repeating the whole list REPEATS times. OFFSET is the offset to index into the list.
Example:
;; (next-n (pseq ’(5 6 7) 2) 7)
;; ;=> (5 6 7 5 6 7 EOP)
;;
;; (next-upto-n (pseq ’(5 6 7) 2 1))
;; ;=> (6 7 5 6 7 5)
See also: ‘pser’, ‘eseq’
Sequentially yield values from LIST, yielding a total of LENGTH values.
Example:
;; (next-n (pser ’(5 6 7) 2) 3)
;;
;; ;=> (5 6 EOP)
See also: ‘pseq’
Yield START, then generate subsequent outputs by adding STEP, for a total of LENGTH outputs.
Example:
;; (next-upto-n (pseries 1 2 4))
;; ;=> (1 3 5 7)
See also: ‘pseries*’, ‘pgeom’, ‘paccum’
Syntax sugar to generate a ‘pseries’ whose values go from START to END linearly over LENGTH steps. If LENGTH is not provided, it is calculated such that the step will be 1. Note that LENGTH cannot be infinite since delta calculation requires dividing by it.
Based on the Pseries extension from the ddwPatterns SuperCollider library.
Example:
;; (pseries* 0 10 16)
;; ;=> (pseries 0 2/3 16)
;;
;; (next-upto-n *)
;; ;=> (0 2/3 4/3 2 8/3 10/3 4 14/3 16/3 6 20/3 22/3 8 26/3 28/3 10)
See also: ‘pseries’, ‘pgeom’, ‘pgeom*’
Shuffle LIST, then yield each item from the shuffled list, repeating it REPEATS times.
Example:
;; (next-upto-n (pshuf ’(1 2 3) 2))
;;
;; ;=> (3 1 2 3 1 2)
See also: ‘prand’
"Slide" across sections of LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP is the number to increment the start index by after each section, and START is the initial index into LIST that the first section starts from. WRAP-AT-END, when true, means that an index outside of the list will wrap around. When false, indexes outside of the list result in nil.
Example:
;; (next-upto-n (pslide (list 0 1 2 3 4 5 6) 3 3 2 1 t))
;; ;=> (1 2 3 3 4 5 5 6 0)
See also: ‘pscratch’
Get the Nth item in PSTREAM’s history. For negative N, get the -Nth most recent item.
Example:
;; (let ((pstream (as-pstream (pseq ’(1 2 3)))))
;; (next pstream) ;=> 1
;; (pstream-elt pstream 0) ;=> 1 ; first item in the pstream’s history
;; (next pstream) ;=> 2
;; (pstream-elt pstream 1) ;=> 2 ; second item in the pstream’s history
;; (pstream-elt pstream -1)) ;=> 2 ; most recent item in the pstream’s history
See also: ‘pstream-elt-future’, ‘phistory’
Get the element N away from the most recent in PSTREAM’s history. Unlike ‘pstream-elt’, this function will automatically peek into the future for any positive N.
Example:
;; (let ((pstream (as-pstream (pseq ’(1 2 3)))))
;; (pstream-elt-future pstream 0) ;=> 1
;; (next pstream) ;=> 1
;; (pstream-elt-future pstream 1) ;=> 2
;; (next pstream)) ;=> 2
See also: ‘pstream-elt’, ‘phistory’
True if OBJECT is a pstream.
See also: ‘pstream’, ‘as-pstream’
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’
Yield events from PATTERN until their total duration is within TOLERANCE of MAXDUR, cutting off any events that would extend past MAXDUR. If PATTERN ends before MAXDUR, a rest is added to the pstream to round its duration up to the nearest multiple of SYNC-QUANT.
Example:
;; (next-upto-n (psync (pbind :dur (pseq ’(5) 1)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :TYPE :REST :DUR 3))
;;
;; (next-upto-n (psync (pbind :dur (pseq ’(5) 5)) 4 16))
;;
;; ;=> ((EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5) (EVENT :DUR 5 :DELTA 1))
See also: ‘pfindur’
Yield the number of seconds elapsed since ptime was embedded in the pstream.
Note: May give inaccurate results if the clock’s tempo changes occur more frequently than events in the parent pbind.
Example:
;; (setf (tempo *clock*) 1) ; 60 BPM
;; (next-n (pbind :dur 1 :time (ptime)) 2)
;; ;=> ((EVENT :DUR 1 :TIME 0) (EVENT :DUR 1 :TIME 1.0))
See also: ‘pbeat’, ‘prun’, ‘beat’
Print the PREFIX and each output of TRACE to STREAM. If TRACE is t, print ‘*event*’. If TRACE is a different symbol, print the value of that symbol in ‘*event*’. If TRACE is a pattern, ptrace yields its output unaffected. Otherwise, it yields t.
See also: ‘debug-backend’, ‘debug-backend-recent-events’
Defines an event pattern via a tracker-inspired notation. HEADER is a plist mapping the pattern’s "columns" (keys) to their default values or to patterns that are used to generate the key’s values for each output. ROWS is a list of lists, each sublist specifying the values for a step. Values can be specified on their own (in which case they’re matched in order to the columns specified in the header) or by using Lisp’s traditional key/value notation.
By default, the pattern repeats infinitely, however it can be limited by providing a :repeats argument in the header specifying the number of repeats.
Example:
;; (ptrack (list :freq 440 :dur 1/4)
;; ’((100) ; play a note with a frequency of 100
;; :r ; rest for 1/4 beat
;; (:midinote 70 :dur 1/2) ; play a note at midinote 70 for 1/2 beat
;; (-) ; continue previous note for an additional 1/4 beat
;; (600 3/4) ; play a note with a frequency of 600 for 3/4 beat
;; :r ; rest for 1/4 beat
;; (750 :foo 3) ; play a note at frequency 750, dur 1/4, and additional :foo key with value 3
;; ))
See also: ‘pt’, ‘pcycles’, ‘pbind’
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’
"Walk" over the values in LIST by using the accumulated value of the outputs of STEP-PATTERN as the index. At the beginning of the pwalk and each time the start or end of the list is passed, the output of DIRECTION-PATTERN is taken and used as the multiplier for values from STEP-PATTERN. START-POS is the index in LIST for pwalk to take its first output from.
Example:
;; ;; using (pseq (list 1 -1)) as the DIRECTION-PATTERN causes the pwalk’s output to "ping-pong":
;; (next-n (pwalk (list 0 1 2 3) (pseq (list 1)) (pseq (list 1 -1))) 10)
;;
;; ;=> (0 1 2 3 2 1 0 1 2 3)
See also: ‘pindex’, ‘pbrown’, ‘paccum’
Linearly-distributed random numbers between LO and HI, inclusive.
Example:
;; (next-upto-n (pwhite 0 10 16))
;; ;=> (7 2 4 5 7 10 4 8 10 2 3 5 9 2 5 4)
See also: ‘pexprand’, ‘pbrown’, ‘pgauss’, ‘prand’
Yield random elements from LIST weighted by respective values from WEIGHTS.
Example:
;; (next-upto-n (pwrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 1 2 2 2 1 2 1 1 3)
See also: ‘prand’, ‘pxrand’, ‘pwxrand’
Syntax sugar for (pnary #’wrap ...).
See also: ‘pnary’, ‘mutility:wrap’
Yield random elements from LIST weighted by respective values from WEIGHTS, never repeating equivalent values twice in a row. This is effectively ‘pxrand’ and ‘pwrand’ combined.
Example:
;; (next-upto-n (pwxrand ’(1 2 3) ’(7 5 3) 10))
;; ;=> (1 2 1 2 1 3 1 2 1 2)
See also: ‘prand’, ‘pxrand’, ‘pwrand’
Yield random values from LIST, never repeating equal values twice in a row.
Example:
;; (next-upto-n (pxrand ’(1 2 3) 4))
;; ;=> (3 1 2 1)
See also: ‘prand’, ‘pwrand’, ‘pwxrand’
Return a new list whose elements have been reordered via one of 10 "counting" algorithms. This is based on and tested against SuperCollider’s Array.pyramid method.
Convert a playback rate RATE to a frequency, based on BASE-FREQ.
Convert a playback rate to a midinote.
Convert a frequency ratio to a difference in MIDI note numbers.
Removes KEY from EVENT.
Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.
Example:
;; (rerange 64 (list 0 127) (list 0 1)) ; map from [0..127] to [0..1]
;; => 0.503937
See also: ‘to-range’, ‘from-range’, ‘prerange’
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).
Get the total dimensions of all monitors known by DISPLAY-SERVER.
Split an event up by any lists in its values. Also known as multichannel expansion.
Example:
;; (split-event-by-lists (event :foo 1 :bar (list 1 2) :baz (list 3 4 5)))
;;
;; => ((EVENT :FOO 1 :BAR 1 :BAZ 3)
;; (EVENT :FOO 1 :BAR 2 :BAZ 4)
;; (EVENT :FOO 1 :BAR 1 :BAZ 5))
See also: ‘multi-channel-funcall’, ‘combine-events-via-lists’, ‘combine-events’
Convenience method to make a clock and start its loop in a new thread if one isn’t already started.
With FORCE, make a new clock and thread even if one already appears to be running.
See also: ‘clock-loop’, ‘*clock*’
Make a t-pstream object with the value VALUE.
True if OBJECT is a ‘t-pstream’.
See also: ‘t-pstream’, ‘as-pstream’
Attempt to get the pattern that TASK is playing. Returns nil if the pattern couldn’t be found.
See also: ‘pattern-tasks’, ‘clock-tasks’
Convert TIME in seconds to duration in beats according to TEMPO in beats per second.
Generate a tone matrix from TONES. Supports symbols t and e for 10 and 11, respectively, but only returns numbers. TRANSFORMATION can be :inversion, :retrograde, or :retrograde-inversion (or a 3-letter abbreviation of any of the above).
Transpose FREQ the specified number of SEMITONES and OCTAVES.
Convert the range 0..1 to 0..127.
Convert a bipolar number (-1 to 1) to a unipolar number (0 to 1).
See also: ‘bipolar-unipolar’
Volume in amplitude, from 0 to 1.
Convert OBJECT to an ‘eseq’.
See also: ‘as-pstream’
Return THING as a pstream object.
See also: ‘pattern-as-pstream’
pbjorklund
)) ¶pdurstutter
)) ¶pbind-pstream
)) ¶Start BACKEND’s server so it is ready to receive events. If BACKEND is the name of a backend rather than a ‘backend’ instance, first make an instance of the backend as if ‘make-backend’ was called, then call ‘backend-start’ on that.
See also: ‘backend-stop’, ‘backend-enabled-p’, ‘make-backend’
symbol
) &rest args &key &allow-other-keys) ¶Stop BACKEND’s server if it is running.
See also: ‘backend-start’, ‘backend-enabled-p’
symbol
)) ¶Get the beat that OBJECT occurs on, relative to its context’s start. For example, 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.
See also: ‘tempo’
clock
)) ¶The number of beats that have elapsed since the creation of the clock.
beat
.
pstream
)) ¶The number of beats that have elapsed since the start of the pstream.
beat
.
(eql cl-patterns:eop)
)) ¶null
)) ¶"Beat subseq" - get a list of all events from OBJECT whose ‘beat’ is START-BEAT or above, and below END-BEAT.
See also: ‘events-in-range’
Get a chord by name.
The indexes of the notes from the scale that the chord is made up of.
symbol
)) ¶The octave ratio of the chord (i.e. what to multiply a pitch by to increase its octave by 1).
symbol
)) ¶The scale that the chord is derived from.
symbol
)) ¶Volume in decibels (dB).
The number of beats between the start of this event and the start of the next one.
See also: ‘dur’, ‘sustain’
The total duration of the note, in beats.
See also: ‘delta’, ‘legato’
End a task; it will stop when its current loop completes.
The end-quant of OBJECT; a list representing when OBJECT is allowed to end playing or when a ‘pdef’ is allowed to swap to a new definition if it has been redefined. Note that if ‘end-quant’ is not set (the default), the pattern can only end or swap when the pattern itself ends (i.e. when it yields ‘eop’).
See ‘quant’ for more information on quants and a description of acceptable values.
See also: ‘quant’, ‘play-quant’, ‘next-beat-for-quant’, ‘beat’, ‘end’, ‘pdef’
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: ‘eop-p’, ‘last-output’
True if OBJECT indicates the end of a pstream’s outputs.
See also: ‘ended-p’
Add EVENT to ESEQ. If EVENT doesn’t have a ‘beat’, it is placed after the last event in ESEQ.
See also: ‘eseq-remove’
The list of events in the ‘eseq’.
Note that eseq’s events slot should not be modified directly as it expects its events to be kept in order. Instead, use ‘eseq-add’, ‘eseq-remove’, or setf ‘eseq-events’.
Remove EVENT from ESEQ.
See also: ‘eseq-add’
The raw plist containing the key/value pairs of the event.
Frequency of the note, in Hz.
See also: ‘rate’, ‘midinote’, ‘degree’
The instrument or synth to trigger.
Insert PATTERN into IPSTREAM at START-BEAT. START-BEAT defaults to the ipstream’s current beat.
ipstream-pstream
) pattern &optional start-beat) ¶Play a new copy of OBJECT on the clock. Unlike ‘play’, calling this method on a ‘pdef’ will always start a new copy of its pattern instead of the pdef itself.
See also: ‘play’
How long the note should be held, in beats, as a factor of its total duration (‘dur’).
See also: ‘sustain’, ‘dur’
Whether or not OBJECT should play again after it ends.
Make a backend of the specified type.
See also: ‘backend-start’
MIDI note number of the note (0-127).
Get the next value of a pstream, function, or other object, advancing the pstream forward in the process.
See also: ‘next-n’, ‘next-upto-n’, ‘peek’
eseq-pstream
)) ¶ptrack-pstream
)) ¶pcycles-pstream
)) ¶pbjorklund-pstream
)) ¶pmeta-pstream
)) ¶pdef-pstream
)) ¶pmouse-pstream
)) ¶pfilter-pstream
)) ¶ipstream-pstream
)) ¶ps-pstream
)) ¶paccum-pstream
)) ¶paclump-pstream
)) ¶pclump-pstream
)) ¶pparchain-pstream
)) ¶pwalk-pstream
)) ¶pts-pstream
)) ¶ppar-pstream
)) ¶pdrop-pstream
)) ¶pdelta-pstream
)) ¶pdiff-pstream
)) ¶pchain-pstream
)) ¶psym-pstream
)) ¶prun-pstream
)) ¶pindex-pstream
)) ¶ptime-pstream
)) ¶pbeat*-pstream
)) ¶pbeat-pstream
)) ¶pdurstutter-pstream
)) ¶psync-pstream
)) ¶pfindur-pstream
)) ¶pfin-pstream
)) ¶parp-pstream
)) ¶pif-pstream
)) ¶pscratch-pstream
)) ¶phistory-pstream
)) ¶pslide-pstream
)) ¶prerange-pstream
)) ¶pnary-pstream
)) ¶ppatlace-pstream
)) ¶place-pstream
)) ¶ptrace-pstream
)) ¶pgeom-pstream
)) ¶pseries-pstream
)) ¶pgauss-pstream
)) ¶pexprand-pstream
)) ¶pbrown-pstream
)) ¶pwhite-pstream
)) ¶pshuf-pstream
)) ¶pn-pstream
)) ¶protate-pstream
)) ¶plazy-pstream
)) ¶pr-pstream
)) ¶pfunc-pstream
)) ¶pwxrand-pstream
)) ¶pwrand-pstream
)) ¶pxrand-pstream
)) ¶prand-pstream
)) ¶pk-pstream
)) ¶pser-pstream
)) ¶pseq-pstream
)) ¶pbind-pstream
)) ¶function
)) ¶Stereo panning, where -1 is fully left, 1 is fully right, and 0 is center.
Get the value of PATTERN’s metadata for KEY. Returns true as a second value if the metadata had an entry for KEY, or nil if it did not.
The source object that this object was created from. For example, for a ‘pstream’, this would be the pattern that ‘as-pstream’ was called on.
The name ("key") of PDEF.
The pattern that PDEF points to.
The currently-playing pstream of PDEF’s pattern.
The task that PDEF was last being played in.
"Peek" at the next value of a pstream, without advancing its current position.
See also: ‘next’, ‘peek-n’, ‘peek-upto-n’
Play an object (typically an event or pattern).
See also: ‘launch’, ‘stop’
The play-quant of OBJECT; a list representing when OBJECT is allowed to begin playing. Defaults to (1).
See ‘quant’ for more information on quants and a description of acceptable values.
See also: ‘quant’, ‘end-quant’, ‘next-beat-for-quant’, ‘beat’, ‘play’
Whether OBJECT is playing.
See also: ‘play-or-stop’, ‘play-or-end’, ‘playing-pdefs’, ‘playing-nodes’
The number of pstreams that have been made of this pattern.
pstream
)) ¶How many times a pstream was made of this pstream’s source prior to this pstream. For example, if it was the first time ‘as-pstream’ was called on the pattern, this will be 0.
pstream
)) ¶How many times a pstream was made of this pstream’s source prior to this pstream. For example, if it was the first time ‘as-pstream’ was called on the pattern, this will be 0.
Get the value of a cell from ptrack (i.e. the value at that location if specified, or the generated value if not specified). Can also be used on a ptrack-pstream to get the generated values from it. Returns three values:
- the value of the cell
- the name of the key that the specified KEY was derived from, or nil if it was not found
- t if the output was taken from the row itself, or nil if it was derived from the header
See also: ‘ptrack’, ‘ptrack-row’
ptrack-pstream
) row key &key if-does-not-exist) ¶Get the plist for ROW from PTRACK.
Get the list of rows from PTRACK.
The quant of OBJECT; a list representing when OBJECT is allowed to begin playing (‘play-quant’), end playing (‘end-quant’), or when a ‘pdef’ is allowed to swap to its new definition (‘end-quant’). ‘quant’ will return the value of ‘play-quant’ as its first value and ‘end-quant’ as its second, and sets both ‘play-quant’ and ‘end-quant’ when it is setf.
A quant value takes the form (divisor phase offset) where all provided elements are numbers. Only the first element is required.
- "divisor" is the divisor to quantize the clock to. The next time (mod (beat *clock*) divisor) is 0 is when OBJECT will start playing.
- "phase" is the number of beats to add on to the position determined by "divisor".
- "offset" is the number of seconds to add on to the position determined by "divisor" and "phase".
For example, a quant of (4) means it can start on any clock beat that is divisible by 4 (0, 4, 8, etc). A quant of (4 2) means the pstream can start 2 beats after any beat divisible by 4 (2, 6, 10, etc). And a quant of (4 0 1) means that the pstream can start 1 second after any beat that is divisible by 4.
See also: ‘play-quant’, ‘end-quant’, ‘next-beat-for-quant’, ‘beat’, ‘play’
Playback rate, i.e. for playing back sound buffers. 1 is normal speed, 2 is twice as fast, 0.5 half as fast, etc.
Render a pattern or other object as audio or other format. OUTPUT is what the pattern should be rendered as. It can be one of the following values:
- A string or pathname - Output file name (file format is determined by the file extension).
- :file - Render to a file in the ‘*cl-patterns-temporary-directory*’.
- :buffer - Render to a buffer in memory.
- :bdef - Render to a ‘bdef:bdef’ buffer object in memory. This output type is only available if the bdef library is loaded, and falls back to :buffer if it is not.
- :score - Render as a "score" in memory, i.e. the sequence type supported by the backend.
- :eseq - Make an ‘eseq’ from the pattern. Effectively defers to ‘as-eseq’.
- :pstream - Make a ‘pstream’ from the pattern. Effectively defers to ‘as-pstream’.
- :list - Get a list of up to the first MAX-LENGTH outputs from this object using ‘next-upto-n’.
The following additional keyword arguments are also supported, depending on the output type:
- BACKEND - The backend to render with. Defaults to the first applicable backend, based on (in descending order of priority): the first event’s :backend key, the first event’s :instrument, or the first enabled backend that supports the specified output type.
- OUTPUT-FILENAME - The filename to write the rendered file to (when rendering to a file).
- TEMPO - The tempo of the result in beats per second. Defaults to ‘*clock*”s current tempo.
- MAX-LENGTH - Maximum number of outputs to grab from the source pattern. Must be an integer (cannot be :inf). Defaults to ‘*max-pattern-yield-length*’.
- DURATION - The total duration of the output in seconds.
- MAX-DURATION - The maximum duration of the output in seconds. Defaults to infinite, in which case the pattern is limited by MAX-PATTERN-YIELD-LENGTH.
See also: ‘as-eseq’
pathname
) &rest args &key &allow-other-keys) ¶string
) &rest args &key &allow-other-keys) ¶(eql :score)
) &rest args &key &allow-other-keys) ¶(eql :file)
) &rest args &key &allow-other-keys) ¶(eql :buffer)
) &rest args &key &allow-other-keys) ¶(eql :list)
) &key max-length) ¶(eql :pstream)
) &key) ¶(eql :eseq)
) &key) ¶Whether or not something is a rest or a rest-representing object (i.e. :rest, :r, or a rest event).
Get either a musical scale object by its name, or get the name of the scale of an event.
The full name of the scale.
symbol
)) ¶The degrees of the scale.
symbol
)) ¶The number of pitches per octave in the scale’s ‘tuning’.
symbol
)) ¶The scale’s ‘tuning’.
symbol
)) ¶Immediately stop a playing object (typically a pattern, pdef, task, or node). If OBJECT is T, stop all playing patterns and nodes.
See also: ‘end’, ‘play’
How long the note should be held, in beats.
See also: ‘legato’, ‘delta’
The number of times to yield the value.
The value that is yielded by the t-pstream.
Get the tempo of OBJECT in beats per second. If OBJECT is a number, set the tempo of ‘*clock*’ to that number.
See also: ‘beat’
Get a tuning by name.
The full name of the tuning.
symbol
)) ¶The octave ratio of the tuning (i.e. what to multiply a pitch by to increase its octave by 1).
The actual semitone values of the tuning.
symbol
)) ¶The number of pitches per octave in the tuning.
symbol
)) ¶pstream
) length &key initial-element initial-contents) ¶sb-sequence
.
pstream
) length &key initial-element initial-contents) ¶sb-sequence
.
pdurstutter
) stream) ¶pdef-pstream
) stream) ¶pbind-pstream
) stream) ¶pbjorklund
) stream) ¶Method combination type for patterns; specifically, the ‘next’ function. Similar to the standard CLOS method combination, except that :around methods are called in reverse order, from the least specific to the most specific.
next
.
Abstract superclass for backends.
(setf backend-enabled-p)
.
backend-enabled-p
.
(setf backend-input-processors)
.
backend-input-processors
.
(setf backend-metadata)
.
backend-metadata
.
(setf backend-name)
.
backend-name
.
backend-responds-p
.
backend-start
.
backend-start
.
(setf backend-started-p)
.
backend-started-p
.
backend-stop
.
initialize-instance
.
The name of the backend instance.
alexandria:string-designator
:name
Whether this backend instance is currently enabled. Events being played will only be sent to enabled and running backends.
boolean
t
:enabled-p
Whether the backend is current enabled and running.
boolean
:started-p
List of functions that process incoming events. Similar to ‘*post-pattern-output-processors*’ but per-backend.
list
:input-processors
Additional metadata associated with the backend instance.
list
:metadata
Chord definition.
sequence
.
The full name of the chord.
:name
The indexes of the notes from the scale that the chord is made up of.
:indexes
The scale that the chord is derived from.
:scale
pattern
.
sequence
.
list
(list)
:events
This slot is read-only.
The duration of the eseq. If the slot is nil, it defaults to ‘last-dur’ rounded up to the next multiple of the eseq’s ‘play-quant’.
(or null number)
:dur
pstream for ‘eseq’.
Class representing a musical event.
%beat
.
(setf amp)
.
amp
.
as-eseq
.
(setf beat)
.
beat
.
(setf db)
.
db
.
(setf delta)
.
delta
.
(setf dur)
.
dur
.
eop-p
.
eseq-add
.
eseq-remove
.
event-plist
.
(setf freq)
.
freq
.
(setf instrument)
.
instrument
.
keys
.
(setf legato)
.
legato
.
(setf loop-p)
.
loop-p
.
(setf midinote)
.
midinote
.
(setf pan)
.
pan
.
play
.
(setf play-quant)
.
play-quant
.
print-object
.
(setf quant)
.
quant
.
(setf rate)
.
rate
.
render
.
(setf rest-p)
.
rest-p
.
(setf scale)
.
scale
.
(setf sustain)
.
sustain
.
(setf tempo)
.
tempo
.
The plist containing all of the event’s keys and values.
list
:event-plist
This slot is read-only.
Insertable pstream; a pstream that can be changed while it’s running by inserting new patterns at a specified beat.
pstream for ‘ipstream’.
(bordeaux-threads:make-recursive-lock "ipstream patterns slot lock")
:lock
Numeric accumulator. Each output and STEP is used as the input for OPERATOR to generate the next output. When LO, HI, and BOUND-BY are provided, outputs that fall outside the range LO..HI are wrapped back inside with the BOUND-BY function; the value is provided as its first argument, and LO and HI are provided as its second and third.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-upto-n (paccum #’+ 0 1) 5) ; same as (pseries 0 1)
;; ;=> (0 1 2 3 4)
;; (next-upto-n (paccum #’+ 0 1 :inf :lo 0 :hi 3 :bound-by #’wrap) 9) ; same as above, wrapping between 0 and 3.
;; ;=> (0 1 2 0 1 2 0 1 2)
See also: ‘pseries’, ‘pgeom’, ‘pwalk’
(function +)
:operator
0
:start
common-lisp
.
1
:step
common-lisp
.
cl-patterns:*default-pattern-length*
:length
:lo
:hi
:bound-by
pstream for ‘paccum’.
Automatically group outputs of the source pattern into lists of up to N items each. Unlike ‘pclump’, clump size is automatically set to the length of the longest list in the values of ‘*event*’, or 1 if there are no lists.
Example:
;; (next-upto-n (pbind :foo (pseq ’((1) (1 2) (1 2 3)) 1) :bar (paclump (pseries))))
;; ;=> ((EVENT :FOO (1) :BAR (0)) (EVENT :FOO (1 2) :BAR (1 2)) (EVENT :FOO (1 2 3) :BAR (3 4 5)))
See also: ‘pclump’
:pattern
pstream for ‘paclump’.
next
.
Arpeggiator pattern; each event yielded by PATTERN is bound to ‘*event*’ and then the entirety of the ARPEGGIATOR pattern is yielded.
Example:
;; (next-upto-n (parp (pbind :foo (pseq ’(1 2 3) 1))
;; (pbind :bar (pseq ’(4 5 6) 1))))
;; ;=> ((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’, ‘pr’
pstream for ‘parp’.
Abstract pattern superclass.
eseq
.
ipstream
.
paccum
.
paclump
.
parp
.
pbeat
.
pbeat*
.
pbind
.
pbjorklund
.
pbrown
.
pchain
.
pclump
.
pcycles
.
pdef
.
pdelta
.
pdiff
.
pdrop
.
pdurstutter
.
pexprand
.
pfilter
.
pfin
.
pfindur
.
pfunc
.
pgauss
.
pgeom
.
phistory
.
pif
.
pindex
.
pk
.
place
.
plazy
.
pmeta
.
pmouse
.
pn
.
pnary
.
ppar
.
ppatlace
.
pr
.
prand
.
prerange
.
protate
.
prun
.
ps
.
pscratch
.
pseq
.
pser
.
pseries
.
pshuf
.
pslide
.
pstream
.
psym
.
psync
.
ptime
.
ptrace
.
ptrack
.
pts
.
pwalk
.
pwhite
.
pwrand
.
pwxrand
.
pxrand
.
%pattern-children
.
as-eseq
.
as-pstream
.
dur
.
(setf end-condition)
.
end-condition
.
(setf end-quant)
.
end-quant
.
events-in-range
.
initialize-instance
.
launch
.
(setf loop-p)
.
loop-p
.
next
.
pattern-metadata
.
(setf pattern-source)
.
pattern-source
.
peek
.
play
.
(setf play-quant)
.
play-quant
.
playing-p
.
(setf pstream-count)
.
pstream-count
.
A list of numbers representing when the pattern’s pstream can start playing. See ‘play-quant’ and ‘quant’.
:play-quant
A list of numbers representing when a pattern can end playing and when a ‘pdef’ can be swapped out for a new definition. See ‘end-quant’ and ‘quant’.
list
:end-quant
Nil or a function that is called by the clock with the pattern as its argument to determine whether the pattern should end or swap to a new definition.
(or null function)
:end-condition
The source object that this object was created from. For example, for a ‘pstream’, this would be the pattern that ‘as-pstream’ was called on.
:source
When a pattern is embedded in another pattern, the embedded pattern’s parent slot points to the pattern it is embedded in.
:parent
Whether or not the pattern should loop when played.
:loop-p
A list of functions that are run when the pattern ends or is stopped.
:cleanup
The number of pstreams that have been made of this pattern.
0
Hash table of additional data associated with the pattern, accessible with the ‘pattern-metadata’ function.
hash-table
(make-hash-table)
:metadata
Yield the number of beats elapsed since the pbeat was embedded in the pstream.
Example:
;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 2 :FOO 1) (EVENT :DUR 3 :FOO 3))
See also: ‘pbeat*’, ‘beat’, ‘prun’
Yield the number of beats on the ‘*clock*’ of the current pattern. In other words, pbeat* is clock-synced, unlike ‘pbeat’, which is pattern-synced.
Example:
;; (next-n (pbind :dur (pseq ’(1 2 3)) :foo (pbeat*)) 3)
;; ;=> ((EVENT :DUR 1 :FOO 200) (EVENT :DUR 2 :FOO 201) (EVENT :DUR 3 :FOO 203))
See also: ‘pbeat’, ‘beat’, ‘prun’
pstream for ‘pbeat*’.
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) EOP)
See also: ‘pmono’, ‘pb’
The pattern pairs of the pbind; a plist mapping its keys to their values.
:pairs
pstream for ‘pbind’
pbjorklund generates Euclidean rhythms using the Bjorklund algorithm. PULSES is the number of notes in the sequence, and STEPS is number of steps in the sequence. Additionally, OFFSET is the number to rotate the sequence by, DUR is the total duration one repeat of the sequence should be, and REPEATS is the number of repeats that should be yielded. This pattern outputs events which can be embedded into another pattern. Each pulse is a note, and each subdivision of the sequence that is not a pulse is a rest. If you just want the raw output from the Bjorklund algorithm (not in pattern form), use ‘bjorklund’ instead.
Example:
;; (next-upto-n (pbjorklund 3 7))
;; => ((EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :NOTE :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7) (EVENT :TYPE :REST :DUR 1/7))
See also: ‘bjorklund’
:pulses
:steps
0
:offset
1
:dur
cl-patterns:*default-pattern-repeats*
:repeats
pstream for ‘pbjorklund’.
next
.
Brownian motion within a range; each output randomly a maximum of STEP away from the previous. LO and HI define the lower and upper bounds of the range. STEP defaults to 1 if LO and HI are integers.
Example:
;; (next-upto-n (pbrown 0 10 1 10))
;; ;=> (2 3 3 3 4 3 4 5 6 5)
See also: ‘pwhite’, ‘pexprand’, ‘pgauss’
0.0
:lo
1.0
:hi
common-lisp
.
0.125
:step
common-lisp
.
cl-patterns:*default-pattern-length*
:length
pstream for ‘pbrown’.
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
:patterns
pstream for ‘pchain’.
next
.
Group outputs of the source pattern into lists of up to N items each.
Example:
;; (next-upto-n (pclump (pseries 0 1 5) 2))
;; ;=> ((0 1) (2 3) (4))
See also: ‘paclump’
pstream for ‘pclump’.
next
.
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.
common-lisp
.
:list
common-lisp
.
:map
:value
:key
1
:dur
cl-patterns:*default-pattern-repeats*
:repeats
pstream for ‘pcycles’.
Define a named pattern, with NAME being the name of the pattern and PATTERN the pattern itself. Named patterns are stored in a global dictionary and can be referred back to by calling ‘pdef’ without supplying PATTERN. The global dictionary also keeps track of the pdef’s pstream when ‘play’ is called on it. If a pdef is redefined while it is being played, the changes won’t be audible until either PATTERN ends, or the pdef’s ‘end-quant’ time is reached (if non-nil). Note that, unlike bare patterns, pdefs loop by default when played (‘loop-p’).
Example:
;; (pdef :foo (pbind :degree (pseries 0 1 4)))
;;
;; (play (pdef :foo))
;; ;; redefine the pdef’s pattern... note that the redefinition doesn’t become audible until the current loop finishes playing:
;; (pdef :foo (pbind :degree (pseries 4 -1 4)))
See also: ‘find-pdef’, ‘all-pdefs’, ‘pb’, ‘pmeta’, ‘ps’
alexandria:string-designator
:name
This slot is read-only.
:pattern
:pstream
:task
pstream for ‘pdef’.
:current-pstream
Output the difference between successive outputs of PATTERN, assuming PATTERN restarts every CYCLE outputs.
Unlike ‘pdiff’, pdelta is written with its use as input for ‘pbind”s :delta key in mind. If PATTERN’s successive values would result in a negative difference, pdelta instead wraps the delta around to the next multiple of CYCLE. This would allow you to, for example, supply the number of the beat that each event occurs on, rather than specifying the delta between each event. This is of course achievable using pbind’s :beat key as well, however that method requires the pbind to peek at future values, which is not always desirable.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-n (pdelta (pseq ’(0 1 2 3)) 4) 8)
;;
;; ;=> (1 1 1 1 1 1 1 1)
;;
;; (next-n (pdelta (pseq ’(0 1 2 5)) 4) 8)
;;
;; ;=> (1 1 3 3 1 1 3 3)
See also: ‘pdiff’, ‘pbind”s :beat key
pstream for ‘pdelta’.
next
.
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’
:pattern
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: ‘protate’
Yield each output from PATTERN N times, dividing it by N. If the output from PATTERN is an event, its dur is divided; if it’s a number, the number itself is divided instead of being yielded directly.
Example:
;; (next-n (pdurstutter (pseq ’(1 2 3 4 5)) (pseq ’(3 2 1 0 2))) 9)
;; ;=> (1/3 1/3 1/3 1 1 3 5/2 5/2 NIL)
;;
;; (next-n (pdurstutter (pbind :dur (pseq ’(1 2 3 4 5)))
;; (pseq ’(3 2 1 0 2)))
;; 9)
;; ;=> ((EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1/3) (EVENT :DUR 1) (EVENT :DUR 1) (EVENT :DUR 3) (EVENT :DUR 5/2) (EVENT :DUR 5/2) NIL)
See also: ‘pr’
pstream for ‘pdurstutter’.
Exponentially-distributed random numbers between LO and HI. Note that LO and HI cannot be 0, and that LO and HI must have the same sign or else complex numbers will be output.
Example:
;; (next-upto-n (pexprand 1.0 8.0 4))
;; ;=> (1.0420843091865208d0 1.9340168112124456d0 2.173209129035095d0 4.501371557329618d0)
See also: ‘pwhite’, ‘pbrown’, ‘pgauss’, ‘prand’
pstream for ‘pexprand’.
Skip elements of a source pattern that PREDICATE returns false for. If PREDICATE is not a function, skip items that are ‘eql’ to it.
Example:
;; (next-n (pfilter (pseq (list 1 2 3))
;; 2)
;; 6)
;; ;=> (1 3 1 3 1 3)
;; (next-n (pfilter (pseries 0 1) ’evenp)
;; 6)
;; ;=> (1 3 5 7 9 11)
See also: ‘pfilter-out’, ‘pr’, ‘pdurstutter’
pstream for ‘pfilter’.
next
.
Yield up to COUNT outputs from PATTERN.
Example:
;; (next-n (pfin (pseq ’(1 2 3) :inf) 3) 5)
;; ;=> (1 2 3 NIL NIL)
See also: ‘pfindur’
Yield events from PATTERN until their total duration is within TOLERANCE of DUR, or greater than DUR. Any events that would end beyond DUR are cut short. If PATTERN outputs numbers, their total sum is limited instead.
Example:
;; (next-n (pfindur (pbind :dur 1 :foo (pseries)) 2) 3)
;; ;=> ((EVENT :DUR 1 :FOO 0) (EVENT :DUR 1 :FOO 1) EOP)
;;
;; (next-upto-n (pfindur (pwhite 0 4) 16))
;; ;=> (1 3 0 1 2 2 1 3 0 1 2)
;; (reduce #’+ *)
;; ;=> 16
See also: ‘pfin’, ‘psync’
pstream for ‘pfindur’.
Yield the result of evaluating FUNC. Note that the current event of the parent pattern is still accessible via the ‘*event*’ special variable.
Example:
;; (next-upto-n (pfunc (lambda () (random 10)) 4))
;; ;=> ((5 2 8 9))
;;
;; (next-upto-n (pbind :foo (pwhite 0 10 4)
;; :bar (pfunc (lambda ()
;; (if (> (event-value *event* :foo) 5) :greater :lesser)))))
;; ;=> ((EVENT :FOO 0 :BAR :LESSER) (EVENT :FOO 6 :BAR :GREATER)
;; (EVENT :FOO 7 :BAR :GREATER) (EVENT :FOO 8 :BAR :GREATER))
See also: ‘pf’, ‘pnary’, ‘plazy’, ‘pif’
pstream for ‘pfunc’.
Random numbers distributed along a normal (gaussian) curve. MEAN is the "center" of the distribution, DEVIATION is the standard deviation (i.e. the higher the value, the further the outputs are spread from MEAN).
Example:
;; (next-n (pgauss) 4)
;; ;=> (0.08918811646370092d0 0.1745957067161632d0 0.7954678768273173d0 -1.2215823449671597d0)
See also: ‘pwhite’, ‘pexprand’, ‘pbrown’
pstream for ‘pgauss’.
Yield START, then generate subsequent outputs by multiplying by GROW, for a total of LENGTH outputs.
Example:
;; (next-upto-n (pgeom 1 2 4))
;; ;=> (1 2 4 8)
See also: ‘pseries’, ‘paccum’
pstream for ‘pgeom’.
Refer back to PATTERN’s history, yielding the output at the index provided by STEP-PATTERN.
Note that PATTERN is still advanced once per event, and if STEP-PATTERN yields a number pointing to an event in PATTERN that hasn’t been yielded yet (i.e. if PATTERN has only advanced once but STEP-PATTERN yields 3 for its output), phistory yields nil.
Example:
;; (next-n (phistory (pseries) (pseq ’(0 2 1))) 3)
;; ;=> (0 NIL 1)
See also: ‘pscratch’
pstream for ‘phistory’.
next
.
"If" expression for patterns. TEST is evaluated for each step, and if it’s non-nil, the value of TRUE will be yielded, otherwise the value of FALSE will be. Note that TRUE and FALSE can be patterns, and if they are, they are only advanced in their respective cases, not for every step.
Example:
;; (next-n (pif (pseq ’(t t nil nil nil)) (pseq ’(1 2 3)) (pseq ’(9 8 7))) 8)
;; ;=> (1 2 9 8 7 3 1 9)
See also: ‘plazy’, ‘pfunc’
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’
pstream for ‘pindex’.
next
.
Yield the value of KEY in the current ‘*event*’ context, returning DEFAULT if that value is nil.
Example:
;; (next-upto-n (pbind :foo (pseq ’(1 2 3) 1) :bar (pk :foo)))
;; ;=> ((EVENT :FOO 1 :BAR 1) (EVENT :FOO 2 :BAR 2) (EVENT :FOO 3 :BAR 3))
See also: ‘pbind’, ‘event-value’, ‘*event*’
Yield each value from LIST in sequence. If the value is a list, the first element of that list is yielded. The second time that sub-list is encountered, its second element will be yielded; the third time, the third element, and so on. REPEATS controls the number of times LIST is repeated.
Example:
;; (next-upto-n (place (list 1 2 (list 3 4 5)) 3))
;; ;=> (1 2 3 1 2 4 1 2 5)
See also: ‘ppatlace’
pstream for ‘place’.
Evaluates FUNC to generate a pattern, which is then yielded from until its end, at which point FUNC is evaluated again to generate the next pattern. The pattern is generated a total of REPEATS times.
Example:
;; (next-n (plazy (lambda () (if (= 0 (random 2)) (pseq ’(1 2 3) 1) (pseq ’(9 8 7) 1)))) 6)
;; ;=> (9 8 7 1 2 3)
See also: ‘pfunc’
pstream for ‘plazy’.
Meta-control patterns using the events output by PATTERN. In other words, instead of triggering synths directly, the events output by PATTERN are used to embed patterns into the pmeta’s pstream.
The following keys are supported:
- :pattern or :instrument - name of the source pattern for this "step".
- :dur - set the duration of the embedded pattern (defaults to :inf, which causes the pattern to play to its end).
- :findur - limit the duration of the embedded pattern.
- :sync - sync the duration of the embedded pattern to a multiple of the provided value, similar to ‘psync’
- :stretch - multiply the duration of each of the source pattern’s events.
- :ts or :fit - timestretch a pattern so its total duration is the number specified, a la ‘pts’.
- :r or :repeat - repeat each event the number of times returned by the function when the event is applied to it, similar to ‘pr’.
- :inject - inject key/value pairs from the output of this value into the source pattern.
- :step-inject or :sinject - inject one output from this value per step.
The following keys are planned for future implementation:
- :start or :end - adjust the start or end points of the source pattern (i.e. to skip the first half, set :start to 0.5).
- :start-beat or :end-beat - adjust the start or end points of the source pattern in number of beats (i.e. to end the pattern 2 beats early, set :end-beat to -2).
- :start-nth or :end-nth - adjust the start or end points of the source pattern by skipping the first or last N events.
- :filter or :remove-if-not - skip all events from the source pattern that return nil when applied to the specified function or pattern.
- :mapcar or :nary - process each event from the source pattern with a function or another pattern.
See doc/special-keys.org for more information on these keys.
Example:
;; ;; define a few patterns...
;; (pdef :foo (pbind :x (pseq ’(1 2 3) 1) :dur 1))
;; (pdef :bar (pbind :y (pseries) :dur (pwhite 0.1 1.0 3)))
;;
;; ;; use pmeta to play pattern foo and then pattern bar, ensuring each are 2 beats long in total by way of pmeta’s sync key, which works similarly to ‘psync’
;; (next-upto-n (pmeta :pattern (pseq (list :foo :bar) 1) :sync 2))
;; ;=> ((EVENT :X 1 :DUR 1) (EVENT :X 2 :DUR 1) ; from (pdef :foo)
;; (EVENT :Y 0 :DUR 0.76958686) (EVENT :Y 1 :DUR 0.94850993) (EVENT :Y 2 :DUR 0.28190327)) ; from (pdef :bar)
See also: ‘psym’, ‘parp’, ‘pdef’, ‘pbind’
as-pstream
.
print-object
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
process-pattern-key-value
.
:pattern
pstream for ‘pmeta’.
Get the mouse position of the display server (GUI). ORIENTATION can be :x or :y, and FORMAT can be either :relative (in which case the output is a number from 0 to 1 as a fraction of total display size) or :absolute (in which case the output is the actual X or Y position of the mouse).
See also: ‘pmousex’, ‘pmousey’, ‘mouse-location’
pstream for ‘pmouse’.
next
.
Embed the full PATTERN into the pstream REPEATS times.
Example:
;; (next-upto-n (pn (pwhite 0 5 1) 5))
;; ;=> (2 4 2 1 0)
See also: ‘pr’
pstream for ‘pn’.
Yield the result of applying OPERATOR to each value yielded by each pattern in PATTERNS.
Example:
;; (next-upto-n (pnary (pseq (list ’+ ’- ’* ’/) 2) 2 2))
;; ;=> (4 0 4 1)
See also: ‘pfunc’, ‘p+’, ‘p-’, ‘p*’, ‘p/’
Combine multiple event patterns into one pstream with all events in temporal order. PATTERNS is the list of patterns, or a pattern yielding lists of patterns. The ppar ends when all of the patterns in PATTERNS 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) (EVENT :DUR 2/3 :DELTA 2/3))
See also: ‘psym’
:patterns
pstream for ‘ppar’.
Combine multiple patterns into several event streams. The event yielded by the first pattern will be used as the input event to the second pattern, and so on. The events yielded by each pattern will be collected into a list and yielded by the pparchain. This pattern is effectively ‘ppar’ and ‘pchain’ combined.
Example:
;; (next-upto-n (pparchain (pbind :foo (pseries 0 1 3)) (pbind :baz (p+ (pk :foo) 1) :foo (p+ (pk :foo) 3))))
;; ;=> (((EVENT :FOO 0) (EVENT :FOO 3 :BAZ 1))
;; ((EVENT :FOO 1) (EVENT :FOO 4 :BAZ 2))
;; ((EVENT :FOO 2) (EVENT :FOO 5 :BAZ 3)))
See also: ‘ppc’, ‘ppar’, ‘pchain’, ‘pbind”s :embed key
:patterns
pstream for ‘pparchain’.
next
.
Yield each value from LIST in sequence, or one output from each pattern in LIST per cycle of the list. If one of the patterns embedded in LIST ends sooner than the others, it is simply removed and the ppatlace continues to yield from the rest of the LIST. The entire LIST is yielded through a total of REPEATS times.
Example:
;; (next-upto-n (ppatlace (list (pseq (list 1 2 3) 1)
;; (pseq (list 4 5 6) 2))))
;; ;=> (1 4 2 5 3 6 4 5 6)
See also: ‘place’
pstream for ‘ppatlace’.
Repeat each value from PATTERN REPEATS times. If REPEATS is 0, the value is skipped.
Example:
;; (next-upto-n (pr (pseries) (pseq ’(1 3 0 2) 1)))
;; ;=> (0 1 1 1 3 3)
See also: ‘pdurstutter’, ‘pn’, ‘pdrop’, ‘parp’
pstream for ‘pr’.
Yield random values from LIST.
Example:
;; (next-n (prand ’(1 2 3) 5) 6)
;; ;=> (3 2 2 1 1 EOP)
See also: ‘pxrand’, ‘pwrand’, ‘pwxrand’
pstream for ‘prand’.
Remap INPUT from one range, specified by FROM-RANGE, to another range, specified by TO-RANGE.
Note that this is effectively a convenience wrapper over ‘pnary’ and ‘rerange’; thus you should see ‘rerange’ for more information.
See also: ‘rerange’, ‘pnary’
pstream for ‘prerange’.
next
.
An object representing a rest. When set as a value in an event, the event’s :type becomes :rest and the prest’s value slot is used as the actual value for the event key instead.
1
:value
Rotate PATTERN N outputs forward or backward, wrapping the shifted items to the other side, a la ‘alexandria:rotate’.
Example:
;; (next-upto-n (protate (pseq ’(1 2 3 4 5) 1) 2))
;; ;=> (4 5 1 2 3)
See also: ‘pdrop’, ‘phistory’, ‘pscratch’
pstream for ‘protate’.
next
.
Run PATTERN "independently" of its parent, holding each value for DUR beats. Each of PATTERN’s outputs is treated as if it lasted DUR beats, being continuously yielded during that time before moving on to the next output.
Example:
;; (next-upto-n (pbind :foo (pseq ’(1 2 3 4 5))
;; :bar (prun (pseq ’(4 5 6 7 8))
;; (pseq ’(1 2 0.5 0.5 1)))))
;; ;=> ((EVENT :FOO 1 :BAR 4)
;; (EVENT :FOO 2 :BAR 5)
;; (EVENT :FOO 3 :BAR 5)
;; (EVENT :FOO 4 :BAR 6)
;; (EVENT :FOO 5 :BAR 8))
See also: ‘beat’, ‘pbeat’
pstream for ‘prun’.
Preserve pstream state across subsequent calls to ‘as-pstream’. To reset the pstream, simply re-evaluate the ps definition.
Based on the pattern originally from the miSCellaneous SuperCollider library.
Example:
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
;;
;; (next-upto-n *pst* 4)
;; ;=> (4 5 6 7)
;;
;; (defparameter *pst* (ps (pseries)))
;;
;; (next-upto-n *pst* 4)
;; ;=> (0 1 2 3)
See also: ‘prs’, ‘pdef’
"Scratches" across the values yielded by a pstream, similar in concept to how a DJ might scratch a record, altering the normal flow of playback. PATTERN is the source pattern, and STEP-PATTERN determines the increment of the index into the pstream history.
Based on the pattern originally from the ddwPatterns SuperCollider library.
Example:
;; (next-upto-n (pscratch (pseries) (pseq ’(0 1 1 -1 2) 2)))
;; ;=> (0 0 1 2 1 3 3 4 5 4)
See also: ‘phistory’
pstream for ‘pscratch’.
Sequentially yield items from LIST, repeating the whole list REPEATS times. OFFSET is the offset to index into the list.
Example:
;; (next-n (pseq ’(5 6 7) 2) 7)
;; ;=> (5 6 7 5 6 7 EOP)
;;
;; (next-upto-n (pseq ’(5 6 7) 2 1))
;; ;=> (6 7 5 6 7 5)
See also: ‘pser’, ‘eseq’
pstream for ‘pseq’.
Sequentially yield values from LIST, yielding a total of LENGTH values.
Example:
;; (next-n (pser ’(5 6 7) 2) 3)
;;
;; ;=> (5 6 EOP)
See also: ‘pseq’
pstream for ‘pser’.
Yield START, then generate subsequent outputs by adding STEP, for a total of LENGTH outputs.
Example:
;; (next-upto-n (pseries 1 2 4))
;; ;=> (1 3 5 7)
See also: ‘pseries*’, ‘pgeom’, ‘paccum’
pstream for ‘pseries’.
Shuffle LIST, then yield each item from the shuffled list, repeating it REPEATS times.
Example:
;; (next-upto-n (pshuf ’(1 2 3) 2))
;;
;; ;=> (3 1 2 3 1 2)
See also: ‘prand’
pstream for ‘pshuf’.
"Slide" across sections of LIST. REPEATS is the total number of sections to output, LEN the length of the section. STEP is the number to increment the start index by after each section, and START is the initial index into LIST that the first section starts from. WRAP-AT-END, when true, means that an index outside of the list will wrap around. When false, indexes outside of the list result in nil.
Example:
;; (next-upto-n (pslide (list 0 1 2 3 4 5 6) 3 3 2 1 t))
;; ;=> (1 2 3 3 4 5 5 6 0)
See also: ‘pscratch’