Skip to content

Latest commit

 

History

History
125 lines (110 loc) · 8.17 KB

patterns.org

File metadata and controls

125 lines (110 loc) · 8.17 KB

Patterns

List patterns

Patterns that generate output based on an input list.

  • pseq - Simply yields each element of its input list in order.
  • pser - Like pseq, but instead of yielding the whole list N times, yields a total of N outputs.
  • prand - Yields a random element from its input list.
  • pxrand - Yields a random element from its input list, never yielding the same output twice in a row.
  • pwrand - Yields a random element from its input list, based on a list of weights for each element.
  • pwxrand - Yields a random element from a weighted list, never yielding the same output twice in a row.
  • pshuf - Shuffles the input list, then yields the elements of the shuffled list in order a specified number of times.
  • pslide - “Slide” across successive sections of a list, advancing the start point of the sublists by a specified amount between each.
  • pindex - Get a specified element from the source list by its index.
  • place - Interlace values from sublists of the input list.
  • ppatlace - Interlace values from patterns in the input list.
  • pwalk - Walk across the input list by moving relative to the current position in it.

Curve patterns

Patterns that generate numbers according to curve formulae.

  • pseries - Each output is the previous element plus a number.
  • pseries* - Syntax sugar for a pseries whose outputs move over a range linearly over a set number of steps.
  • pgeom - Each output is the previous element multiplied by a number.
  • pgeom* - Syntax sugar for a pgeom whose outputs move over a range exponentially over a set number of steps.

Randomness patterns

Patterns that generate random numbers.

  • pwhite - White noise pattern; random numbers evenly distributed within a range.
  • pbrown - Brownian motion pattern; random numbers within a range, where each number is a maximum amount away from the previous output.
  • pexprand - Exponentially-distributed random numbers.
  • pgauss - Gaussian-distributed random numbers.

Math/Logic patterns

Patterns whose outputs are the results of math operations on other patterns.

  • p+, p-, p*, p/ - Basic math patterns.
  • p/=, p=, p<=, p<, p>=, p> - Basic numeric comparisons.
  • peql - Basic equality test a la eql.
  • pwrap - Wrap numeric values within a specified range.
  • prerange - Remap an input from one range to another range.
  • pdiff - Get the difference between successive outputs of the source pattern.
  • pdelta - Get the difference between successive outputs of the source pattern, wrapping negatives within a specified range.

Repetition patterns

Patterns that repeat or skip outputs from a source pattern.

  • pr - Repeats (or skips) each output from its source pattern a specified number of times.
  • pn - Loops its source pattern a specified number of times.
  • pdurstutter - Repeats each element from its source pattern a specified number of times, dividing that element (or the duration of it if the element is an event) by that number.
  • pdrop - Drop the first or last N outputs from a source pattern.

Filter patterns

Patterns that generate output by transforming a source pattern.

  • pclump - Clump outputs of the source pattern together into lists of N elements.
  • paclump - Automatically clump the source’s outputs into lists whose length matches the longest list in the current *event*.
  • pfilter - Skip elements of a source pattern that a predicate function returns false for.
  • pfilter-out - Skip elements of a source pattern that a predicate function returns true for.

Constraint patterns

Patterns that limit the number of, or values of, outputs from a source pattern.

  • pconst - Limits the sum of the source pattern not to exceed a specified value.
  • pfin - Limits the number of outputs yielded by its source pattern.
  • pfindur - Limits the total duration of the outputs from its source pattern.
  • psync - Limits the total duration of the outputs from its source pattern, adding a rest to bring the total duration to a specified multiple.

Timing patterns

Patterns that yield information about timing, or alter the timing of a source pattern.

  • pbeat - Get the current beat of the pattern relative to its start.
  • pbeat* - Get the current beat of the clock.
  • ptime - Get the current elapsed time in seconds of the pattern relative to its start.
  • prun - “Run” a pattern independently, yielding each output for a specified number of beats.
  • pts - Timestretch a pattern’s total duration to a specified number of beats.

Referential patterns

Patterns that generate by referencing the outputs of other patterns.

  • pk - Gets the value of a previously-defined key from the enclosing pbind.
  • phistory - Get previous outputs of a pattern by their index in the pstream.
  • pscratch - “DJ-like” scratching or scrubbing through the outputs of its source pattern.
  • protate - Shift a pattern’s outputs forward or backward in the pstream, similar to alexandria:rotate.
  • ps - Preserve the pstream state across invocations.
  • prs - Syntax sugar for (pr (ps ...) ...).

Function patterns

Patterns that generate output based on an input function.

  • pfunc - Yield the result returned by its input function. Unlike pnary, pfunc does not supply arguments to its function.
  • pf - Syntax sugar for pfunc so you don’t have to write (lambda () ...).
  • pnary - N-ary function pattern for applying a function to each of its arguments’ outputs.
  • plazy - Lazily generate a pattern in place of this one by using the result of the input function.
  • pif - “If” expression. If the source pattern returns a true value, yield the next output from the “then” pattern; otherwise, yield the next output from the “else” pattern.
  • paccum - Numeric accumulator. Yields the value of applying its input function to a step parameter and the previous output.

Mini-language patterns

Patterns that allow you to write in a “pseudo-language” which may be more suited to specific tasks.

  • ptrack - “Tracker-like” way to specify event patterns. Like pbind but with parameters as columns instead of rows.
  • pt - Syntax sugar for ptrack so you don’t have to quote or write (list ...).
  • pcycles - TidalCycles-inspired syntax; divide time between the elements of a source list.

UGen patterns

Patterns whose functionalities are based on UGens.

  • pmouse - Get the mouse position of the display server (GUI).
  • pmousex - Get the mouse’s x position on screen.
  • pmousey - Get the mouse’s y position on screen.

Music patterns

Patterns whose outputs are based on music-related formulae or data.

  • pbjorklund - Euclidean rhythm generation via the Bjorklund algorithm.
  • psplits - Parameters to play sections of buffers defined via “split points”. Available in the bdef library.

Meta patterns

Patterns that are used to define or debug others.

  • pbind - Basic event-stream-defining pattern.
  • pb - Syntax sugar effectively combining the functionality of pdef and pbind together.
  • pmono - Like pbind, but for monophony instead of polyphony.
  • pdef - Pattern definition. Give a global name to a pattern, which allows it to be changed while it’s playing.
  • ptrace - Prints the outputs of its source pattern; useful for debugging.
  • pchain - Chain patterns together by using the first source pattern’s output as the input to the second, etc.
  • pfor - Use each output of one pattern as input to a full play-through of another.
  • ppar - Play patterns in parallel so that their outputs appear together in one pstream while preserving timing.
  • pparchain - Define and play multiple patterns in parallel, each pattern using the previous’s output as its input.
  • ppc - Syntax sugar for writing pparchain in the style of pb.
  • psym - Define a sequence of patterns by name to play in succession and/or parallel.
  • pmeta - Meta-control patterns by applying various transformations to them with a pbind-like syntax.
  • ipstream - Insertable pstream; a pstream changeable while playing by the insertion of additional pstreams.