SchedEvent#

class csoundengine.schedevent.SchedEvent(instrname='', start=0.0, dur=-1, args=None, p1=0, uniqueId=0, parent=None, priority=0, controls=None, controlsSlot=-1, username='')[source]#

Bases: BaseSchedEvent

Represents a scheduled event.

It is used to control / automate / keep track of scheduled events. Used as is to represent offline events, it is the base class for realtime events (Synth)

Parameters:
  • p1 (float | str) – the p1 of the scheduled event

  • start (float) – start time

  • dur (float) – duration

  • args (Optional[Sequence[float | str]]) – pfields starting with p4

  • controls (dict[str, float] | None) – the dynamic controls used to schedule this event

  • uniqueId (int) – an integer unique to this event

  • parent (AbstractRenderer) – the renderer which scheduled this event

  • instrname (str) – the instr name of this event (if applies)

  • priority (int) – the priority at which this event was scheduled (if applies)

  • controlsSlot (int) – the slot/token assigned for dynamic controls

  • username – a name given by the user to identify this event. Normally not set

Attributes Summary

args

Args used for this event (p4, p5, ...)

automations

controls

The dynamic controls used to schedule this event

controlsSlot

The slot/token assigned for dynamic controls

instr

The Instr corresponding to this Event, if applicable

instrname

The instrument template this event was created from, if applicable

p1

p1 of this event

parent

The Renderer to which this event belongs (can be None)

priority

The priority of this event, if applicable

uniqueId

A unique id of this event, as integer

username

A user given name to identify this event, normally not set

Methods Summary

aliases()

automate(param, pairs[, mode, delay, overtake])

Automate any named parameter of this Synth

clone(**kws)

controlNames([aliases, aliased])

The names of all controls

dynamicParamNames([aliases, aliased])

The set of all dynamic parameters accepted by this Synth

paramNames([aliases, aliased])

Set of all named parameters :rtype: frozenset[str]

paramValue(param)

Query the value of a parameter, if possible

pfieldNames([aliases, aliased])

Returns a set of all named pfields

playStatus()

Returns the playing status of this event (offline, playing, stopped or future)

stop([delay])

Stop this event

Attributes Documentation

args#

Args used for this event (p4, p5, …)

automations: list[SchedAutomation] | None#
controls: dict[str, float] | None#

The dynamic controls used to schedule this event

controlsSlot: int#

The slot/token assigned for dynamic controls

instr#

The Instr corresponding to this Event, if applicable

Raises ValueError if this event cannot access to the Instr instance (if it has no parent or its instrument name is invalid)

instrname: str#

The instrument template this event was created from, if applicable

p1#

p1 of this event

parent: AbstractRenderer | None#

The Renderer to which this event belongs (can be None)

priority: int#

The priority of this event, if applicable

uniqueId: int#

A unique id of this event, as integer

username#

A user given name to identify this event, normally not set

Methods Documentation

aliases()[source]#
Return type:

dict[str, str]

automate(param, pairs, mode='linear', delay=None, overtake=False)[source]#

Automate any named parameter of this Synth

This method will automate this synth’s pfields / param table, depending of how the instrument was defined.

Parameters:
  • param (str) – the name of the parameter to automate, or the param index

  • pairs (Union[Sequence[float], ndarray, tuple[ndarray, ndarray]]) – automation data as a flat array with the form [time0, value0, time1, value1, …]

  • mode – one of ‘linear’, ‘cos’. Determines the curve between values

  • delay (float | None) – when to start the automation

  • overtake – if True, do not use the first value in pairs but overtake the current value

Return type:

float

Returns:

the eventid of the automation event

clone(**kws)[source]#
Return type:

SchedEvent

controlNames(aliases=True, aliased=False)[source]#

The names of all controls

Parameters:
  • aliases – if True, included control names aliases (if applicable)

  • aliased – if True, include the aliased names

Return type:

frozenset[str]

Returns:

the names of all controls. Returns an empty set if this event does not have any controls

dynamicParamNames(aliases=True, aliased=False)[source]#

The set of all dynamic parameters accepted by this Synth

Parameters:
  • aliases – if True, include aliases

  • aliased – include the original names of parameters which have an alias. If both aliases and aliased params are included, there are two names to access the same parameter

Return type:

frozenset[str]

Returns:

a set of the dynamic (modifiable) parameters accepted by this synth

paramNames(aliases=True, aliased=False)[source]#

Set of all named parameters :rtype: frozenset[str]

See also

dynamicParams(), set(), automate()

paramValue(param)[source]#

Query the value of a parameter, if possible

If the event is live the actual value is queried; otherwise, the value used at event initialization

Parameters:

query (the parameter to)

Return type:

float | str | None

Returns:

the value of the parameter.

TODO: check if it actual returns None and why

pfieldNames(aliases=True, aliased=False)[source]#

Returns a set of all named pfields

Parameters:
  • aliases – if True, included aliases for pfields (if applicable)

  • aliased – if True, include the aliased names. Otherwise if aliases are defined and included (aliases=True), the original names will be excluded

Return type:

frozenset[str]

Returns:

a set with the all pfield names.

playStatus()[source]#

Returns the playing status of this event (offline, playing, stopped or future)

For offline events this will always return ‘offline’

Return type:

str

Returns:

‘playing’ if currently playing, ‘stopped’ if this event has already stopped or ‘future’ if it has not started. For offline events always returns ‘offline’

stop(delay=0.0)[source]#

Stop this event

When using this in offline mode, delay is an absolute time

Parameters:

delay – when to stop

Return type:

None