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

CtkControl
ExtensionExtension

Representation of a control bus for CTK objects
 

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

.new

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

.play

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

.env

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

.lfo

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

Instance Methods

.play

Enable an instance of CtkControl for real-time use

Arguments:

node

target node

argname

.set

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

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

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

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

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

Returns:

the upper bounds value when using *lfo

.low

Returns:

the lower bounds value when using *lfo

.bus

Returns:

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

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