Skip to content

🎛️ controls

ctrls

The ctrls module contains facilities to control settings of soir in real-time.

Cookbook

@live()
def controls():
    ctrls.mk_lfo('[x0]', rate=0.5, intensity=0.75)

sp = samples.new('my-pack')

@loop()
def play():
    sp.play('my-sample', pan=ctrl('[x0]'))

Control()

Bases: Control_

Base class for a control.

A control computes a value to the Soir engine about 100 times per second via the Control.fwd() call, this value is then interpolated by the C++ engine to provide a smooth transition between values.

The Control class is not meant to be created directly unless you want to implement your own control, helpers are available to create specific controls (see below).

Once a control is created, it can be referred to by using the ctrl('name') facility and can passed as a parameter to instrument calls or FXs.

fwd()

Computes the next value of the control and advance the tick.

This is meant to be used by the soir engine.

get()

Get the current value of the control.

Returns:

Type Description
float

The current value of the control.

name()

Get the name of the control.

Returns:

Type Description
str

The name of the control.

set(**params)

Set the control parameters.

Parameters:

Name Type Description Default
**params

The parameters to set.

{}

layout()

Get the list of all controls.

Returns:

Type Description
list[Control]

A list of all controls.

mk_lfo(name, rate, intensity=1.0)

Create a new LFO parameter.

Parameters:

Name Type Description Default
name str

The name of the parameter.

required
rate float

The rate of the LFO in seconds.

required
intensity float

The intensity of the LFO.

1.0

mk_linear(name, start, end, duration)

Create a new linear parameter.

Parameters:

Name Type Description Default
name str

The name of the parameter.

required
start float

The start value.

required
end float

The end value.

required
duration float

The duration of the transition in seconds.

required

mk_val(name, value)

Create a new value parameter.

Parameters:

Name Type Description Default
name str

The name of the parameter.

required
value float

The value.

required