Patch:
Filter:
crucial-library/Classes (extension) | Libraries > crucial > Instr | Libraries > crucial > Players

Patch
ExtensionExtension

Pairs an Instr with inputs that that will be passed to the Instr

Description

A Patch is a player that plays an Instr.

An Instr (Instrument) is a named function.

A Patch specifies an Instr and the inputs that will be passed to the Instr function.

Note that an Instr can also be connected with other things using Mx and SynthDefs can be made from Instr in other ways than using Patch.

Patch can also express arguments using argName:value dicts:

Class Methods

.new

Arguments:

name

The Instr can be specified as:

an Instr name

a direct function that will be used to create an Instr in place

or directly pass an Instr object

inputs

an array of arguments for the Instr function.

Can also be a dictionary: (argName: value, ... )

outClass

default is Out.ar You could supply ReplaceOut to do effect processing on a Bus

Instance Methods

.instr

Arguments:

newInstr

.args

Arguments:

inputs

array or dict

.argsForSynth

.argNamesForSynth

.synthArgsIndices

.synthDef

.outClass

.respawnOnChange

The Patch is a dependant of the Instr. When the Instr is redefined (you edit the func def and evaluate the Instr code, it saves it to the Library) it will call .changed on itself and the Patch can be set to automatically respawn iself.

if nil (default) then it will not

if a number then it is an atTime specifier: 1 means respawn on the next bar, 4 means on the next beat. 0.1 would respawn in 0.1 seconds after change.

.stepChildren

private the children are the inputs to the Patch. the stepChildren are hidden objects like ClientOnTrigResponder or TempoBus

.inputs

.setInput

Arguments:

index
newArg

.set

Arguments:

index
value

.rand

call .rand on all inputs that support .rand; specifically NumberEditors will do a gaussian distribution randomization centered on the default value of the ControlSpec.

Arguments:

standardDeviation

for the gaussian randomization in NumberEditors. default 0.15

Returns:

this

.doesNotUnderstand

overides unmatched method selectors to return the inputs by name. eg aPatch.freq will return a KrNumberEditor

Arguments:

selector
... dnuargs

.argNames

.argNameAt

Arguments:

i

.specAt

Arguments:

i

.spec

.rate

.numChannels

.indexFromName

Arguments:

argName

.argFromName

Arguments:

argName

.loadSubject

Arguments:

name

.createArgs

Arguments:

argargs

.defName

.asSynthDef

.watchNoncontrols

.respawn

Arguments:

atTime

see atTime

.update

Arguments:

changed
what

.removeSynthDefCache

.invalidateSynthDef

.releaseArgs

.didFree

.prepareChildrenToBundle

Arguments:

bundle

.spawnToBundle

Arguments:

bundle

.didSpawn

private

.synthDefArgs

.stopToBundle

Arguments:

bundle

.value

value the Instr as a function returning the result

Arguments:

... overideArgs

array or dict of args that should overide any of the Patch's inputs.

.valueArray

Arguments:

overideArgs

.asEvent

returns an Event that encapsulates the current state of the Patch. this can be spawned with .play or further manipulated

.embedInStream

Arguments:

event

.children

.printOn

Arguments:

s

.storeParamsOn

Arguments:

stream

.storeArgs

.guiClass

Examples

Patch inside a patch