157
"""PyoObject. Audio signal to write in the matrix."""
157
"""PyoObject. Audio signal to record in the matrix."""
160
def input(self, x): self.setInput(x)
164
"""PyoMatrixObject. The matrix where to write samples."""
167
def matrix(self, x): self.setMatrix(x)
169
class MatrixRecLoop(PyoObject):
171
MatrixRecLoop records samples in loop into a previously created NewMatrix.
173
See `NewMatrix` to create an empty matrix.
175
MatrixRecLoop records samples into the matrix, row after row, until
176
the matrix is full and then loop back to the beginning.
178
Parentclass: PyoObject
183
Audio signal to write in the matrix.
184
matrix : PyoMatrixObject
185
The matrix where to write samples.
189
setInput(x, fadetime) : Replace the `input` attribute.
190
setMatrix(x) : Replace the `matrix` attribute.
194
input : PyoObject. Audio signal to write in the matrix.
195
matrix : PyoMatrixObject. The matrix where to write samples.
199
The out() method is bypassed. MatrixRecLoop returns no signal.
201
MatrixRecLoop has no `mul` and `add` attributes.
203
MatrixRecLoop will sends a trigger signal when reaching the end
204
of the matrix. User can retreive the trigger streams by calling
205
obj['trig']. See `TableRec` documentation for an example.
211
>>> s = Server().boot()
213
>>> env = CosTable([(0,0), (300,1), (1000,.4), (8191,0)])
214
>>> matrix = NewMatrix(8192, 8)
215
>>> src = SfPlayer(SNDS_PATH+'/transparent.aif', loop=True, mul=.3)
216
>>> m_rec = MatrixRecLoop(src, matrix)
217
>>> period = 8192 / s.getSamplingRate()
218
>>> metro = Metro(time=period/2, poly=2).play()
219
>>> x = TrigLinseg(metro, [(0,0), (period,1)])
220
>>> y = TrigRandInt(metro, max=2, mul=0.125)
221
>>> amp = TrigEnv(metro, table=env, dur=period)
222
>>> out = MatrixPointer(matrix, x, y, amp).out()
225
def __init__(self, input, matrix):
226
PyoObject.__init__(self)
228
self._matrix = matrix
229
self._in_fader = InputFader(input)
230
in_fader, matrix, lmax = convertArgsToLists(self._in_fader, matrix)
231
self._base_objs = [MatrixRecLoop_base(wrap(in_fader,i), wrap(matrix,i)) for i in range(len(matrix))]
232
self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
235
return ['input', 'matrix']
237
def out(self, chnl=0, inc=1, dur=0, delay=0):
238
return self.play(dur, delay)
246
def setInput(self, x, fadetime=0.05):
248
Replace the `input` attribute.
253
New signal to process.
254
fadetime : float, optional
255
Crossfade time between old and new input. Defaults to 0.05.
259
self._in_fader.setInput(x, fadetime)
261
def setMatrix(self, x):
263
Replace the `matrix` attribute.
268
new `matrix` attribute.
272
x, lmax = convertArgsToLists(x)
273
[obj.setMatrix(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
275
def ctrl(self, map_list=None, title=None, wxnoserver=False):
277
PyoObject.ctrl(self, map_list, title, wxnoserver)
281
"""PyoObject. Audio signal to record in the matrix."""
158
282
return self._input
160
284
def input(self, x): self.setInput(x)