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

Patch : HasPatchIns : AbstractPlayer : AbstractFunction : Object
ExtensionExtension

Pairs an Instr with inputs that that will be passed to the Instr
Source: Patch.sc
Subclasses: InstrSpawner

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

Patch.new(name, inputs, outClass)

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

Inherited class methods

Instance Methods

.instr

.instr = newInstr

Arguments:

newInstr

.args

.args = inputs

Arguments:

inputs

array or dict

.argsForSynth

.argNamesForSynth

.synthArgsIndices

.synthDef

.outClass

.outClass = value

.respawnOnChange

.respawnOnChange = value

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(index, newArg)

Arguments:

index
newArg

.set(index, value)

Arguments:

index
value

.rand(standardDeviation: 0.15)

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(selector ... dnuargs)

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

Arguments:

selector
... dnuargs

.argNames

.argNameAt(i)

Arguments:

i

.specAt(i)

Arguments:

i

.spec

.rate

.numChannels

.indexFromName(argName)

Arguments:

argName

.argFromName(argName)

Arguments:

argName

.loadSubject(name)

Arguments:

name

.createArgs(argargs)

Arguments:

argargs

.defName

.asSynthDef

.watchNoncontrols

.respawn(atTime)

Arguments:

atTime

see atTime

.update(changed, what)

Arguments:

changed
what

.removeSynthDefCache

.invalidateSynthDef

.releaseArgs

.didFree

.prepareChildrenToBundle(bundle)

Arguments:

bundle

.spawnToBundle(bundle)

Arguments:

bundle

.didSpawn

private

.synthDefArgs

.stopToBundle(bundle)

Arguments:

bundle

.value( ... overideArgs)

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(overideArgs)

Arguments:

overideArgs

.asEvent

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

.embedInStream(event)

Arguments:

event

.children

.printOn(s)

Arguments:

s

.storeParamsOn(stream)

Arguments:

stream

.storeArgs

.guiClass

Extensions by CVCenter

.cvcGui(displayDialog: true, prefix, pairs2D, excemptArgs, tab, completionFunc)

From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVCenterForPatch/extPatch.sc

Creates CVWidgets for the controls of a Patch. See examples in CVCenter: cvcGui.

Arguments:

displayDialog

If set to false widgets will be created immediately without allowing to edit specs ahead from creation. Default: true

prefix

As CVCenter.all cannot contain a name twice you may add a custom prefix to avoid CVCenter from trying to overwrite existing keys.

pairs2D

An Event that creates a CVWidget2D rather than a CVWidgetKnob for the given control-names and the given widget-name:

(widgetName1: #[controlName1_lo, controlName1_hi], widgetName2: #[controlName2_lo, controlName2_hi], … widgetNameN: #[controlNameN_lo, controlNameN_hi])

Returns:

this (a Patch)

Inherited instance methods

Undocumented instance methods

.get(index)

Examples

Patch inside a patch