Event Sequencing

Set of objects that call Python functions from triggers or number counts. Useful for event sequencing.

CallAfter

class CallAfter(function, time=1, arg=None)[source]

Calls a Python function after a given time.

Parent

PyoObject

Args
function: Python callable (function or method)

Python callable execute after time seconds.

time: float, optional

Time, in seconds, before the call. Default to 1.

arg: any Python object, optional

Argument sent to the called function. Default to None.

Note

The out() method is bypassed. CallAfter doesn’t return signal.

CallAfter has no mul and add attributes.

If arg is None, the function must be defined without argument:

>>> def tocall():
>>>     pass # function's body

If arg is not None, the function must be defined with one argument:

>>> def tocall(arg):
>>>     print(arg)

The object is not deleted after the call. The user must delete it himself.

>>> s = Server().boot()
>>> s.start()
>>> # Start an oscillator with a frequency of 250 Hz.
>>> syn = SineLoop(freq=[250,251], feedback=.07, mul=.2).out()
>>> def callback(arg):
...     # Change the oscillator's frequency to 300 Hz after 2 seconds.
...     # Convert the tuple back to a list.
...     syn.freq = list(arg)
>>> # Use a tuple for the argument to avoid multi-channel expansion.
>>> a = CallAfter(callback, 2, (300,301))

Public Data Attributes:

time

float.

arg

Anything.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(function[, time, arg])

out([x, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setSub(x)

Replace and inverse the add attribute.

setDiv(x)

Replace and inverse the mul attribute.

setTime(x)

Replace the time attribute.

setArg(x)

Replace the arg attribute.

Inherited from PyoObject

__init__(function[, time, arg])

__add__(x)

__radd__(x)

__iadd__(x)

__sub__(x)

__rsub__(x)

__isub__(x)

__mul__(x)

__rmul__(x)

__imul__(x)

__truediv__(x)

__rtruediv__(x)

__itruediv__(x)

__div__(x)

__rdiv__(x)

__idiv__(x)

__pow__(x)

__rpow__(x)

__mod__(x)

__neg__()

__lt__(x)

Return self<value.

__le__(x)

Return self<=value.

__eq__(x)

Return self==value.

__ne__(x)

Return self!=value.

__gt__(x)

Return self>value.

__ge__(x)

Return self>=value.

__do_comp__(comp, mode[, default])

isPlaying([all])

Returns True if the object is currently playing, otherwise, returns False.

isOutputting([all])

Returns True if the object is outputting.

get([all])

Return the first sample of the current buffer as a float.

play([dur, delay])

Start processing without sending samples to output.

out([x, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

stop([wait])

Stop processing.

mix([voices])

Mix the object's audio streams into voices streams and return a Mix object.

range(min, max)

Adjust mul and add attributes according to a given range.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setSub(x)

Replace and inverse the add attribute.

setDiv(x)

Replace and inverse the mul attribute.

set(attr, value[, port, callback])

Replace any attribute with portamento.

ctrl([map_list, title, wxnoserver])

Opens a sliders window to control the parameters of the object.

Inherited from PyoObjectBase

__init__(function[, time, arg])

dump()

Print infos about the current state of the object.

getBaseObjects()

Return a list of Stream objects managed by the instance.

getServer()

Return a reference to the current Server object.

getSamplingRate()

Return the current sampling rate (samples per second), as a float.

getBufferSize()

Return the current buffer size (samples per buffer), as an integer.

allowAutoStart([switch])

When autoStartChildren is activated in the Server, call this method with False as argument to stop the propagation of play/out/stop methods to and from this object.

useWaitTimeOnStop()

When autoStartChildren is activated in the Server, call this method to force an object given to the mul attribute of another object to use the wait time from the stop method instead of being stopped immediately.

addLinkedObject(x)

When autoStartChildren is activated in the Server, use this method to explicitly add an object in a dsp chain, which is generally controlled by the last object of the chain.

setStopDelay(x)

Set a specific waiting time when calling the stop method on this object.

getStopDelay()

Return the waiting time applied when calling the stop method on this object.

__iter__()

__next__()

next()

Alias for __next__ method.

__getitem__(i)

__setitem__(i, x)

__len__()

__repr__()

Return repr(self).

__dir__()

Default dir() implementation.

Private Data Attributes:

Inherited from PyoObject

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

Inherited from PyoObject

_init_play()

_reset_from_set([attr])

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


out(x=0, inc=1, dur=0, delay=0)[source]

Start processing and send samples to audio output beginning at chnl.

This method returns self, allowing it to be applied at the object creation.

Args
chnl: int, optional

Physical output assigned to the first audio stream of the object. Defaults to 0.

inc: int, optional

Output channel increment value. Defaults to 1.

dur: float, optional

Duration, in seconds, of the object’s activation. The default is 0 and means infinite duration.

delay: float, optional

Delay, in seconds, before the object’s activation. Defaults to 0.

If chnl >= 0, successive streams increment the output number by inc and wrap around the global number of channels.

If chnl is negative, streams begin at 0, increment the output number by inc and wrap around the global number of channels. Then, the list of streams is scrambled.

If chnl is a list, successive values in the list will be assigned to successive streams.

setMul(x)[source]

Replace the mul attribute.

Args
x: float or PyoObject

New mul attribute.

setAdd(x)[source]

Replace the add attribute.

Args
x: float or PyoObject

New add attribute.

setSub(x)[source]

Replace and inverse the add attribute.

Args
x: float or PyoObject

New inversed add attribute.

setDiv(x)[source]

Replace and inverse the mul attribute.

Args
x: float or PyoObject

New inversed mul attribute.

setTime(x)[source]

Replace the time attribute.

Args
x: float

New time attribute.

setArg(x)[source]

Replace the arg attribute.

Args
x: Anything

new arg attribute.

property time

float. Time, in seconds, before the function call.

property arg

Anything. Callable’s argument.

Pattern

class Pattern(function, time=1, arg=None)[source]

Periodically calls a Python function.

The play() method starts the pattern timer and is not called at the object creation time.

Parent

PyoObject

Args
function: Python callable (function or method)

Python function to be called periodically.

time: float or PyoObject, optional

Time, in seconds, between each call. Default to 1.

arg: anything, optional

Argument sent to the function’s call. If None, the function will be called without argument. Defaults to None.

Note

The out() method is bypassed. Pattern doesn’t return signal.

Pattern has no mul and add attributes.

If arg is None, the function must be defined without argument:

>>> def tocall():
>>>     pass # function's body

If arg is not None, the function must be defined with one argument:

>>> def tocall(arg):
>>>     print(arg)
>>> s = Server().boot()
>>> s.start()
>>> t = HarmTable([1,0,.33,0,.2,0,.143,0,.111])
>>> a = Osc(table=t, freq=[250,251], mul=.2).out()
>>> def pat():
...     f = random.randrange(200, 401, 25)
...     a.freq = [f, f+1]
>>> p = Pattern(pat, .125)
>>> p.play()

Public Data Attributes:

function

Python callable.

time

float or PyoObject.

arg

Anything.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(function[, time, arg])

setFunction(x)

Replace the function attribute.

setTime(x)

Replace the time attribute.

setArg(x)

Replace the arg attribute.

out([x, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setSub(x)

Replace and inverse the add attribute.

setDiv(x)

Replace and inverse the mul attribute.

ctrl([map_list, title, wxnoserver])

Opens a sliders window to control the parameters of the object.

Inherited from PyoObject

__init__(function[, time, arg])

__add__(x)

__radd__(x)

__iadd__(x)

__sub__(x)

__rsub__(x)

__isub__(x)

__mul__(x)

__rmul__(x)

__imul__(x)

__truediv__(x)

__rtruediv__(x)

__itruediv__(x)

__div__(x)

__rdiv__(x)

__idiv__(x)

__pow__(x)

__rpow__(x)

__mod__(x)

__neg__()

__lt__(x)

Return self<value.

__le__(x)

Return self<=value.

__eq__(x)

Return self==value.

__ne__(x)

Return self!=value.

__gt__(x)

Return self>value.

__ge__(x)

Return self>=value.

__do_comp__(comp, mode[, default])

isPlaying([all])

Returns True if the object is currently playing, otherwise, returns False.

isOutputting([all])

Returns True if the object is outputting.

get([all])

Return the first sample of the current buffer as a float.

play([dur, delay])

Start processing without sending samples to output.

out([x, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

stop([wait])

Stop processing.

mix([voices])

Mix the object's audio streams into voices streams and return a Mix object.

range(min, max)

Adjust mul and add attributes according to a given range.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setSub(x)

Replace and inverse the add attribute.

setDiv(x)

Replace and inverse the mul attribute.

set(attr, value[, port, callback])

Replace any attribute with portamento.

ctrl([map_list, title, wxnoserver])

Opens a sliders window to control the parameters of the object.

Inherited from PyoObjectBase

__init__(function[, time, arg])

dump()

Print infos about the current state of the object.

getBaseObjects()

Return a list of Stream objects managed by the instance.

getServer()

Return a reference to the current Server object.

getSamplingRate()

Return the current sampling rate (samples per second), as a float.

getBufferSize()

Return the current buffer size (samples per buffer), as an integer.

allowAutoStart([switch])

When autoStartChildren is activated in the Server, call this method with False as argument to stop the propagation of play/out/stop methods to and from this object.

useWaitTimeOnStop()

When autoStartChildren is activated in the Server, call this method to force an object given to the mul attribute of another object to use the wait time from the stop method instead of being stopped immediately.

addLinkedObject(x)

When autoStartChildren is activated in the Server, use this method to explicitly add an object in a dsp chain, which is generally controlled by the last object of the chain.

setStopDelay(x)

Set a specific waiting time when calling the stop method on this object.

getStopDelay()

Return the waiting time applied when calling the stop method on this object.

__iter__()

__next__()

next()

Alias for __next__ method.

__getitem__(i)

__setitem__(i, x)

__len__()

__repr__()

Return repr(self).

__dir__()

Default dir() implementation.

Private Data Attributes:

Inherited from PyoObject

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

Inherited from PyoObject

_init_play()

_reset_from_set([attr])

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


setFunction(x)[source]

Replace the function attribute.

Args
x: Python callable (function or method)

new function attribute.

setTime(x)[source]

Replace the time attribute.

Args
x: float or PyoObject

New time attribute.

setArg(x)[source]

Replace the arg attribute.

Args
x: Anything

new arg attribute.

out(x=0, inc=1, dur=0, delay=0)[source]

Start processing and send samples to audio output beginning at chnl.

This method returns self, allowing it to be applied at the object creation.

Args
chnl: int, optional

Physical output assigned to the first audio stream of the object. Defaults to 0.

inc: int, optional

Output channel increment value. Defaults to 1.

dur: float, optional

Duration, in seconds, of the object’s activation. The default is 0 and means infinite duration.

delay: float, optional

Delay, in seconds, before the object’s activation. Defaults to 0.

If chnl >= 0, successive streams increment the output number by inc and wrap around the global number of channels.

If chnl is negative, streams begin at 0, increment the output number by inc and wrap around the global number of channels. Then, the list of streams is scrambled.

If chnl is a list, successive values in the list will be assigned to successive streams.

setMul(x)[source]

Replace the mul attribute.

Args
x: float or PyoObject

New mul attribute.

setAdd(x)[source]

Replace the add attribute.

Args
x: float or PyoObject

New add attribute.

setSub(x)[source]

Replace and inverse the add attribute.

Args
x: float or PyoObject

New inversed add attribute.

setDiv(x)[source]

Replace and inverse the mul attribute.

Args
x: float or PyoObject

New inversed mul attribute.

ctrl(map_list=None, title=None, wxnoserver=False)[source]

Opens a sliders window to control the parameters of the object. SLMap has a dataOnly attribute to identify parameters that don’t audio signal as control but only discrete values.

If a list of values are given to a parameter, a multisliders will be used to control each stream independently.

Args
map_list: list of SLMap objects, optional

Users defined set of parameters scaling. There is default scaling for each object that accept ctrl method.

title: string, optional

Title of the window. If none is provided, the name of the class is used.

wxnoserver: boolean, optional

With wxPython graphical toolkit, if True, tells the interpreter that there will be no server window.

If wxnoserver is set to True, the interpreter will not wait for the server GUI before showing the controller window.

property function

Python callable. Function to be called.

property time

float or PyoObject. Time, in seconds, between each call.

property arg

Anything. Callable’s argument.

Score

class Score(input, fname='event_')[source]

Calls functions by incrementation of a preformatted name.

Score takes audio stream containning integers in input and calls a function whose name is the concatenation of fname and the changing integer.

Can be used to sequence events, first by creating functions p0, p1, p2, etc. and then, by passing a counter to a Score object with “p” as fname argument. Functions are called without parameters.

Parent

PyoObject

Args
input: PyoObject

Audio signal. Must contains integer numbers. Integer must change before calling its function again.

fname: string, optional

Name of the functions to be called. Defaults to ‘event_’, meaning that the object will call the function ‘event_0’, ‘event_1’, ‘event_2’, and so on… Available at initialization time only.

Note

The out() method is bypassed. Score’s signal can not be sent to audio outs.

Score has no mul and add attributes.

See also

Pattern, TrigFunc

>>> s = Server().boot()
>>> s.start()
>>> a = SineLoop(freq=[200,300,400,500], feedback=0.05, mul=.1).out()
>>> def event_0():
...     a.freq=[200,300,400,500]
>>> def event_1():
...     a.freq=[300,400,450,600]
>>> def event_2():
...     a.freq=[150,375,450,525]
>>> m = Metro(1).play()
>>> c = Counter(m, min=0, max=3)
>>> sc = Score(c)

Public Data Attributes:

input

PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, fname])

out([chnl, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setInput(x[, fadetime])

Replace the input attribute.

Inherited from PyoObject

__init__(input[, fname])

__add__(x)

__radd__(x)

__iadd__(x)

__sub__(x)

__rsub__(x)

__isub__(x)

__mul__(x)

__rmul__(x)

__imul__(x)

__truediv__(x)

__rtruediv__(x)

__itruediv__(x)

__div__(x)

__rdiv__(x)

__idiv__(x)

__pow__(x)

__rpow__(x)

__mod__(x)

__neg__()

__lt__(x)

Return self<value.

__le__(x)

Return self<=value.

__eq__(x)

Return self==value.

__ne__(x)

Return self!=value.

__gt__(x)

Return self>value.

__ge__(x)

Return self>=value.

__do_comp__(comp, mode[, default])

isPlaying([all])

Returns True if the object is currently playing, otherwise, returns False.

isOutputting([all])

Returns True if the object is outputting.

get([all])

Return the first sample of the current buffer as a float.

play([dur, delay])

Start processing without sending samples to output.

out([chnl, inc, dur, delay])

Start processing and send samples to audio output beginning at chnl.

stop([wait])

Stop processing.

mix([voices])

Mix the object's audio streams into voices streams and return a Mix object.

range(min, max)

Adjust mul and add attributes according to a given range.

setMul(x)

Replace the mul attribute.

setAdd(x)

Replace the add attribute.

setSub(x)

Replace and inverse the add attribute.

setDiv(x)

Replace and inverse the mul attribute.

set(attr, value[, port, callback])

Replace any attribute with portamento.

ctrl([map_list, title, wxnoserver])

Opens a sliders window to control the parameters of the object.

Inherited from PyoObjectBase

__init__(input[, fname])

dump()

Print infos about the current state of the object.

getBaseObjects()

Return a list of Stream objects managed by the instance.

getServer()

Return a reference to the current Server object.

getSamplingRate()

Return the current sampling rate (samples per second), as a float.

getBufferSize()

Return the current buffer size (samples per buffer), as an integer.

allowAutoStart([switch])

When autoStartChildren is activated in the Server, call this method with False as argument to stop the propagation of play/out/stop methods to and from this object.

useWaitTimeOnStop()

When autoStartChildren is activated in the Server, call this method to force an object given to the mul attribute of another object to use the wait time from the stop method instead of being stopped immediately.

addLinkedObject(x)

When autoStartChildren is activated in the Server, use this method to explicitly add an object in a dsp chain, which is generally controlled by the last object of the chain.

setStopDelay(x)

Set a specific waiting time when calling the stop method on this object.

getStopDelay()

Return the waiting time applied when calling the stop method on this object.

__iter__()

__next__()

next()

Alias for __next__ method.

__getitem__(i)

__setitem__(i, x)

__len__()

__repr__()

Return repr(self).

__dir__()

Default dir() implementation.

Private Data Attributes:

Inherited from PyoObject

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

Inherited from PyoObject

_init_play()

_reset_from_set([attr])

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


out(chnl=0, inc=1, dur=0, delay=0)[source]

Start processing and send samples to audio output beginning at chnl.

This method returns self, allowing it to be applied at the object creation.

Args
chnl: int, optional

Physical output assigned to the first audio stream of the object. Defaults to 0.

inc: int, optional

Output channel increment value. Defaults to 1.

dur: float, optional

Duration, in seconds, of the object’s activation. The default is 0 and means infinite duration.

delay: float, optional

Delay, in seconds, before the object’s activation. Defaults to 0.

If chnl >= 0, successive streams increment the output number by inc and wrap around the global number of channels.

If chnl is negative, streams begin at 0, increment the output number by inc and wrap around the global number of channels. Then, the list of streams is scrambled.

If chnl is a list, successive values in the list will be assigned to successive streams.

setMul(x)[source]

Replace the mul attribute.

Args
x: float or PyoObject

New mul attribute.

setAdd(x)[source]

Replace the add attribute.

Args
x: float or PyoObject

New add attribute.

setInput(x, fadetime=0.05)[source]

Replace the input attribute.

Args
x: PyoObject

New signal to process.

fadetime: float, optional

Crossfade time between old and new input. Defaults to 0.05.

property input

PyoObject. Audio signal sending integer numbers.