🎬 tracks
tracks
The tracks
module provides a way to setup and control tracks in the
soir engine. A track has an instrument type and a set of parameters
and effects. Once a track is created, loops can be scheduled on
it. Tracks can be added & removed in real-time using the setup()
function, existing tracks are untouched.
Cookbook
Setup tracks
tracks.setup({
'bass': tracks.mk_sampler(fxs={
'reverb': fx.mk_reverb(mix=0.2),
}),
'melody': tracks.mk_sampler()
})
Get current tracks
Reference
Track(name='unnamed', instrument='unknown', muted=None, volume=1.0, pan=0.0, fxs=None, extra=None)
dataclass
Representation of a Soir track.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The track name. |
instrument |
str
|
The instrument type. |
muted |
bool | None
|
The muted state. Defaults to None. |
volume |
float | Control
|
The volume in the [0.0, 1.0] range. Defaults to 1.0. |
pan |
float | Control
|
The pan in the [-1.0, 1.0] range. Defaults to 0.0. |
fxs |
dict | None
|
The effects. Defaults to None. |
extra |
str | None
|
Extra parameters, JSON encoded. Defaults to None. |
layout()
Get the current tracks.
Returns:
Type | Description |
---|---|
dict[Track]
|
dict[Track]: The current tracks. |
Raises:
Type | Description |
---|---|
InLoopException
|
If called from inside a loop. |
mk(instrument, muted=None, volume=1.0, pan=0.0, fxs=None, extra=None)
Creates a new track.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instrument |
str
|
The instrument type. |
required |
muted |
bool
|
The muted state. Defaults to None. |
None
|
volume |
float | Control
|
The volume in the [0.0, 1.0] range. Defaults to 1.0. |
1.0
|
pan |
float | Control
|
The pan in the [-1.0, 1.0] range. Defaults to 0.0. |
0.0
|
fxs |
dict
|
The effects to apply to the track. Defaults to None. |
None
|
extra |
dict
|
Extra parameters. Defaults to None. |
None
|
mk_midi(muted=None, volume=1.0, pan=0.0, midi_device=0, audio_device=0, fxs=None)
Creates a new midi track.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track |
int
|
The track id. |
required |
muted |
bool
|
The muted state. Defaults to None. |
None
|
volume |
float | Control
|
The volume in the [0.0, 1.0] range. Defaults to 1.0. |
1.0
|
pan |
float | Control
|
The pan in the [-1.0, 1.0] range. Defaults to 0.0. |
0.0
|
midi_device |
int
|
The midi device. Defaults to -1. |
0
|
audio_device |
int
|
The audio device. Defaults to -1. |
0
|
fxs |
dict
|
The effects to apply to the track. Defaults to None. |
None
|
mk_sampler(muted=None, volume=1.0, pan=0.0, fxs=None, extra=None)
Creates a new sampler track.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
muted |
bool
|
The muted state. Defaults to None. |
None
|
volume |
float | Control
|
The volume in the [0.0, 1.0] range. Defaults to 1.0. |
1.0
|
pan |
float | Control
|
The pan in the [-1.0, 1.0] range. Defaults to 0.0. |
0.0
|
fxs |
dict
|
The effects to apply to the track. Defaults to None. |
None
|
extra |
dict
|
Extra parameters. Defaults to None. |
None
|
setup(tracks)
Setup tracks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tracks |
dict[str, Track]
|
The tracks to setup. |
required |
Raises:
Type | Description |
---|---|
InLoopException
|
If called from inside a loop. |