Classes (extension) | Conductor | Control | Libraries | Quarks | Streams-Events-Patterns

CV : Stream : AbstractFunction : Object

A single floating point value or an array of such values constrained to a specific numerical range by a ControlSpec.
Subclasses: EV, SV


A CV models a single Float or an Array of such values constrained to a specific numerical range by a ControlSpec.

CV is derived from Stream so it can be used directly in Stream and Pattern definitions. CV:connect(view) will connect a CV to a GUI ControlView in both Cocoa and Qt (as well as Swing).

GUI representations. A similar set of methods have been defined that connect argument arrays consisting of keys and CVs to Nodes, Buses, Buffers, and NodeProxys.

An SV is a CV that models an index into an array of Symbols. The array is held in the instance variable items. The symbol corresponding to the CV's current value can be accessed with the method SV: -item.

Class Methods

Creation 'unipolar', value)



Any object that responds to asSpec (nil, a Symbol, a ControlSpec, an Array) with a ControlSpec. Some common ControlSpecs include:


The initial value is constrained to lie within the range of the spec.


a CV


CV.viewDictionary = value

An IdentityDictionary, holding the various view-classes for various gui-elements that may be used with CV as its keys and the class that syncs the view's value to the CV's value as its values:


Calls *buildViewDictionary on startup.


As the name suggests this method builds the viewDictionary and prepares the various connectable view-elements (sliders, number-boxes etc.) for the use with CV. The method also takes care of the different GUI-schemes (Cocoa, Qt, Swing).

Inherited class methods

Undocumented class methods


Instance Methods

Setting the range of values on existing CVs


.spec = value

Set the ControlSpec and (optionally) a default value - see also *new



any object that responds to asSpec (nil, a Symbol, a ControlSpec or an Array) with a ControlSpec


the initial value of the CV

.sp(default: 0, lo: 0, hi: 0, step: 0, warp: 'lin')

Set the values of the CV's ControlSpec explicitely.



inital value


smallest possible value


highest possible value


smallest incremental change


either 'linear' or 'exponential'

In the case of exponential warp, min and max must be non-zero and the same sign.


Set the CV's spec to

ControlSpec(-100, 20, \lin, 1, 0)


the CV



.value = val

Set or get the current value of the CV.



Usually a Float or an Integer. If the CV's ControlSpec's minval, maxval, step and/or default is an array it may also be an Array of numeric values.


if used as a getter the current value of the CV


.input = in

Similar as -value but requires or returns a number ranging form 0 to 1 that corresponds to postion of the current value between min and max.



a number between 0 and 1


if used as a getter the current value of the CV normalized to a value between 0 and 1


Interprets the value of the CV as a probability table and returns a weighted random value.


For use in Patterns: uses the value of key in the current Event as an index and returns the indexed value



a Symbol


the value indexed by key



the yielded value of the CV


Return the in unmapped value of the given argument val (determined by the CV's ControlSpec). If an array of values is given an array of unmapped values will be returned. The given value will not alter the CV's value.



a single numerical value or an array of numerical values



Appends the CV's current value as OSC compliant argument to the given Array



Usually an Array of numerical values.


an OSC compliant representation of the CV's value appended to a given array



Split a multi-value CV into an array of CVs.


An Array of CVs



As CV inherits from Stream this method implements the method defined in the Stream interface. Calling this method simply returns the CV's value.


A Float or an Integer or an Array of numeric values


Return the size of the CV's internal ControlSpec. I.e. a CV's value or input will be a single numeric value if the ControlSpec


An Integer denoting the size of the CV's value

.touch(dur, delta)

From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVmin/classes/


CV connections using SimpleControllers

When a CV's value is changed a changed message (identified by the symbol \synch) is send to update any dependant objects. For example, action_(function) creates a SimpleController which is added to the dependants of the CV and evaluated whenever the CV changes value. This same basic mechanism is used to connect the CV to GUIs, server, objects, and some other objects in the language. Most of this is more or less hidden from view.

Under normal circumstances, CV connections are automatically removed when the targeted Control, Bus or View is deleted. If there is a program error, it is possible that connections will persist and will need to be explicitly removed.


Create and return a dependant SimpleController that evaluates the function whenever the CV's value is altered. Though the method takes a function as argument it is important to understand that it creates a new SimpleController. The function can not be updated or altered later, only the controller can be removed and a new one be added. The first argument passed to the function will always be the CV itself, making it easy to query the CV's current value or input.



an arbitrary Function




Remove all SimpleControllers that have been added with -addController. Possibly it's more important to be able to remove single controllers. However, some CVs create controllers behind the sceneswhen being instantiated. The method aims to be a clean-up possibility, removing sideeffects.

NOTE: removeAllControllers will only remove actions that have been added to the CV while keeping synchronisations with sliders and other views. However, CV also inherits a method Object: -release which will completly uninitialize the CV, removing all dependants.

GUI connections


Connects a CV to a view. Array defines connect to allow a set of CVs to be connected to a view with multiple control values (i.e., Slider2D).

The following methods establish connections Views and CVs.

One CV can be connected to many views but each view is connected to only one CV. When a CV's value changes, it is relayed to all of its dependants including the source of the the change. That way, the GUI accurately reflects the new value of the CV. See the behavior of 'b' in the following example.

NOTE: The following example provides a generic graphic interface to two CVs. Subsequent examples depend on that window, so leave it open until you are finished working through the help file. (The interpreter variables 'a' and 'b' contain the CVs used by the examples, so they should be left unaltered.)

An example connecting a MultiSliderView



a View, usable with a CV. See *viewDictionary to for an overview of qualified views.

Server connections

OSC commands (i.e., /n_set, /s_new) specify initial values of parameters as a flat Array of pairs consisting of a name and its initial value:

"Extended argument arrays" allow CVs to be used in place of the initial value. This is the standard syntax for establishing connections between CVs and a server. In an extended argument array, the CV's value can be altered before being sent, multiple CV's can determine the value to be sent, and the value to be sent can be determined by a function (here freq is just meant as an example key):

value[freq: 440]
CV[freq: aCV]
altered CV[freq: [aCV, aCV.midicps]]
combination[freq: [[aCV, bCV], aCV.midicps + bCV]]
function[freq: [aCV, { aCV.midicps.value + 33.rand }]

For example, the method Synth: *controls is identical to Synth: *new except the args parameter is extended:

In the previous two examples, the modifying expression is actually a combination of Streams altered with binary and unary operators. This is concise, but in some cases, it may be necessary to use a Function to define the modification.

NOTE: Within a function definition it is necessary to explicitly extract the value of the CV using a value message.

Summary of Node related connection methods

Array: -connectToNode: the receiver is a flat array of name/value pairs

Array: -connectToBuffer: the receiver is an array of CVs

Array: -connectToBus: the receiver is an array of CVs.

Node: -setControls: connects CVs to named controls
NodeProxy: -setControls: connects CVs to named controls

Synth: *controls: the same as Synth: *new but allows CVs to be used in the args array
Bus: *controls:

Bus: -setControls: connects CVs to consecutive buses

Reading and writing CVs in functions and patterns

Within a Function, CVs are accessed using value and value and altered using value_ and input_.

Within a pattern definition, a CV can directly substitute for a Pattern:

Pfunc can be used to change the CV from within a Pattern:

CVs and external input

The input_(in) method makes it easy to connect a CV to any control source:

The methods input and input_ are also used by CVPreset to allow interpolations between settings that follow warp of the CV's ControlSpec.

Inherited instance methods

Undocumented instance methods

.action = function

From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVmin/deprecated/


From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVCenter/CVCenter/


From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVCenter/CVCenter/

.default = val






From extension in /home/stefan/.local/share/SuperCollider/Extensions/CVmin/classes/