Fast Fourier Transform

A Fast Fourier Transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse (IFFT).

The objects below can be used to perform sound processing in the spectral domain.

Objects in this category

  • FFT : Fast Fourier Transform.

  • IFFT : Inverse Fast Fourier Transform.

  • PolToCar : Performs the polar to cartesian conversion.

  • CarToPol : Performs the cartesian to polar conversion.

  • FrameAccum : Accumulates the phase differences between successive frames.

  • FrameDelta : Computes the phase differences between successive frames.

  • CvlVerb : Convolution based reverb.

  • Vectral : Performs magnitude smoothing between successive frames.

  • IFFTMatrix : Inverse Fast Fourier Transform with a PyoMatrixObject as input.

FFT

class FFT(input, size=1024, overlaps=4, wintype=2)[source]

Fast Fourier Transform.

FFT analyses an input signal and converts it into the spectral domain. Three audio signals are sent out of the object, the real part, from bin 0 (DC) to bin size/2 (Nyquist), the imaginary part, from bin 0 to bin size/2-1, and the bin number, an increasing count from 0 to size-1. real and imaginary buffer’s left samples up to size-1 are filled with zeros. See notes below for an example of how to retrieve each signal component.

Parent

PyoObject

Args
input: PyoObject

Input signal to process.

size: int {pow-of-two > 4}, optional

FFT size. Must be a power of two greater than 4. The FFT size is the number of samples used in each analysis frame. Defaults to 1024.

overlaps: int, optional

The number of overlaped analysis block. Must be a positive integer. More overlaps can greatly improved sound quality synthesis but it is also more CPU expensive. Defaults to 4.

wintype: int, optional

Shape of the envelope used to filter each input frame. Possible shapes are :

  1. rectangular (no windowing)

  2. Hamming

  3. Hanning

  4. Bartlett (triangular)

  5. Blackman 3-term

  6. Blackman-Harris 4-term

  7. Blackman-Harris 7-term

  8. Tuckey (alpha = 0.66)

  9. Sine (half-sine window)

Note

FFT has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

FFT has no mul and add attributes.

Real, imaginary and bin_number parts are three separated set of audio streams. The user should call :

FFT[‘real’] to retrieve the real part.
FFT[‘imag’] to retrieve the imaginary part.
FFT[‘bin’] to retrieve the bin number part.
>>> s = Server().boot()
>>> s.start()
>>> a = Noise(.25).mix(2)
>>> fin = FFT(a, size=1024, overlaps=4, wintype=2)
>>> t = ExpTable([(0,0),(3,0),(10,1),(20,0),(30,.8),(50,0),(70,.6),(150,0),(512,0)], size=512)
>>> amp = TableIndex(t, fin["bin"])
>>> re = fin["real"] * amp
>>> im = fin["imag"] * amp
>>> fout = IFFT(re, im, size=1024, overlaps=4, wintype=2).mix(2).out()

Public Data Attributes:

input

PyoObject.

size

int.

wintype

int.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, size, overlaps, wintype])

__len__()

__getitem__(str)

get([identifier, all])

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

setInput(x[, fadetime])

Replace the input attribute.

play([dur, delay])

Start processing without sending samples to output.

stop([wait])

Stop processing.

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

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

setSize(x)

Replace the size attribute.

setWinType(x)

Replace the wintype 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])


get(identifier='real', 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.

“real”, “imag” or “bin” must be given to identifier to specify which stream to get value from.

Args
identifier: string {“real”, “imag”, “bin”}

Address string parameter identifying audio stream. Defaults to “real”.

all: boolean, optional

If True, the first value of each object’s stream will be returned as a list. Otherwise, only the value of the first object’s stream will be returned as a float. Defaults to False.

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. Default to 0.05.

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.

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

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.

setSize(x)[source]

Replace the size attribute.

Args
x: int

new size attribute.

setWinType(x)[source]

Replace the wintype attribute.

Args
x: int

new wintype attribute.

property input

PyoObject. Input signal to process.

property size

int. FFT size.

property wintype

int. Windowing method.

IFFT

class IFFT(inreal, inimag, size=1024, overlaps=4, wintype=2, mul=1, add=0)[source]

Inverse Fast Fourier Transform.

IFFT takes a signal in the spectral domain and converts it to a real audio signal using an inverse fast fourier transform. IFFT takes two signals in input, the real and imaginary parts of an FFT analysis and returns the corresponding real signal. These signals must correspond to real and imaginary parts from an FFT object.

Parent

PyoObject

Args
inreal: PyoObject

Input real signal.

inimag: PyoObject

Input imaginary signal.

size: int {pow-of-two > 4}, optional

FFT size. Must be a power of two greater than 4. The FFT size is the number of samples used in each analysis frame. This value must match the size attribute of the former FFT object. Defaults to 1024.

overlaps: int, optional

The number of overlaped analysis block. Must be a positive integer. More overlaps can greatly improved sound quality synthesis but it is also more CPU expensive. This value must match the overlaps atribute of the former FFT object. Defaults to 4.

wintype: int, optional

Shape of the envelope used to filter each output frame. Possible shapes are :

  1. rectangular (no windowing)

  2. Hamming

  3. Hanning

  4. Bartlett (triangular)

  5. Blackman 3-term

  6. Blackman-Harris 4-term

  7. Blackman-Harris 7-term

  8. Tuckey (alpha = 0.66)

  9. Sine (half-sine window)

Note

The number of streams in inreal and inimag attributes must be egal to the output of the former FFT object. In most case, it will be channels of processed sound * overlaps.

The output of IFFT must be mixed to reconstruct the real signal from the overlapped streams. It is left to the user to call the mix(channels of the processed sound) method on an IFFT object.

>>> s = Server().boot()
>>> s.start()
>>> a = Noise(.25).mix(2)
>>> fin = FFT(a, size=1024, overlaps=4, wintype=2)
>>> t = ExpTable([(0,0),(3,0),(10,1),(20,0),(30,.8),(50,0),(70,.6),(150,0),(512,0)], size=512)
>>> amp = TableIndex(t, fin["bin"])
>>> re = fin["real"] * amp
>>> im = fin["imag"] * amp
>>> fout = IFFT(re, im, size=1024, overlaps=4, wintype=2).mix(2).out()

Public Data Attributes:

inreal

PyoObject.

inimag

PyoObject.

size

int.

wintype

int.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(inreal, inimag[, size, overlaps, ...])

__len__()

setInReal(x[, fadetime])

Replace the inreal attribute.

setInImag(x[, fadetime])

Replace the inimag attribute.

setSize(x)

Replace the size attribute.

setWinType(x)

Replace the wintype 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])


setInReal(x, fadetime=0.05)[source]

Replace the inreal attribute.

Args
x: PyoObject

New input real signal.

fadetime: float, optional

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

setInImag(x, fadetime=0.05)[source]

Replace the inimag attribute.

Args
x: PyoObject

New input imag signal.

fadetime: float, optional

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

setSize(x)[source]

Replace the size attribute.

Args
x: int

new size attribute.

setWinType(x)[source]

Replace the wintype attribute.

Args
x: int

new wintype 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 inreal

PyoObject. Real input signal.

property inimag

PyoObject. Imaginary input signal.

property size

int. FFT size.

property wintype

int. Windowing method.

PolToCar

class PolToCar(inmag, inang, mul=1, add=0)[source]

Performs the polar to cartesian conversion.

The Polar system locates the point by measuring the straight line distance, usually denoted by R, from the origin to the point and the angle of an imaginary line from the origin to the point measured counterclockwise from the positive X axis.

The Cartesian system locates points on a plane by measuring the horizontal and vertical distances from an arbitrary origin to a point. These are usually denoted as a pair of values (X,Y).

Parent

PyoObject

Args
inmag: PyoObject

Magintude input signal.

inang: PyoObject

Angle input signal.

Note

Cartesians coordinates can be retrieve by calling :

PolToCar[‘real’] to retrieve the real part.
CarToPol[‘imag’] to retrieve the imaginary part.

PolToCar has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

>>> s = Server().boot()
>>> snd1 = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.7).mix(2)
>>> snd2 = FM(carrier=[75,100,125,150], ratio=[.499,.5,.501,.502], index=20, mul=.1).mix(2)
>>> fin1 = FFT(snd1, size=1024, overlaps=4)
>>> fin2 = FFT(snd2, size=1024, overlaps=4)
>>> # get magnitudes and phases of input sounds
>>> pol1 = CarToPol(fin1["real"], fin1["imag"])
>>> pol2 = CarToPol(fin2["real"], fin2["imag"])
>>> # times magnitudes and adds phases
>>> mag = pol1["mag"] * pol2["mag"] * 100
>>> pha = pol1["ang"] + pol2["ang"]
>>> # converts back to rectangular
>>> car = PolToCar(mag, pha)
>>> fout = IFFT(car["real"], car["imag"], size=1024, overlaps=4).mix(2).out()
>>> s.start()

Public Data Attributes:

inmag

PyoObject.

inang

PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(inmag, inang[, mul, add])

__len__()

__getitem__(str)

get([identifier, all])

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

setInMag(x[, fadetime])

Replace the inmag attribute.

setInAng(x[, fadetime])

Replace the inang 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])


get(identifier='real', 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.

“real” or “imag” must be given to identifier to specify which stream to get value from.

Args
identifier: string {“real”, “imag”}

Address string parameter identifying audio stream. Defaults to “mag”.

all: boolean, optional

If True, the first value of each object’s stream will be returned as a list. Otherwise, only the value of the first object’s stream will be returned as a float. Defaults to False.

setInMag(x, fadetime=0.05)[source]

Replace the inmag attribute.

Args
x: PyoObject

New signal to process.

fadetime: float, optional

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

setInAng(x, fadetime=0.05)[source]

Replace the inang attribute.

Args
x: PyoObject

New signal to process.

fadetime: float, optional

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

property inmag

PyoObject. Magnitude input signal.

property inang

PyoObject. Angle input signal.

CarToPol

class CarToPol(inreal, inimag, mul=1, add=0)[source]

Performs the cartesian to polar conversion.

The Cartesian system locates points on a plane by measuring the horizontal and vertical distances from an arbitrary origin to a point. These are usually denoted as a pair of values (X,Y).

The Polar system locates the point by measuring the straight line distance, usually denoted by R, from the origin to the point and the angle of an imaginary line from the origin to the point measured counterclockwise from the positive X axis.

Parent

PyoObject

Args
inreal: PyoObject

Real input signal.

inimag: PyoObject

Imaginary input signal.

Note

Polar coordinates can be retrieve by calling :

CarToPol[‘mag’] to retrieve the magnitude part.
CarToPol[‘ang’] to retrieve the angle part.

CarToPol has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

>>> s = Server().boot()
>>> snd1 = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.7).mix(2)
>>> snd2 = FM(carrier=[75,100,125,150], ratio=[.499,.5,.501,.502], index=20, mul=.1).mix(2)
>>> fin1 = FFT(snd1, size=1024, overlaps=4)
>>> fin2 = FFT(snd2, size=1024, overlaps=4)
>>> # get magnitudes and phases of input sounds
>>> pol1 = CarToPol(fin1["real"], fin1["imag"])
>>> pol2 = CarToPol(fin2["real"], fin2["imag"])
>>> # times magnitudes and adds phases
>>> mag = pol1["mag"] * pol2["mag"] * 100
>>> pha = pol1["ang"] + pol2["ang"]
>>> # converts back to rectangular
>>> car = PolToCar(mag, pha)
>>> fout = IFFT(car["real"], car["imag"], size=1024, overlaps=4).mix(2).out()
>>> s.start()

Public Data Attributes:

inreal

PyoObject.

inimag

PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(inreal, inimag[, mul, add])

__len__()

__getitem__(str)

get([identifier, all])

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

setInReal(x[, fadetime])

Replace the inreal attribute.

setInImag(x[, fadetime])

Replace the inimag 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])


get(identifier='mag', 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.

“mag” or “ang” must be given to identifier to specify which stream to get value from.

Args
identifier: string {“mag”, “ang”}

Address string parameter identifying audio stream. Defaults to “mag”.

all: boolean, optional

If True, the first value of each object’s stream will be returned as a list. Otherwise, only the value of the first object’s stream will be returned as a float. Defaults to False.

setInReal(x, fadetime=0.05)[source]

Replace the inreal attribute.

Args
x: PyoObject

New signal to process.

fadetime: float, optional

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

setInImag(x, fadetime=0.05)[source]

Replace the inimag attribute.

Args
x: PyoObject

New signal to process.

fadetime: float, optional

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

property inreal

PyoObject. Real input signal.

property inimag

PyoObject. Imaginary input signal.

FrameAccum

class FrameAccum(input, framesize=1024, overlaps=4, mul=1, add=0)[source]

Accumulates the phase differences between successive frames.

The difference between the phase values of successive FFT frames for a given bin determines the exact frequency of the energy centered in that bin. This is often known as the phase difference (and sometimes also referred to as phase derivative or instantaneous frequency if it’s been subjected to a few additional calculations).

In order to reconstruct a plausible playback of re-ordered FFT frames, we need to calculate the phase difference between successive frames, with FrameDelta, and use it to construct a running phase (by simply summing the successive differences) for the output FFT frames.

Parent

PyoObject

Args
input: PyoObject

Phase input signal.

framesize: int, optional

Frame size in samples. Usually same as the FFT size. Defaults to 1024.

overlaps: int, optional

Number of overlaps in incomming signal. Usually the same as the FFT overlaps. Defaults to 4.

Note

FrameAccum has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

>>> s = Server().boot()
>>> s.start()
>>> snd = SNDS_PATH + '/transparent.aif'
>>> size, hop = 1024, 256
>>> nframes = int(sndinfo(snd)[0] / size) + 1
>>> a = SfPlayer(snd, mul=.3)
>>> m_mag = [NewMatrix(width=size, height=nframes) for i in range(4)]
>>> m_pha = [NewMatrix(width=size, height=nframes) for i in range(4)]
>>> fin = FFT(a, size=size, overlaps=4)
>>> pol = CarToPol(fin["real"], fin["imag"])
>>> delta = FrameDelta(pol["ang"], framesize=size, overlaps=4)
>>> m_mag_rec = MatrixRec(pol["mag"], m_mag, 0, [i*hop for i in range(4)]).play()
>>> m_pha_rec = MatrixRec(delta, m_pha, 0, [i*hop for i in range(4)]).play()
>>> m_mag_read = MatrixPointer(m_mag, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
>>> m_pha_read = MatrixPointer(m_pha, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
>>> accum = FrameAccum(m_pha_read, framesize=size, overlaps=4)
>>> car = PolToCar(m_mag_read, accum)
>>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=4).mix(1).out()
>>> right = Delay(fout, delay=0.013).out(1)

Public Data Attributes:

input

PyoObject.

framesize

PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, framesize, overlaps, mul, add])

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

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

setInput(x[, fadetime])

Replace the input attribute.

setFrameSize(x)

Replace the framesize 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. Default to 0.05.

setFrameSize(x)[source]

Replace the framesize attribute.

Args
x: int

new framesize attribute.

property input

PyoObject. Phase input signal.

property framesize

PyoObject. Frame size in samples.

FrameDelta

class FrameDelta(input, framesize=1024, overlaps=4, mul=1, add=0)[source]

Computes the phase differences between successive frames.

The difference between the phase values of successive FFT frames for a given bin determines the exact frequency of the energy centered in that bin. This is often known as the phase difference (and sometimes also referred to as phase derivative or instantaneous frequency if it’s been subjected to a few additional calculations).

In order to reconstruct a plausible playback of re-ordered FFT frames, we need to calculate the phase difference between successive frames and use it to construct a running phase (by simply summing the successive differences with FrameAccum) for the output FFT frames.

Parent

PyoObject

Args
input: PyoObject

Phase input signal, usually from an FFT analysis.

framesize: int, optional

Frame size in samples. Usually the same as the FFT size. Defaults to 1024.

overlaps: int, optional

Number of overlaps in incomming signal. Usually the same as the FFT overlaps. Defaults to 4.

Note

FrameDelta has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

>>> s = Server().boot()
>>> s.start()
>>> snd = SNDS_PATH + '/transparent.aif'
>>> size, hop = 1024, 256
>>> nframes = int(sndinfo(snd)[0] / size) + 1
>>> a = SfPlayer(snd, mul=.3)
>>> m_mag = [NewMatrix(width=size, height=nframes) for i in range(4)]
>>> m_pha = [NewMatrix(width=size, height=nframes) for i in range(4)]
>>> fin = FFT(a, size=size, overlaps=4)
>>> pol = CarToPol(fin["real"], fin["imag"])
>>> delta = FrameDelta(pol["ang"], framesize=size, overlaps=4)
>>> m_mag_rec = MatrixRec(pol["mag"], m_mag, 0, [i*hop for i in range(4)]).play()
>>> m_pha_rec = MatrixRec(delta, m_pha, 0, [i*hop for i in range(4)]).play()
>>> m_mag_read = MatrixPointer(m_mag, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
>>> m_pha_read = MatrixPointer(m_pha, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
>>> accum = FrameAccum(m_pha_read, framesize=size, overlaps=4)
>>> car = PolToCar(m_mag_read, accum)
>>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=4).mix(1).out()
>>> right = Delay(fout, delay=0.013).out(1)

Public Data Attributes:

input

PyoObject.

framesize

PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, framesize, overlaps, mul, add])

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

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

setInput(x[, fadetime])

Replace the input attribute.

setFrameSize(x)

Replace the framesize 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. Default to 0.05.

setFrameSize(x)[source]

Replace the framesize attribute.

Args
x: int

new framesize attribute.

property input

PyoObject. Phase input signal.

property framesize

PyoObject. Frame size in samples.

CvlVerb

class CvlVerb(input, impulse='/home/olivier/.local/lib/python3.9/site-packages/pyo/lib/snds/IRMediumHallStereo.wav', bal=0.25, size=1024, mul=1, add=0)[source]

Convolution based reverb.

CvlVerb implements convolution based on a uniformly partitioned overlap-save algorithm. This object can be used to convolve an input signal with an impulse response soundfile to simulate real acoustic spaces.

Parent

PyoObject

Args
input: PyoObject

Input signal to process.

impulse: string, optional

Path to the impulse response soundfile. The file must have the same sampling rate as the server to get the proper convolution. Available at initialization time only. Defaults to ‘IRMediumHallStereo.wav’, located in pyo SNDS_PATH folder.

size: int {pow-of-two}, optional

The size in samples of each partition of the impulse file. Small size means smaller latency but more computation time. If not a power-of-2, the object will find the next power-of-2 greater and use that as the actual partition size. This value must also be greater or equal than the server’s buffer size. Available at initialization time only. Defaults to 1024.

bal: float or PyoObject, optional

Balance between wet and dry signal, between 0 and 1. 0 means no reverb. Defaults to 0.25.

See also

WGVerb, STRev, Freeverb

>>> s = Server().boot()
>>> s.start()
>>> sf = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=0.5)
>>> cv = CvlVerb(sf, SNDS_PATH+"/IRMediumHallStereo.wav", size=1024, bal=0.4).out()

Public Data Attributes:

input

PyoObject.

bal

float or PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, impulse, bal, size, mul, add])

setInput(x[, fadetime])

Replace the input attribute.

setBal(x)

Replace the bal 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])


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. Default to 0.05.

setBal(x)[source]

Replace the bal attribute.

Args
x: float or PyoObject

new bal 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 input

PyoObject. Input signal to process.

property bal

float or PyoObject. Wet / dry balance.

Vectral

class Vectral(input, framesize=1024, overlaps=4, up=1.0, down=0.7, damp=0.9, mul=1, add=0)[source]

Performs magnitude smoothing between successive frames.

Vectral applies filter with different coefficients for increasing and decreasing magnitude vectors, bin by bin.

Parent

PyoObject

Args
input: PyoObject

Magnitude input signal, usually from an FFT analysis.

framesize: int, optional

Frame size in samples. Usually the same as the FFT size. Defaults to 1024.

overlaps: int, optional

Number of overlaps in incomming signal. Usually the same as the FFT overlaps. Defaults to 4.

up: float or PyoObject, optional

Filter coefficient for increasing bins, between 0 and 1. Lower values results in a longer ramp time for bin magnitude. Defaults to 1.

down: float or PyoObject, optional

Filter coefficient for decreasing bins, between 0 and 1. Lower values results in a longer decay time for bin magnitude. Defaults to 0.7

damp: float or PyoObject, optional

High frequencies damping factor, between 0 and 1. Lower values mean more damping. Defaults to 0.9.

Note

Vectral has no out method. Signal must be converted back to time domain, with IFFT, before being sent to output.

>>> s = Server().boot()
>>> snd = SNDS_PATH + '/accord.aif'
>>> size, olaps = 1024, 4
>>> snd = SfPlayer(snd, speed=[.75,.8], loop=True, mul=.3)
>>> fin = FFT(snd, size=size, overlaps=olaps)
>>> pol = CarToPol(fin["real"], fin["imag"])
>>> vec = Vectral(pol["mag"], framesize=size, overlaps=olaps, down=.2, damp=.6)
>>> car = PolToCar(vec, pol["ang"])
>>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=olaps).mix(2).out()
>>> s.start()

Public Data Attributes:

input

PyoObject.

framesize

int.

up

float or PyoObject.

down

float or PyoObject.

damp

float or PyoObject.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(input[, framesize, overlaps, up, ...])

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

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

setInput(x[, fadetime])

Replace the input attribute.

setFrameSize(x)

Replace the framesize attribute.

setUp(x)

Replace the up attribute.

setDown(x)

Replace the down attribute.

setDamp(x)

Replace the damp 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])


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. Default to 0.05.

setFrameSize(x)[source]

Replace the framesize attribute.

Args
x: int

new framesize attribute.

setUp(x)[source]

Replace the up attribute.

Args
x: float or PyoObject

new up attribute.

setDown(x)[source]

Replace the down attribute.

Args
x: float or PyoObject

new down attribute.

setDamp(x)[source]

Replace the damp attribute.

Args
x: float or PyoObject

new damp 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 input

PyoObject. Magnitude input signal.

property framesize

int. Frame size in samples.

property up

float or PyoObject. Filter coefficient for increasing bins.

property down

float or PyoObject. Filter coefficient for decreasing bins.

property damp

float or PyoObject. High frequencies damping factor.

IFFTMatrix

class IFFTMatrix(matrix, index, phase, size=1024, overlaps=4, wintype=2, mul=1, add=0)[source]

Inverse Fast Fourier Transform with a PyoMatrixObject as input.

IFFTMatrix takes a matrix as input and read it as it is a sonogram. On the current column, given by the index argument, the cells at the bottom represent the lower frequencies of the spectrum and the cells at the top, the higher frequencies of the spectrum.

Because a matrix is usually used to store bipolar signals (with the amplitude between -1 and 1), a cell value of -1 represent a frequency bin with no amplitude and a cell value of 1 represents the maximum amplitude for the given frequency bin.

The instantaneous angle value (in polar coordinates) of each frequency bin is given by the current sample in the audio signal given to the phase argument. Generally speaking, the more noisy this signal is, the more energy a bin with a positive amplitude value will have.

Parent

PyoObject

Args
matrix: PyoMatrixObject

The matrix used like a sonogram.

index: PyoObject

Normalized horizontal position in the matrix. 0 is the first column and 1 is the last. Positions between two columns are interpolated. If this signal is a Phasor, the matrix is read from left to right.

phase: PyoObject

Instantaneous angle value used to compute the inverse FFT. Try different signals like white noise or an oscillator with a frequency slightly detuned in relation to the frequency of the FFT (sr / fftsize).

size: int {pow-of-two > 4}, optional

FFT size. Must be a power of two greater than 4. The FFT size is the number of samples used in each analysis frame. This value must match the size attribute of the former FFT object. Defaults to 1024.

overlaps: int, optional

The number of overlaped analysis block. Must be a positive integer. More overlaps can greatly improved sound quality synthesis but it is also more CPU expensive. This value must match the overlaps atribute of the former FFT object. Defaults to 4.

wintype: int, optional

Shape of the envelope used to filter each output frame. Possible shapes are :

  1. rectangular (no windowing)

  2. Hamming

  3. Hanning

  4. Bartlett (triangular)

  5. Blackman 3-term

  6. Blackman-Harris 4-term

  7. Blackman-Harris 7-term

  8. Tuckey (alpha = 0.66)

  9. Sine (half-sine window)

Note

The output of IFFTMatrix must be mixed to reconstruct the real signal from the overlapped streams. It is left to the user to call the mix(number of channels) method on an IFFTMatrix object.

>>> s = Server().boot()
>>> s.start()
>>> m = NewMatrix(512, 512)
>>> m.genSineTerrain(1, 0.15)
>>> index = Phasor([0.4, 0.5])
>>> phase = Noise(0.7)
>>> fout = IFFTMatrix(m, index, phase, size=2048, overlaps=16, wintype=2).mix(2).out()

Public Data Attributes:

index

PyoObject.

phase

PyoObject.

size

int.

wintype

int.

Inherited from PyoObject

mul

float or PyoObject.

add

float or PyoObject.

Public Methods:

__init__(matrix, index, phase[, size, ...])

__len__()

setIndex(x)

Replace the index attribute.

setPhase(x)

Replace the phase attribute.

setSize(x)

Replace the size attribute.

setWinType(x)

Replace the wintype 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])


setIndex(x)[source]

Replace the index attribute.

Args
x: PyoObject

new index attribute.

setPhase(x)[source]

Replace the phase attribute.

Args
x: PyoObject

new phase attribute.

setSize(x)[source]

Replace the size attribute.

Args
x: int

new size attribute.

setWinType(x)[source]

Replace the wintype attribute.

Args
x: int

new wintype 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 index

PyoObject. Normalized horizontal position.

property phase

PyoObject. Instantaneous bin angle value.

property size

int. FFT size.

property wintype

int. Windowing method.