Audio Signal Analysis¶
Tools to analyze audio signal characteristics.
These objects are designed to extract specific information and meaning from an audio stream. Analysis data is stored in the object’s internal buffer, as an audio rate signal (except for the Scope and Spectrum objects, which are mainly used for visualization, and can share their results via function handlers). The user can use these objects for controlling parameters of others objects.
Objects in this category¶
Follower
: Envelope follower.Follower2
: Envelope follower with different attack and release times.ZCross
: Zero-crossing counter.Yin
: Pitch tracker using the Yin algorithm.Centroid
: Computes the spectral centroid of an input signal.AttackDetector
: Audio signal onset detection.Spectrum
: Spectrum analyzer and display.Scope
: Oscilloscope - audio waveform display.PeakAmp
: Peak amplitude follower.RMS
: Returns the RMS (Root-Mean-Square) value of a signal.
Follower¶
- class Follower(input, freq=20, mul=1, add=0)[source]¶
Envelope follower.
Output signal is the continuous mean amplitude of an input signal.
- Parent
- Args
- input: PyoObject
Input signal to process.
- freq: float or PyoObject, optional
Cutoff frequency of the filter in hertz. Default to 20.
Note
The out() method is bypassed. Follower’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
float or PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, freq, mul, add])setInput
(x[, fadetime])Replace the input attribute.
setFreq
(x)Replace the freq attribute.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- 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.
- 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 freq¶
float or PyoObject. Cutoff frequency of the filter.
Follower2¶
- class Follower2(input, risetime=0.01, falltime=0.1, mul=1, add=0)[source]¶
Envelope follower with different attack and release times.
Output signal is the continuous mean amplitude of an input signal.
- Parent
- Args
- input: PyoObject
Input signal to process.
- risetime: float or PyoObject, optional
Time to reach upward value in seconds. Default to 0.01.
- falltime: float or PyoObject, optional
Time to reach downward value in seconds. Default to 0.1.
Note
The out() method is bypassed. Follower’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
float or PyoObject.
float or PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, risetime, falltime, mul, add])setInput
(x[, fadetime])Replace the input attribute.
setRisetime
(x)Replace the risetime attribute.
setFalltime
(x)Replace the falltime attribute.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- setRisetime(x)[source]¶
Replace the risetime attribute.
- Args
- x: float or PyoObject
New risetime attribute.
- setFalltime(x)[source]¶
Replace the falltime attribute.
- Args
- x: float or PyoObject
New falltime attribute.
- 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.
- 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 risetime¶
float or PyoObject. Time to reach upward value in seconds.
- property falltime¶
float or PyoObject. Time to reach downward value in seconds.
ZCross¶
- class ZCross(input, thresh=0.0, mul=1, add=0)[source]¶
Zero-crossing counter.
Output signal is the number of zero-crossing occured during each buffer size, normalized between 0 and 1.
- Parent
- Args
- input: PyoObject
Input signal to process.
- thresh: float, optional
Minimum amplitude difference allowed between adjacent samples to be included in the zeros count. Defaults to 0.
Note
The out() method is bypassed. ZCross’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
float.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, thresh, mul, add])setInput
(x[, fadetime])Replace the input attribute.
setThresh
(x)Replace the thresh attribute.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- setThresh(x)[source]¶
Replace the thresh attribute.
- Args
- x: float
New amplitude difference threshold.
- 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.
- 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 thresh¶
float. Amplitude difference threshold.
Yin¶
- class Yin(input, tolerance=0.2, minfreq=40, maxfreq=1000, cutoff=1000, winsize=1024, mul=1, add=0)[source]¶
Pitch tracker using the Yin algorithm.
Pitch tracker using the Yin algorithm based on the implementation in C of aubio. This algorithm was developped by A. de Cheveigne and H. Kawahara and published in
de Cheveigne, A., Kawahara, H. (2002) ‘YIN, a fundamental frequency estimator for speech and music’, J. Acoust. Soc. Am. 111, 1917-1930.
The audio output of the object is the estimated frequency, in Hz, of the input sound.
- Parent
- Args
- input: PyoObject
Input signal to process.
- tolerance: float, optional
Parameter for minima selection, between 0 and 1. Defaults to 0.2.
- minfreq: float, optional
Minimum estimated frequency in Hz. Frequency below this threshold will be ignored. Defaults to 40.
- maxfreq: float, optional
Maximum estimated frequency in Hz. Frequency above this threshold will be ignored. Defaults to 1000.
- cutoff: float, optional
Cutoff frequency, in Hz, of the lowpass filter applied on the input sound. Defaults to 1000.
The lowpass filter helps the algorithm to detect the fundamental frequency by filtering higher harmonics.
- winsize: int, optional
Size, in samples, of the analysis window. Must be higher that two period of the lowest desired frequency.
Available at initialization time only. Defaults to 1024.
Public Data Attributes:
PyoObject.
float.
float.
float.
float.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, tolerance, minfreq, ...])setInput
(x[, fadetime])Replace the input attribute.
setTolerance
(x)Replace the tolerance attribute.
setMinfreq
(x)Replace the minfreq attribute.
setMaxfreq
(x)Replace the maxfreq attribute.
setCutoff
(x)Replace the cutoff attribute.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- setTolerance(x)[source]¶
Replace the tolerance attribute.
- Args
- x: float
New parameter for minima selection, between 0 and 1.
- setCutoff(x)[source]¶
Replace the cutoff attribute.
- Args
- x: float
New input lowpass filter cutoff frequency.
- 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.
- 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 tolerance¶
float. Parameter for minima selection.
- property minfreq¶
float. Minimum frequency detected.
- property maxfreq¶
float. Maximum frequency detected.
- property cutoff¶
float. Input lowpass filter cutoff frequency.
Centroid¶
- class Centroid(input, size=1024, mul=1, add=0)[source]¶
Computes the spectral centroid of an input signal.
Output signal is the spectral centroid, in Hz, of the input signal. It indicates where the “center of mass” of the spectrum is. Perceptually, it has a robust connection with the impression of “brightness” of a sound.
Centroid does its computation with two overlaps, so a new output value comes every half of the FFT window size.
- Parent
- Args
- input: PyoObject
Input signal to process.
- size: int, optional
Size, as a power-of-two, of the FFT used to compute the centroid.
Available at initialization time only. Defaults to 1024.
Note
The out() method is bypassed. Centroid’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, size, mul, add])setInput
(x[, fadetime])Replace the input attribute.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- 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.
- 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.
AttackDetector¶
- class AttackDetector(input, deltime=0.005, cutoff=10, maxthresh=3, minthresh=-30, reltime=0.1, mul=1, add=0)[source]¶
Audio signal onset detection.
AttackDetector analyses an audio signal in input and output a trigger each time an onset is detected. An onset is a sharp amplitude rising while the signal had previously fall below a minimum threshold. Parameters must be carefully tuned depending on the nature of the analysed signal and the level of the background noise.
- Parent
- Args
- input: PyoObject
Input signal to process.
- deltime: float, optional
Delay time, in seconds, between previous and current rms analysis to compare. Defaults to 0.005.
- cutoff: float, optional
Cutoff frequency, in Hz, of the amplitude follower’s lowpass filter. Defaults to 10.
Higher values are more responsive and also more likely to give false onsets.
- maxthresh: float, optional
Attack threshold in positive dB (current rms must be higher than previous rms + maxthresh to be reported as an attack). Defaults to 3.0.
- minthresh: float, optional
Minimum threshold in dB (signal must fall below this threshold to allow a new attack to be detected). Defaults to -30.0.
- reltime: float, optional
Time, in seconds, to wait before reporting a new attack. Defaults to 0.1.
Public Data Attributes:
PyoObject.
float.
float.
float.
float.
float.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, deltime, cutoff, ...])setInput
(x[, fadetime])Replace the input attribute.
setDeltime
(x)Replace the deltime attribute.
setCutoff
(x)Replace the cutoff attribute.
setMaxthresh
(x)Replace the maxthresh attribute.
setMinthresh
(x)Replace the minthresh attribute.
setReltime
(x)Replace the reltime attribute.
readyToDetect
()Initializes variables in the ready state to detect an attack.
out
([chnl, inc, dur, delay])Start processing and send samples to audio output beginning at chnl.
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.
- setCutoff(x)[source]¶
Replace the cutoff attribute.
- Args
- x: float
New cutoff for the follower lowpass filter.
- setReltime(x)[source]¶
Replace the reltime attribute.
- Args
- x: float
Time, in seconds, to wait before reporting a new attack.
- 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.
- 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 deltime¶
float. Delay between rms analysis.
- property cutoff¶
float. Cutoff for the follower lowpass filter.
- property maxthresh¶
float. Attack threshold in dB.
- property minthresh¶
float. Minimum threshold in dB.
- property reltime¶
float. Time to wait before reporting a new attack.
Spectrum¶
- class Spectrum(input, size=1024, wintype=2, function=None, wintitle='Spectrum')[source]¶
Spectrum analyzer and display.
Spectrum measures the magnitude of an input signal versus frequency within a user defined range. It can show both magnitude and frequency on linear or logarithmic scale.
- Parent
- 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.
- wintype: int, optional
Shape of the envelope used to filter each input frame. Possible shapes are :
rectangular (no windowing)
Hamming
Hanning
Bartlett (triangular)
Blackman 3-term
Blackman-Harris 4-term
Blackman-Harris 7-term
Tuckey (alpha = 0.66)
Sine (half-sine window)
- function: python callable, optional
If set, this function will be called with magnitudes (as list of lists, one list per channel). Useful if someone wants to save the analysis data into a text file. Defaults to None.
- wintitle: string, optional
GUI window title. Defaults to “Spectrum”.
Note
Spectrum has no out method.
Spectrum has no mul and add attributes.
Public Data Attributes:
PyoObject.
int.
int.
float.
float.
float.
int.
int.
boolean.
boolean.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, size, wintype, function, ...])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.
setInput
(x[, fadetime])Replace the input attribute.
setSize
(x)Replace the size attribute.
setWinType
(x)Replace the wintype attribute.
setFunction
(function)Sets the function to be called to retrieve the analysis data.
poll
(active)Turns on and off the analysis polling.
polltime
(time)Sets the polling time in seconds.
setLowFreq
(x)Sets the lower frequency, in Hz, returned by the analysis.
setHighFreq
(x)Sets the higher frequency, in Hz, returned by the analysis.
setLowbound
(x)Sets the lower frequency, as multiplier of sr, returned by the analysis.
setHighbound
(x)Sets the higher frequency, as multiplier of sr, returned by the analysis.
getLowfreq
()Returns the current lower frequency, in Hz, used by the analysis.
getHighfreq
()Returns the current higher frequency, in Hz, used by the analysis.
setWidth
(x)Sets the width, in pixels, of the current display.
setHeight
(x)Sets the height, in pixels, of the current display.
setFscaling
(x)Sets the frequency display to linear or logarithmic.
setMscaling
(x)Sets the magnitude display to linear or logarithmic.
getFscaling
()Returns the scaling of the frequency display.
getMscaling
()Returns the scaling of the magnitude display.
setGain
(x)Set the gain of the analysis data.
view
([title, wxnoserver])Opens a window showing the result of the analysis.
showChannelNames
([visible])If True (the default), channel names will be displayed in the window.
setChannelNames
(names)Change the stream names displayed in the spectrum window.
refreshView
()Updates the graphical display of the spectrum.
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:
_setViewFrame
(frame)Inherited from
PyoObject
_init_play
()_reset_from_set
([attr])Inherited from
PyoObjectBase
_autoplay
([dur, delay])_autostop
([wait])
- play(dur=0, delay=0)[source]¶
Start processing without sending samples to output. This method is called automatically at the object creation.
This method returns self, allowing it to be applied at the object creation.
- Args
- dur: float, optional
Duration, in seconds, of the object’s activation. The default is 0 and means infinite duration.
- delay: float, optional
Delay, in seconds, before the object’s activation. Defaults to 0.
- out(chnl=0, inc=1, dur=0, delay=0)[source]¶
Start processing and send samples to audio output beginning at chnl.
This method returns self, allowing it to be applied at the object creation.
- Args
- chnl: int, optional
Physical output assigned to the first audio stream of the object. Defaults to 0.
- inc: int, optional
Output channel increment value. Defaults to 1.
- dur: float, optional
Duration, in seconds, of the object’s activation. The default is 0 and means infinite duration.
- delay: float, optional
Delay, in seconds, before the object’s activation. Defaults to 0.
If chnl >= 0, successive streams increment the output number by inc and wrap around the global number of channels.
If chnl is negative, streams begin at 0, increment the output number by inc and wrap around the global number of channels. Then, the list of streams is scrambled.
If chnl is a list, successive values in the list will be assigned to successive streams.
- stop(wait=0)[source]¶
Stop processing.
This method returns self, allowing it to be applied at the object creation.
- Args
- wait: float, optional
Delay, in seconds, before the process is actually stopped. If autoStartChildren is activated in the Server, this value is propagated to the children objects. Defaults to 0.
Note
if the method setStopDelay(x) was called before calling stop(wait) with a positive wait value, the wait value won’t overwrite the value given to setStopDelay for the current object, but will be the one propagated to children objects. This allow to set a waiting time for a specific object with setStopDelay whithout changing the global delay time given to the stop method.
Fader and Adsr objects ignore waiting time given to the stop method because they already implement a delayed processing triggered by the stop call.
- 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.
- setFunction(function)[source]¶
Sets the function to be called to retrieve the analysis data.
- Args
- function: python callable
The function called by the internal timer to retrieve the analysis data. The function must be created with one argument and will receive the data as a list of lists (one list per channel).
- poll(active)[source]¶
Turns on and off the analysis polling.
- Args
- active: boolean
If True, starts the analysis polling, False to stop it. defaults to True.
- polltime(time)[source]¶
Sets the polling time in seconds.
- Args
- time: float
Adjusts the frequency of the internal timer used to retrieve the current analysis frame. defaults to 0.05.
- setLowFreq(x)[source]¶
Sets the lower frequency, in Hz, returned by the analysis.
- Args
- x: float
New low frequency in Hz. Adjusts the lowbound attribute, as x / sr.
- setHighFreq(x)[source]¶
Sets the higher frequency, in Hz, returned by the analysis.
- Args
- x: float
New high frequency in Hz. Adjusts the highbound attribute, as x / sr.
- setLowbound(x)[source]¶
Sets the lower frequency, as multiplier of sr, returned by the analysis.
Returns the real low frequency in Hz.
- Args
- x: float {0 <= x <= 0.5}
new lowbound attribute.
- setHighbound(x)[source]¶
Sets the higher frequency, as multiplier of sr, returned by the analysis.
Returns the real high frequency in Hz.
- Args
- x: float {0 <= x <= 0.5}
new highbound attribute.
- setWidth(x)[source]¶
Sets the width, in pixels, of the current display.
Used internally to build the list of points to draw.
- Args
- x: int
new width attribute.
- setHeight(x)[source]¶
Sets the height, in pixels, of the current display.
Used internally to build the list of points to draw.
- Args
- x: int
new height attribute.
- setFscaling(x)[source]¶
Sets the frequency display to linear or logarithmic.
- Args
- x: boolean
If True, the frequency display is logarithmic. False turns it back to linear. Defaults to False.
- setMscaling(x)[source]¶
Sets the magnitude display to linear or logarithmic.
- Args
- x: boolean
If True, the magnitude display is logarithmic (which means in dB). False turns it back to linear. Defaults to True.
- getFscaling()[source]¶
Returns the scaling of the frequency display.
Returns True for logarithmic or False for linear.
- getMscaling()[source]¶
Returns the scaling of the magnitude display.
Returns True for logarithmic or False for linear.
- setGain(x)[source]¶
Set the gain of the analysis data. For drawing purpose.
- Args
- x: float
new gain attribute, as linear values.
- view(title='Spectrum', wxnoserver=False)[source]¶
Opens a window showing the result of the analysis.
- Args
- title: string, optional
Window title. Defaults to “Spectrum”.
- 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.
- showChannelNames(visible=True)[source]¶
If True (the default), channel names will be displayed in the window.
- setChannelNames(names)[source]¶
Change the stream names displayed in the spectrum window.
If given a list of strings, these will be displayed as the name of the consecutive audio streams instead of the generic ‘chan X’ names.
- refreshView()[source]¶
Updates the graphical display of the spectrum.
Called automatically by the internal timer.
- property input¶
PyoObject. Input signal to process.
- property size¶
int. FFT size.
- property wintype¶
int. Windowing method.
- property gain¶
float. Sets the gain of the analysis data.
- property lowbound¶
float. Lowest frequency (multiplier of sr) to output.
- property highbound¶
float. Highest frequency (multiplier of sr) to output.
- property width¶
int. Width, in pixels, of the current display.
- property height¶
int. Height, in pixels, of the current display.
- property fscaling¶
boolean. Scaling of the frequency display.
- property mscaling¶
boolean. Scaling of the magnitude display.
Scope¶
- class Scope(input, length=0.05, gain=0.67, function=None, wintitle='Scope')[source]¶
Oscilloscope - audio waveform display.
Oscilloscopes are used to observe the change of an electrical signal over time.
- Parent
- Args
- input: PyoObject
Input signal to process.
- length: float, optional
Length, in seconds, of the displayed window. Can’t be a list. Defaults to 0.05.
- gain: float, optional
Linear gain applied to the signal to be displayed. Can’t be a list. Defaults to 0.67.
- function: python callable, optional
If set, this function will be called with samples (as list of lists, one list per channel). Useful if someone wants to save the analysis data into a text file. Defaults to None.
- wintitle: string, optional
GUI window title. Defaults to “Scope”.
Note
Scope has no out method.
Scope has no mul and add attributes.
Public Data Attributes:
PyoObject.
float.
float.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, length, gain, function, ...])setInput
(x[, fadetime])Replace the input attribute.
setLength
(x)Replace the length attribute.
setGain
(x)Set the gain boost applied to the analysed data.
poll
(active)Turns on and off the analysis polling.
setWidth
(x)Gives the width of the display to the analyzer.
setHeight
(x)Gives the height of the display to the analyzer.
view
([title, wxnoserver])Opens a window showing the incoming waveform.
setFunction
(function)Sets the function to be called to retrieve the analysis data.
showChannelNames
([visible])If True (the default), channel names will be displayed in the window.
setChannelNames
(names)Change the stream names displayed in the spectrum window.
refreshView
()Updates the graphical display of the scope.
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:
_setViewFrame
(frame)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.
- setGain(x)[source]¶
Set the gain boost applied to the analysed data. For drawing purpose.
- Args
- x: float
new gain attribute, as linear values.
- poll(active)[source]¶
Turns on and off the analysis polling.
- Args
- active: boolean
If True, starts the analysis polling, False to stop it. defaults to True.
- setWidth(x)[source]¶
Gives the width of the display to the analyzer.
The analyzer needs this value to construct the list of points to draw on the display.
- Args
- x: int
Width of the display in pixel value. The default width is 500.
- setHeight(x)[source]¶
Gives the height of the display to the analyzer.
The analyzer needs this value to construct the list of points to draw on the display.
- Args
- x: int
Height of the display in pixel value. The default height is 400.
- view(title='Scope', wxnoserver=False)[source]¶
Opens a window showing the incoming waveform.
- Args
- title: string, optional
Window title. Defaults to “Scope”.
- 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.
- setFunction(function)[source]¶
Sets the function to be called to retrieve the analysis data.
- Args
- function: python callable
The function called by the internal timer to retrieve the analysis data. The function must be created with one argument and will receive the data as a list of lists (one list per channel).
- showChannelNames(visible=True)[source]¶
If True (the default), channel names will be displayed in the window.
- setChannelNames(names)[source]¶
Change the stream names displayed in the spectrum window.
If given a list of strings, these will be displayed as the name of the consecutive audio streams instead of the generic ‘chan X’ names.
- refreshView()[source]¶
Updates the graphical display of the scope.
Called automatically by the internal timer.
- property input¶
PyoObject. Input signal to process.
- property length¶
float. Window length.
- property gain¶
float. Sets the gain of the analysis data.
PeakAmp¶
- class PeakAmp(input, function=None, mul=1, add=0)[source]¶
Peak amplitude follower.
Output signal is the continuous peak amplitude of an input signal. A new peaking value is computed every buffer size. If function argument is not None, it should be a function that will be called periodically with a variable-length argument list containing the peaking values of all object’s streams. Useful for meter drawing. Function definition must look like this:
>>> def getValues(*args): ... print(args)
- Parent
- Args
- input: PyoObject
Input signal to process.
- function: callable, optional
Function that will be called with amplitude values in arguments. Default to None.
Note
The out() method is bypassed. PeakAmp’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, function, mul, add])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.
setInput
(x[, fadetime])Replace the input attribute.
setFunction
(x)Replace the function attribute.
polltime
(x)Sets the delay, in seconds, between each call of the function.
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:
_buildList
()Inherited from
PyoObject
_init_play
()_reset_from_set
([attr])Inherited from
PyoObjectBase
_autoplay
([dur, delay])_autostop
([wait])
- 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.
- 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.
- setFunction(x)[source]¶
Replace the function attribute.
- Args
- x: callable
New function to call with amplitude values in arguments.
- polltime(x)[source]¶
Sets the delay, in seconds, between each call of the function.
- Args
- x: float
New polling time in seconds.
- 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.
- 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 function¶
PyoObject. function signal to process.
RMS¶
- class RMS(input, function=None, mul=1, add=0)[source]¶
Returns the RMS (Root-Mean-Square) value of a signal.
Output signal is the continuous rms of an input signal. A new rms value is computed every buffer size. If function argument is not None, it should be a function that will be called periodically with a variable-length argument list containing the rms values of all object’s streams. Useful for meter drawing. Function definition must look like this:
>>> def getValues(*args): ... print(args)
- Parent
- Args
- input: PyoObject
Input signal to process.
- function: callable, optional
Function that will be called with amplitude values in arguments. Default to None.
Note
The out() method is bypassed. RMS’s signal can not be sent to audio outs.
Public Data Attributes:
PyoObject.
PyoObject.
Inherited from
PyoObject
mul
float or PyoObject.
add
float or PyoObject.
Public Methods:
__init__
(input[, function, mul, add])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.
setInput
(x[, fadetime])Replace the input attribute.
setFunction
(x)Replace the function attribute.
polltime
(x)Sets the delay, in seconds, between each call of the function.
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:
_buildList
()Inherited from
PyoObject
_init_play
()_reset_from_set
([attr])Inherited from
PyoObjectBase
_autoplay
([dur, delay])_autostop
([wait])
- 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.
- 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.
- setFunction(x)[source]¶
Replace the function attribute.
- Args
- x: callable
New function to call with amplitude values in arguments.
- polltime(x)[source]¶
Sets the delay, in seconds, between each call of the function.
- Args
- x: float
New polling time in seconds.
- 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.
- 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 function¶
PyoObject. function signal to process.