Matrices

Objects in this category

  • NewMatrix : Create a new matrix ready for recording.

Matrices are two-dimensions containers to keep samples (sounds, envelopes, algorithmic patterns, images, etc.) in memory and access them quickly.

NewMatrix

class NewMatrix(width, height, init=None)[source]

Create a new matrix ready for recording.

Optionally, the matrix can be filled with the contents of the init parameter.

See MatrixRec to write samples in the matrix.

Parent

PyoMatrixObject

Args
width: int

Desired matrix width in samples.

height: int

Desired matrix height in samples.

init: list of list of floats, optional

Initial matrix. Defaults to None.

See also

MatrixRec

>>> s = Server().boot()
>>> s.start()
>>> SIZE = 256
>>> mm = NewMatrix(SIZE, SIZE)
>>> mm.genSineTerrain(freq=2, phase=16)
>>> lfw = Sine([.1,.11], 0, .124, .25)
>>> lfh = Sine([.15,.16], 0, .124, .25)
>>> w = Sine(100, 0, lfw, .5)
>>> h = Sine(10.5, 0, lfh, .5)
>>> c = MatrixPointer(mm, w, h, mul=.2).out()

Public Methods:

__init__(width, height[, init])

replace(x)

Replaces the actual matrix.

getRate()

Returns the frequency (cycle per second) to give to an oscillator to read the sound at its original pitch.

genSineTerrain([freq, phase])

Generates a modulated sinusoidal terrain.

Inherited from PyoMatrixObject

__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:

Inherited from PyoMatrixObject

_STREAM_TYPE

Inherited from PyoObjectBase

_STREAM_TYPE

Private Methods:

Inherited from PyoMatrixObject

_setViewFrame(frame)

Inherited from PyoObjectBase

_autoplay([dur, delay])

_autostop([wait])


replace(x)[source]

Replaces the actual matrix.

Args
x: list of list of floats

New matrix. Must be of the same size as the actual matrix.

getRate()[source]

Returns the frequency (cycle per second) to give to an oscillator to read the sound at its original pitch.

genSineTerrain(freq=1, phase=0.0625)[source]

Generates a modulated sinusoidal terrain.

Args
freq: float

Frequency of sinusoids used to created the terrain. Defaults to 1.

phase: float

Phase deviation between rows of the terrain. Should be in the range 0 -> 1. Defaults to 0.0625.