Base Classes

Here are defined the base classes implementing common behaviors for the different kinds of objects in the library.

Objects in this category

  • PyoObjectBase : Base class for all pyo objects.

  • PyoObject : Base class for all pyo objects that manipulate vectors of samples.

  • PyoTableObject : Base class for all pyo table objects.

  • PyoMatrixObject : Base class for all pyo matrix objects.

  • PyoPVObject : Base class for objects working with phase vocoder’s magnitude and frequency streams.

PyoObjectBase

class PyoObjectBase[source]

Base class for all pyo objects.

This object encapsulates some common behaviors for all pyo objects.

One typically inherits from a more specific subclass of this class instead of using it directly.

Note

Operations allowed on all PyoObjectBase

>>> len(obj)      # Return the number of streams managed by the object.
>>> obj[x]        # Return stream `x` of the object.
>>>               # `x` is a number from 0 to len(obj)-1.
>>>               # Illegal indexing returns None.
>>> dir(obj)      # Return the list of attributes of the object.
>>> for x in obj: # Can be used as an iterator (iterates over
...     pass      # object's audio streams).

Public Methods:

__init__()

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:

_STREAM_TYPE

Private Methods:

_autoplay([dur, delay])

_autostop([wait])


dump()[source]

Print infos about the current state of the object.

Print the number of Stream objects managed by the instance and the current status of the object’s attributes.

getBaseObjects()[source]

Return a list of Stream objects managed by the instance.

getServer()[source]

Return a reference to the current Server object.

getSamplingRate()[source]

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

getBufferSize()[source]

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

allowAutoStart(switch=True)[source]

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. This is useful when an object is used at multiple places and you don’t want to loose it when you stop one dsp block.

Note

This flag is ignored if you pass a _base object instead of a PyoObject. In the following code, a[0] will still be stopped by a b.stop(wait) call:

>>> a = Randi(min=0, max=0.3, freq=[1,2])
>>> a.allowAutoStart(False)
>>> b = Sine(mul=a[0]).out()
useWaitTimeOnStop()[source]

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.

Note

Use wait time on stop is always “on” for _base objects. In the following code, a[0] will use the wait time given to b.stop(wait) even if it is used as a mul attribute:

>>> a = Randi(min=0, max=0.3, freq=[1,2])
>>> b = Sine(mul=a[0]).out()
addLinkedObject(x)[source]

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. Here is an example where we want an object to be linked to the chain but it can’t be automatically detected:

>>> tab = NewTable(length=2, chnls=1)
>>> rec = TableRec(Sine(500), tab, .01)
>>> amp = TrigVal(rec["trig"], 0.5)
>>> osc = Osc(tab, tab.getRate(), mul=Fader(1, 1, mul=.2))
>>> # "osc" can't know for sure that "rec" should be linked
>>> # to this dsp chain, so we add it manually.
>>> osc.addLinkedObject(rec)
>>> osc.out()
setStopDelay(x)[source]

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

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

Args
x: float

New waiting time in seconds.

Note

if the method setStopDelay(x) was called before calling stop(wait) with a positive wait value, the wait value won’t overwrite the value given to setStopDelay for the current object, but will be the one propagated to children objects. This allow to set a waiting time for a specific object with setStopDelay whithout changing the global delay time given to the stop method.

Stop delay value is ignored if you pass a _base object instead of a PyoObject. In the following code, a[0] ignores the a.setStopDelay(1) call:

>>> a = Randi(min=0, max=0.3, freq=[1,2])
>>> a.setStopDelay(1)
>>> b = Sine(mul=a[0]).out()
getStopDelay()[source]

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

next()[source]

Alias for __next__ method.

PyoObject

class PyoObject(mul=1.0, add=0.0)[source]

Base class for all pyo objects that manipulate vectors of samples.

The user should never instantiate an object of this class.

Parent

PyoObjectBase

Args
mul: float or PyoObject, optional

Multiplication factor. Defaults to 1.

add: float or PyoObject, optional

Addition factor. Defaults to 0.

Note

Arithmetics

Multiplication, addition, division and substraction can be applied between pyo objects or between pyo objects and numbers. Doing so returns a Dummy object with the result of the operation.

>>> # Creates a Dummy object `b` with `mul` set to 0.5.
>>> # Leaves `a` unchanged.
>>> b = a * 0.5

Inplace multiplication, addition, division and substraction can be applied between pyo objects or between pyo objects and numbers. These operations will replace the mul or add factor of the object.

>>> a *= 0.5 # replaces the `mul` attribute of `a`.

The next operators can only be used with PyoObject, not with XXX_base objects.

Exponent and modulo

>>> a ** 10 # returns a Pow object created as: Pow(a, 10)
>>> 10 ** a # returns a Pow object created as: Pow(10, a)
>>> a % 4 # returns a Wrap object created as: Wrap(a, 0, 4)
>>> a % b # returns a Wrap object created as: Wrap(a, 0, b)

Unary negative (-)

>>> -a # returns a Dummy object with negative values of streams in `a`.

Comparison operators

>>> # Comparison operators return a Compare object.
>>> x = a < b # same as: x = Compare(a, comp=b, mode="<")
>>> x = a <= b # same as: Compare(a, comp=b, mode="<=")
>>> x = a == b # same as: Compare(a, comp=b, mode="==")
>>> x = a != b # same as: Compare(a, comp=b, mode="!=")
>>> x = a > b # same as: Compare(a, comp=b, mode=">")
>>> x = a >= b # same as: Compare(a, comp=b, mode=">=")

A special case concerns the comparison of a PyoObject with None. All operators return False except a != None, which returns True.

Public Data Attributes:

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__([mul, add])

__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__()

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:

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

_init_play()

_reset_from_set([attr])

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


isPlaying(all=False)[source]

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

Args
all: boolean, optional

If True, the object returns a list with the state of all streams managed by the object.

If False, it return a boolean corresponding to the state of the first stream.

isOutputting(all=False)[source]

Returns True if the object is outputting.

Returns True if the object is sending samples to dac, otherwise, returns False.

Args
all: boolean, optional

If True, the object returns a list with the state of all streams managed by the object.

If False, it return a boolean corresponding to the state of the first stream.

get(all=False)[source]

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

Can be used to convert audio stream to usable Python data.

Object that implements string identifier for specific audio streams must use the corresponding string to specify the stream from which to get the value. See get() method definition in these object’s man pages.

Args
all: boolean, optional

If True, the first value of each object’s stream will be returned as a list.

If False, only the value of the first object’s stream will be returned as a float.

play(dur=0, delay=0)[source]

Start processing without sending samples to output. This method is called automatically at the object creation.

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

Args
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.

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.

stop(wait=0)[source]

Stop processing.

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

Args
wait: float, optional

Delay, in seconds, before the process is actually stopped. If autoStartChildren is activated in the Server, this value is propagated to the children objects. Defaults to 0.

Note

if the method setStopDelay(x) was called before calling stop(wait) with a positive wait value, the wait value won’t overwrite the value given to setStopDelay for the current object, but will be the one propagated to children objects. This allow to set a waiting time for a specific object with setStopDelay whithout changing the global delay time given to the stop method.

Fader and Adsr objects ignore waiting time given to the stop method because they already implement a delayed processing triggered by the stop call.

mix(voices=1)[source]

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

Args
voices: int, optional

Number of audio streams of the Mix object created by this method. Defaults to 1.

If more than 1, object’s streams are alternated and added into Mix object’s streams.

range(min, max)[source]

Adjust mul and add attributes according to a given range.

This function assumes a signal between -1 and 1. Arguments may be list of floats for multi-streams objects.

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

>>> lfo = Sine(freq=1).range(500, 1000)
Args
min: float

Minimum value of the output signal.

max: float

Maximum value of the output signal.

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.

set(attr, value, port=0.025, callback=None)[source]

Replace any attribute with portamento.

This method is intended to be applied on attributes that are not already assigned to PyoObjects. It will work only with floats or list of floats.

Args
attr: string

Name of the attribute as a string.

value: float

New value.

port: float, optional

Time, in seconds, to reach the new value.

callback: callable, optional

A python function to be called at the end of the ramp. If the end of the ramp is not reached (ex.: called again before the end of the portamento), the callback will not be called.

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 mul

float or PyoObject. Multiplication factor.

property add

float or PyoObject. Addition factor.

PyoTableObject

class PyoTableObject(size=0)[source]

Base class for all pyo table objects.

A table object is a buffer memory to store precomputed samples.

The user should never instantiate an object of this class.

Parent

PyoObjectBase

Args
size: int

Length of the table in samples. Usually provided by the child object.

Public Data Attributes:

size

int.

Public Methods:

__init__([size])

save(path[, format, sampletype, quality])

Writes the content of the table in an audio file.

write(path[, oneline])

Writes the content of the table in a text file.

read(path)

Reads the content of a text file and replaces the table data with the values stored in the file.

getBuffer([chnl])

Return a reference to the underlying object implementing the buffer protocol.

setSize(size)

Change the size of the table.

getSize([all])

Return table size in samples.

getRate([all])

Return the frequency in cps at which the table will be read at its original pitch.

getDur([all])

Return the duration of the table in seconds.

put(value[, pos])

Puts a value at specified sample position in the table.

get(pos)

Returns the value, as float, stored at a specific position in the table.

getTable([all])

Returns the content of the table as list of floats.

normalize([level])

Normalizes table samples to a given level.

reset()

Resets table samples to 0.0.

removeDC()

Filter out DC offset from the table's data.

reverse()

Reverse the table's data in time.

invert()

Reverse the table's data in amplitude.

rectify()

Positive rectification of the table's data.

pow([exp])

Apply a power function on each sample in the table.

bipolarGain([gpos, gneg])

Apply different gain factor for positive and negative samples.

lowpass([freq])

Apply a one-pole lowpass filter on table's samples.

fadein([dur, shape])

Apply a gradual increase in the level of the table's samples.

fadeout([dur, shape])

Apply a gradual decrease in the level of the table's samples.

add(x)

Performs addition on the table values.

sub(x)

Performs substraction on the table values.

mul(x)

Performs multiplication on the table values.

div(x)

Performs division on the table values.

copyData(table[, srcpos, destpos, length])

Copy samples from a source table.

rotate(pos)

Rotate the table content to the left around the position given as argument.

copy()

Returns a deep copy of the object.

view([title, wxnoserver])

Opens a window showing the contents of the table.

refreshView()

Updates the graphical display of the table, if applicable.

Inherited from PyoObjectBase

__init__()

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:

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

_setViewFrame(frame)

_setGraphFrame(frame)

_get_current_data()

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


save(path, format=0, sampletype=0, quality=0.4)[source]

Writes the content of the table in an audio file.

The sampling rate of the file is the sampling rate of the server and the number of channels is the number of table streams of the object.

Args
path: string

Full path (including extension) of the new file.

format: int, optional
Format type of the new file. Supported formats are:
  1. WAVE - Microsoft WAV format (little endian) {.wav, .wave}

  2. AIFF - Apple/SGI AIFF format (big endian) {.aif, .aiff}

  3. AU - Sun/NeXT AU format (big endian) {.au}

  4. RAW - RAW PCM data {no extension}

  5. SD2 - Sound Designer 2 {.sd2}

  6. FLAC - FLAC lossless file format {.flac}

  7. CAF - Core Audio File format {.caf}

  8. OGG - Xiph OGG container {.ogg}

sampletype: int, optional

Bit depth encoding of the audio file.

SD2 and FLAC only support 16 or 24 bit int. Supported types are:
  1. 16 bit int (default)

  2. 24 bit int

  3. 32 bit int

  4. 32 bit float

  5. 64 bit float

  6. U-Law encoded

  7. A-Law encoded

quality: float, optional

The encoding quality value, between 0.0 (lowest quality) and 1.0 (highest quality). This argument has an effect only with FLAC and OGG compressed formats. Defaults to 0.4.

write(path, oneline=True)[source]

Writes the content of the table in a text file.

This function can be used to store the table data as a list of floats into a text file.

Args
path: string

Full path of the generated file.

oneline: boolean, optional

If True, list of samples will inserted on one line.

If False, list of samples will be truncated to 8 floats per line.

read(path)[source]

Reads the content of a text file and replaces the table data with the values stored in the file.

Args
path: string

Full path of the file to read.

The format is a list of lists of floats. For example, A two tablestreams object must be given a content like this:

[ [ 0.0, 1.0, 0.5, … ], [ 1.0, 0.99, 0.98, 0.97, … ] ]

Each object’s tablestream will be resized according to the length of the lists.

getBuffer(chnl=0)[source]

Return a reference to the underlying object implementing the buffer protocol.

With the buffer protocol, a table can be referenced and modified, without copying the data, with numpy functions. To create an array using the same memory as the table:

>>> t = SndTable(SNDS_PATH+"/transparent.aif")
>>> arr = numpy.asarray(t.getBuffer())

Now, every changes applied to the array will be reflected in the SndTable. This method works for a single channel only.

Args
chnl: int, optional

The channel in the table for which to obtain the underlying buffer. Defaults to 0.

For more details about the buffer protocol, see PEP 3118 and the python documentation.

setSize(size)[source]

Change the size of the table.

This will usually regenerate the table content.

Args
size: int

New table size in samples.

getSize(all=False)[source]

Return table size in samples.

Args
all: boolean

If the table contains more than one stream and all is True, returns a list of all sizes. Otherwise, returns only the first size as an int. Defaults to False.

getRate(all=False)[source]

Return the frequency in cps at which the table will be read at its original pitch.

Args
all: boolean

If the table contains more than one stream and all is True, returns a list of all frequencies. Otherwise, returns only the first frequency as a float. Defaults to False.

getDur(all=False)[source]

Return the duration of the table in seconds.

Args
all: boolean

If the table contains more than one stream and all is True, returns a list of all durations. Otherwise, returns only the first duration as a float. Defaults to False.

put(value, pos=0)[source]

Puts a value at specified sample position in the table.

If the object has more than 1 tablestream, the default is to record the value in each table. User can call obj[x].put() to record into a specific table.

Args
value: float

Value, as floating-point, to record in the table.

pos: int, optional

Position, in samples, where to record value. Can write backward with negative position. Defaults to 0.

get(pos)[source]

Returns the value, as float, stored at a specific position in the table.

If the object has more than 1 tablestream, the default is to return a list with the value of each tablestream. User can call obj[x].get() to get the value of a specific table.

Args
pos: int, optional

Position, in samples, where to read the value. Can read backward with negative position. Defaults to 0.

getTable(all=False)[source]

Returns the content of the table as list of floats.

Args
all: boolean, optional

If True, all sub tables are retrieved and returned as a list of list of floats.

If False, a single list containing the content of the first subtable (or the only one) is returned.

normalize(level=0.99)[source]

Normalizes table samples to a given level.

Args
level: float, optional

Samples will be normalized between -level and +level. Defaults to 0.99.

reset()[source]

Resets table samples to 0.0.

removeDC()[source]

Filter out DC offset from the table’s data.

reverse()[source]

Reverse the table’s data in time.

invert()[source]

Reverse the table’s data in amplitude.

rectify()[source]

Positive rectification of the table’s data.

pow(exp=10)[source]

Apply a power function on each sample in the table.

Args
exp: float, optional

Exponent factor. Defaults to 10.

bipolarGain(gpos=1, gneg=1)[source]

Apply different gain factor for positive and negative samples.

Args
gpos: float, optional

Gain factor for positive samples. Defaults to 1.

gneg: float, optional

Gain factor for negative samples. Defaults to 1.

lowpass(freq=1000)[source]

Apply a one-pole lowpass filter on table’s samples.

Args
freq: float, optional

Filter’s cutoff, in Hertz. Defaults to 1000.

fadein(dur=0.1, shape=0)[source]

Apply a gradual increase in the level of the table’s samples.

Args
dur: float, optional

Fade in duration, in seconds. Defaults to 0.1.

shape: int, optional
Curve type used to shape the fadein. Available curves:

0: linear (default) 1: sqrt 2: sin 3: squared

fadeout(dur=0.1, shape=0)[source]

Apply a gradual decrease in the level of the table’s samples.

Args
dur: float, optional

Fade out duration, in seconds. Defaults to 0.1.

shape: int, optional
Curve type used to shape the fadein. Available curves:

0: linear (default) 1: sqrt 2: sin 3: squared

add(x)[source]

Performs addition on the table values.

Adds the argument to each table values, position by position if the argument is a list or another PyoTableObject.

Args
x: float, list or PyoTableObject

value(s) to add.

sub(x)[source]

Performs substraction on the table values.

Substracts the argument to each table values, position by position if the argument is a list or another PyoTableObject.

Args
x: float, list or PyoTableObject

value(s) to substract.

mul(x)[source]

Performs multiplication on the table values.

Multiply each table values by the argument, position by position if the argument is a list or another PyoTableObject.

Args
x: float, list or PyoTableObject

value(s) to multiply.

div(x)[source]

Performs division on the table values.

Divide each table values by the argument, position by position if the argument is a list or another PyoTableObject.

Args
x: float, list or PyoTableObject

value(s) used to divide.

copyData(table, srcpos=0, destpos=0, length=-1)[source]

Copy samples from a source table.

Copy length samples from a source table to this table.

Args
table: PyoTableObject

The source table.

srcpos: int, optional

The start position, in samples, in the source table. Can read backward with negative position. Defaults to 0.

destpos ; int, optional

The start position, in samples, in the destination (self) table. Can read backward with negative position. Defaults to 0.

length: int, optional

The number of samples to copy from source to destination. if length is negative, the length of the smallest table is used. Defaults to -1.

rotate(pos)[source]

Rotate the table content to the left around the position given as argument.

Samples between the given position and the end of the table will be relocated in front of the samples from the beginning to the given position.

Args
pos: int

The rotation position in samples. A negative position means a rotation to the right.

copy()[source]

Returns a deep copy of the object.

view(title='Table waveform', wxnoserver=False)[source]

Opens a window showing the contents of the table.

Args
title: string, optional

Window title. Defaults to “Table waveform”.

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.

refreshView()[source]

Updates the graphical display of the table, if applicable.

property size

int. Table size in samples.

PyoMatrixObject

class PyoMatrixObject[source]

Base class for all pyo matrix objects.

A matrix object is a 2 dimensions buffer memory to store precomputed samples.

The user should never instantiate an object of this class.

Parent

PyoObjectBase

Public Methods:

__init__()

write(path)

Writes the content of the matrix into a text file.

read(path)

Reads the content of a text file and replaces the matrix data with the values in the file.

getSize()

Returns matrix size in samples.

normalize([level])

Normalize matrix samples to a given level.

blur()

Apply a simple gaussian blur on the matrix.

boost([min, max, boost])

Boost the constrast of values in the matrix.

put(value[, x, y])

Puts a value at specified position in the matrix.

get([x, y])

Returns the value, as float, at specified position in the matrix.

getInterpolated([x, y])

Returns the value, as float, at a normalized position in the matrix.

view([title, wxnoserver])

Opens a window showing the contents of the matrix.

refreshView()

Updates the graphical display of the matrix, if applicable.

Inherited from PyoObjectBase

__init__()

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:

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

_setViewFrame(frame)

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


write(path)[source]

Writes the content of the matrix into a text file.

This function can be used to store the matrix data as a list of list of floats into a text file.

Args
path: string

Full path of the generated file.

read(path)[source]

Reads the content of a text file and replaces the matrix data with the values in the file.

Format is a list of lists of list of floats. For example, A two matrixstreams object must be given a content like this:

[ [ [0.0 ,1.0, 0.5, … ], [1.0, 0.99, 0.98, 0.97, … ] ], [ [0.0, 1.0, 0.5, … ], [1.0, 0.99, 0.98, 0.97, … ] ] ]

Each object’s matrixstream will be resized according to the length of the lists, but the number of matrixstreams must be the same.

Args
path: string

Full path of the file to read.

getSize()[source]

Returns matrix size in samples. Size is a tuple (x, y).

normalize(level=0.99)[source]

Normalize matrix samples to a given level.

Args
level: float, optional

Samples will be normalized between -level and +level. Defaults to 0.99.

blur()[source]

Apply a simple gaussian blur on the matrix.

boost(min=-1.0, max=1.0, boost=0.01)[source]

Boost the constrast of values in the matrix.

Args
min: float, optional

Minimum value. Defaults to -1.0.

max: float, optional

Maximum value. Defaults to 1.0.

boost: float, optional

Amount of boost applied on each value. Defaults to 0.01.

put(value, x=0, y=0)[source]

Puts a value at specified position in the matrix.

If the object has more than 1 matrixstream, the default is to record the value in each matrix. User can call obj[x].put() to record in a specific matrix.

Args
value: float

Value, as floating-point, to record in the matrix.

x: int, optional

X position where to record value. Defaults to 0.

y: int, optional

Y position where to record value. Defaults to 0.

get(x=0, y=0)[source]

Returns the value, as float, at specified position in the matrix.

If the object has more than 1 matrixstream, the default is to return a list with the value of each matrixstream. User can call obj[x].get() to get the value of a specific matrix.

Args
x: int, optional

X position where to get value. Defaults to 0.

y: int, optional

Y position where to get value. Defaults to 0.

getInterpolated(x=0.0, y=0.0)[source]

Returns the value, as float, at a normalized position in the matrix.

If the object has more than 1 matrixstream, the default is to return a list with the value of each matrixstream. User can call obj[x].getInterpolated() to get the value of a specific matrix.

Args
x: float {0 -> 1}

X normalized position where to get value. Defaults to 0.0.

y: int {0 -> 1}

Y normalized position where to get value. Defaults to 0.0.

view(title='Matrix viewer', wxnoserver=False)[source]

Opens a window showing the contents of the matrix.

Args
title: string, optional

Window title. Defaults to “Matrix viewer”.

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.

refreshView()[source]

Updates the graphical display of the matrix, if applicable.

PyoPVObject

class PyoPVObject[source]

Base class for objects working with phase vocoder’s magnitude and frequency streams.

The user should never instantiate an object of this class.

Parent

PyoObjectBase

Public Methods:

__init__()

isPlaying([all])

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

play([dur, delay])

Start processing without sending samples to output.

stop([wait])

Stop processing.

set(attr, value[, port])

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__()

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:

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

_init_play()

_reset_from_set([attr])

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


isPlaying(all=False)[source]

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

Args
all: boolean, optional

If True, the object returns a list with the state of all streams managed by the object.

If False, it return a boolean corresponding to the state of the first stream.

play(dur=0, delay=0)[source]

Start processing without sending samples to output. This method is called automatically at the object creation.

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

Args
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.

stop(wait=0)[source]

Stop processing.

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

Args
wait: float, optional

Delay, in seconds, before the process is actually stopped. If autoStartChildren is activated in the Server, this value is propagated to the children objects. Defaults to 0.

Note

if the method setStopDelay(x) was called before calling stop(wait) with a positive wait value, the wait value won’t overwrite the value given to setStopDelay for the current object, but will be the one propagated to children objects. This allow to set a waiting time for a specific object with setStopDelay whithout changing the global delay time given to the stop method.

set(attr, value, port=0.025)[source]

Replace any attribute with portamento.

This method is intended to be applied on attributes that are not already assigned to PyoObjects. It will work only with floats or list of floats.

Args
attr: string

Name of the attribute as a string.

value: float

New value.

port: float, optional

Time, in seconds, to reach the new value.

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

Opens a sliders window to control the parameters of the object. Only parameters that can be set to a PyoObject are allowed to be mapped on a slider.

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.