CtkControl:
Filter:
Classes (extension) | Libraries > CTK

CtkControl : CtkBus : CtkObj : Object
ExtensionExtension

Representation of a control bus for CTK objects
Source: CTK.sc
 

Description

Part of the Composer's Tool Kit (CTK) system. See CTK for more details.

CtkControl is a wrapper for a control Bus suitable for use with CTK objects.

Class Methods

CtkControl.new(numChans: 1, initVal: 0.0, starttime: 0.0, bus, server)

Create new instance - for use with CtkScore or to enable it for real-time use at a later time (see -play)

Arguments:

numChans

The number of channels to allocate.

initVal

Initial value to set the bus to.

starttime

Start time, useful in CtkScore

bus

The bus index to use (optional). Normally you don't need to specify it, as it will be allocated for you.

server

An instance of Server to allocate this bus on. Defaults to Server.default.

Returns:

a CtkControl

CtkControl.play(numChans: 1, initVal: 0.0, bus, server)

Create a new CtkControl and immediately make it available for real-time use.

Arguments:

numChans

The number of channels to allocate.

initVal

Initial value to set the bus to.

bus

The bus index to use (optional). Normally you don't need to specify it, as it will be allocated for you.

server

An instance of Server to allocate this bus on. Defaults to Server.default.

Returns:

a CtkControl

CtkControl.env(env, starttime: 0.0, addAction: 0, target: 1, bus, server, levelScale: 1, levelBias: 0, timeScale: 1, doneAction: 0)

Create a control bus that plays back an Envelope.

Arguments:

env

An instance of an Env to be passed to a synth as the argument for an EnvGen.

starttime

If used in a CtkScore, specifies a time to write the initVal to the bus.

addAction

A symbol (\head, \tail, \before, \after or \replace) or an addAction id (see Server Command Reference: /s_new for a more in-depth description)

target

A node ID (synth or group) or an instance of CtkGroup or CtkNote.

bus

The bus index to use (optional). Normally you don't need to specify it, as it will be allocated for you.

server

An instance of Server to allocate this bus on. Defaults to Server.default.

levelScale

The levelScale argument to be supplied to EnvGen.

levelBias

The levelBias argument to be supplied to EnvGen.

timeScale

The timeScale argument to be supplied to EnvGen.

doneAction

The doneAction argument to be supplied to EnvGen. See Done: Actions for more information.

Returns:

a CtkControl

Discussion:

See examples

CtkControl.lfo(ugen, freq: 1, low: -1, high: 1, phase: 0, starttime: 0.0, duration, addAction: 0, target: 1, bus, server)

Create a control bus that plays back a low-frequency oscillator

Arguments:

ugen

An oscillating Ugen. Choose from: LFNoise0, LFNoise1, LFNoise2,SinOsc, Impulse, LFSaw, LFPar, LFTri, LFCub.

freq

The frequency of oscillation.

low

The lower bounds of oscillation.

high

The upper bounds of oscillation.

phase

The starting phase of the oscillator.

starttime

If used in a CtkScore, specifies a time to write the initVal to the bus.

duration

Specifies duration (for CtkScore use).

addAction

A symbol (\head, \tail, \before, \after or \replace) or an addAction id (see Server Command Reference: /s_new for a more in-depth description)

target

A node ID (synth or group) or an instance of CtkGroup or CtkNote.

bus

The bus index to use (optional). Normally you don't need to specify it, as it will be allocated for you.

server

Returns:

a CtkControl

Discussion:

See examples

Inherited class methods

Instance Methods

.play(node, argname)

Enable an instance of CtkControl for real-time use

Arguments:

node

target node

argname

.set(val, time: 0.0)

Set the value of CtkControl

Arguments:

val

The value to which the control bus will be set.

time

The time at which to set the control bus. If used in real-time, the time parameter schedules when the change of value should occur. In NRT, schedules the change at time from the value of starttime (or starttime + time)

.free

Returns the bus id to the allocation pool.

.get(action)

Get the value of the bus (asynchronous)

Arguments:

action

The action to be executed when the value is received. The function is passed two parameters: bus index and the actual value

Discussion:

.getn(numChannels, action)

Get the value of the multichannel bus (asynchronous)

Arguments:

numChannels

Number of channels to return; defaults to this.numChannels

action

The action to be executed when the value is received. The function is passed two parameters: bus index and an array of actual bus values

Discussion:

.getSynchronous(indexOffset: 0)

Get the value of the bus. This command is synchronous. See Bus help for more information on synchronous access to control buses.

Arguments:

indexOffset

Channel offset into a multichannel CtkControl

Returns:

A single value of the control bus.

NOTE: This method returns a single value, even in the case of a multichannel CtkControl. The indexOffset argument enables reading into other channels of a multichannel CtkControl, e.g. indexOffset: 3 would give you the value of the 4th channel of a multichannel bus.

.getnSynchronous(numChannels, indexOffset: 0)

Get values of a multichannel bus. This command is synchronous. See Bus help for more information on synchronous access to control buses.

Arguments:

numChannels

Number of channels to return; defaults to this.numChannels

indexOffset

Channel offset into a multichannel CtkControl

Returns:

An array of values

Discussion:

.high

.high = newhigh

Returns:

the upper bounds value when using *lfo

.low

.low = newlow

Returns:

the lower bounds value when using *lfo

.bus

From superclass: CtkBus

Returns:

bus number (index) of this CtkControl (similar to Bus: -index)

.addTo(aCtkScore)

From superclass: CtkObj

Add this object to a CtkScore

Arguments:

aCtkScore

An instance of CtkScore

Inherited instance methods

Examples

Real-time uses

Examples that set the value of the CtkControl in real-time, and take advantage of SynthDef's lag controls.

CtkScore uses

Examples that populate an instance of CtkScore. The CtkScore can then be rendered in NRT, played or saved as a file. See CtkScore for more examples.

Env and LFO Uses