Matrix Processing¶
PyoObjects to perform operations on PyoMatrixObjects.
PyoMatrixObjects are 2 dimensions table containers. They can be used to store audio samples or algorithmic sequences. Writing and reading are done by giving row and column positions.
Objects in this category¶
MatrixMorph
: Morphs between multiple PyoMatrixObjects.MatrixPointer
: Matrix reader with control on the 2D pointer position.MatrixRec
: MatrixRec records samples into a previously created NewMatrix.MatrixRecLoop
: MatrixRecLoop records samples in loop into a previously created NewMatrix.
MatrixMorph¶
- class MatrixMorph(input, matrix, sources)[source]¶
Morphs between multiple PyoMatrixObjects.
Uses an index into a list of PyoMatrixObjects to morph between adjacent matrices in the list. The resulting morphed function is written into the matrix object at the beginning of each buffer size. The matrices in the list and the resulting matrix must be equal in size.
- Parent
- Args
- input: PyoObject
Morphing index between 0 and 1. 0 is the first matrix in the list and 1 is the last.
- matrix: NewMatrix
The matrix where to write morphed function.
- sources: list of PyoMatrixObject
List of matrices to interpolate from.
Note
The out() method is bypassed. MatrixMorph returns no signal.
MatrixMorph has no mul and add attributes.
>>> s = Server().boot() >>> s.start() >>> m1 = NewMatrix(256, 256) >>> m1.genSineTerrain(1, 4) >>> m2 = NewMatrix(256, 256) >>> m2.genSineTerrain(2, 8) >>> mm = NewMatrix(256, 256) >>> inter = Sine(.2, 0, .5, .5) >>> morph = MatrixMorph(inter, mm, [m1,m2]) >>> x = Sine([49,50], 0, .45, .5) >>> y = Sine([49.49,50.5], 0, .45, .5) >>> c = MatrixPointer(mm, x, y, .2).out()
Public Data Attributes:
PyoObject.
NewMatrix.
list of PyoMatrixObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input, matrix, sources)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.
setMatrix
(x)Replace the matrix attribute.
setSources
(x)Replace the sources attribute.
Inherited from
PyoObject
__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:
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.
- 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.
- setSources(x)[source]¶
Replace the sources attribute.
- Args
- x: list of PyoMatrixObject
new sources attribute.
- property input¶
PyoObject. Morphing index between 0 and 1.
- property matrix¶
NewMatrix. The matrix where to write samples.
- property sources¶
list of PyoMatrixObject. List of matrices to interpolate from.
MatrixPointer¶
- class MatrixPointer(matrix, x, y, mul=1, add=0)[source]¶
Matrix reader with control on the 2D pointer position.
- Parent
- Args
- matrix: PyoMatrixObject
Matrix containing the waveform samples.
- x: PyoObject
Normalized X position in the matrix between 0 and 1.
- y: PyoObject
Normalized Y position in the matrix between 0 and 1.
>>> s = Server().boot() >>> s.start() >>> SIZE = 256 >>> mm = NewMatrix(SIZE, SIZE) >>> fmind = Sine(.2, 0, 2, 2.5) >>> fmrat = Sine(.33, 0, .05, .5) >>> aa = FM(carrier=10, ratio=fmrat, index=fmind) >>> rec = MatrixRec(aa, mm, 0).play() >>> lfx = Sine(.1, 0, .24, .25) >>> lfy = Sine(.15, 0, .124, .25) >>> x = Sine([500,501], 0, lfx, .5) >>> y = Sine([10.5,10], 0, lfy, .5) >>> c = MatrixPointer(mm, x, y, .2).out()
Public Data Attributes:
PyoMatrixObject.
PyoObject.
PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(matrix, x, y[, mul, add])setMatrix
(x)Replace the matrix attribute.
setX
(x)Replace the x attribute.
setY
(x)Replace the y attribute.
ctrl
([map_list, title, wxnoserver])Opens a sliders window to control the parameters of the object.
Inherited from
PyoObject
__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:
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])
- 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 matrix¶
PyoMatrixObject. Matrix containing the samples.
- property x¶
PyoObject. Normalized X position in the matrix.
- property y¶
PyoObject. Normalized Y position in the matrix.
MatrixRec¶
- class MatrixRec(input, matrix, fadetime=0, delay=0)[source]¶
MatrixRec records samples into a previously created NewMatrix.
See
NewMatrix
to create an empty matrix.The play method is not called at the object creation time. It starts the recording into the matrix, row after row, until the matrix is full. Calling the play method again restarts the recording and overwrites previously recorded samples. The stop method stops the recording. Otherwise, the default behaviour is to record through the end of the matrix.
- Parent
- Args
- input: PyoObject
Audio signal to write in the matrix.
- matrix: PyoMatrixObject
The matrix where to write samples.
- fadetime: float, optional
Fade time at the beginning and the end of the recording in seconds. Defaults to 0.
- delay: int, optional
Delay time, in samples, before the recording begins. Available at initialization time only. Defaults to 0.
Note
The out() method is bypassed. MatrixRec returns no signal.
MatrixRec has no mul and add attributes.
MatrixRec will send a trigger signal at the end of the recording. User can retreive the trigger streams by calling obj[‘trig’]. See TableRec documentation for an example.
See also
>>> s = Server().boot() >>> s.start() >>> SIZE = 256 >>> mm = NewMatrix(SIZE, SIZE) >>> fmind = Sine(.2, 0, 2, 2.5) >>> fmrat = Sine(.33, 0, .05, .5) >>> aa = FM(carrier=10, ratio=fmrat, index=fmind) >>> rec = MatrixRec(aa, mm, 0).play() >>> lfx = Sine(.1, 0, .24, .25) >>> lfy = Sine(.15, 0, .124, .25) >>> x = Sine([500,501], 0, lfx, .5) >>> y = Sine([10.5,10], 0, lfy, .5) >>> c = MatrixPointer(mm, x, y, .2).out()
Public Data Attributes:
PyoObject.
PyoMatrixObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input, matrix[, fadetime, delay])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.
setMatrix
(x)Replace the matrix attribute.
Inherited from
PyoObject
__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:
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.
- 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 to record in the matrix.
- property matrix¶
PyoMatrixObject. The matrix where to write samples.
MatrixRecLoop¶
- class MatrixRecLoop(input, matrix)[source]¶
MatrixRecLoop records samples in loop into a previously created NewMatrix.
See
NewMatrix
to create an empty matrix.MatrixRecLoop records samples into the matrix, row after row, until the matrix is full and then loop back to the beginning.
- Parent
- Args
- input: PyoObject
Audio signal to write in the matrix.
- matrix: PyoMatrixObject
The matrix where to write samples.
Note
The out() method is bypassed. MatrixRecLoop returns no signal.
MatrixRecLoop has no mul and add attributes.
MatrixRecLoop will send a trigger signal when reaching the end of the matrix. User can retreive the trigger streams by calling obj[‘trig’]. See TableRec documentation for an example.
See also
>>> s = Server().boot() >>> s.start() >>> env = CosTable([(0,0), (300,1), (1000,.4), (8191,0)]) >>> matrix = NewMatrix(8192, 8) >>> src = SfPlayer(SNDS_PATH+'/transparent.aif', loop=True, mul=.3) >>> m_rec = MatrixRecLoop(src, matrix) >>> period = 8192 / s.getSamplingRate() >>> metro = Metro(time=period/2, poly=2).play() >>> x = TrigLinseg(metro, [(0,0), (period,1)]) >>> y = TrigRandInt(metro, max=2, mul=0.125) >>> amp = TrigEnv(metro, table=env, dur=period) >>> out = MatrixPointer(matrix, x, y, amp).out()
Public Data Attributes:
PyoObject.
PyoMatrixObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input, matrix)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.
setMatrix
(x)Replace the matrix attribute.
Inherited from
PyoObject
__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:
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.
- 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 to record in the matrix.
- property matrix¶
PyoMatrixObject. The matrix where to write samples.