Package topo :: Package pattern :: Module audio :: Class OneDPowerSpectrum
[hide private]
[frames] | no frames]

Class OneDPowerSpectrum

source code

                        object --+        
                                 |        
 param.parameterized.Parameterized --+    
                                     |    
base.patterngenerator.PatternGenerator --+
                                         |
                                        OneDPowerSpectrum
Known Subclasses:

** This class has not been tested, and is still being written **

Returns the spectral density of a rolling window of the input signal each time it is called. Over time, outputs a spectrogram.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, signal=[1, 1, 1, 1], start_location=0, **params)
Reads the given signal into a float32 array.
source code
 
__call__(self)
Perform a DFT (FFT) of the current sample from the signal multiplied by the smoothing window.
source code

Inherited from base.patterngenerator.PatternGenerator: function

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, set_dynamic_time_fn, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  window_length = param.Integer(constant= True, default= 2, doc=...
The interval of the signal on which to perform the Fourier transform.
  windowing_function = param.Parameter(default= numpy.hanning, d...
This function is multiplied with the interval of signal before performing the Fourier transform (i.e.
  window_overlap = param.Integer(default= 0, doc= """Amount of o...
Amount of overlap between each window of the signal.
  sample_spacing = param.Number(constant= True, default= 1.0, do...
...1/samplerate,relate to time, etc...

Inherited from base.patterngenerator.PatternGenerator: bounds, mask, mask_shape, offset, orientation, output_fn, position, scale, size, x, xdensity, y, ydensity

Inherited from param.parameterized.Parameterized: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, signal=[1, 1, 1, 1], start_location=0, **params)
(Constructor)

source code 

Reads the given signal into a float32 array.

The current position of the 'read pointer' in the signal array is given by self.location. start_location allows the starting point to be set.

self.frequencies gives the DFT's sample frequencies, matching the order returned by __call__().

Overrides: object.__init__

__call__(self)
(Call operator)

source code 

Perform a DFT (FFT) of the current sample from the signal multiplied by the smoothing window.

See numpy.fft for information about the Fourier transform.

Overrides: base.patterngenerator.PatternGenerator.__call__

Class Variable Details [hide private]

window_length

The interval of the signal on which to perform the Fourier transform.

The Fourier transform algorithm is most efficient if this is a power of 2 (or can be decomposed into small prime factors - see numpy.fft).

Value:
param.Integer(constant= True, default= 2, doc= """
    The interval of the signal on which to perform the Fourier transform.
    
    The Fourier transform algorithm is most efficient if this is a power of 2
    (or can be decomposed into small prime factors - see numpy.fft).""")

windowing_function

This function is multiplied with the interval of signal before performing the Fourier transform (i.e. it is used to shape the interval).

The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies.

See http://en.wikipedia.org/wiki/Window_function

Value:
param.Parameter(default= numpy.hanning, doc= """
    This function is multiplied with the interval of signal before performing the
    Fourier transform (i.e. it is used to shape the interval). 

    The function chosen here dictates the tradeoff between resolving comparable
    signal strengths with similar frequencies, and resolving disparate signal
    strengths with dissimilar frequencies.

...

window_overlap

Amount of overlap between each window of the signal.
Value:
param.Integer(default= 0, doc= """Amount of overlap between each window of
    the signal.""")

sample_spacing

...1/samplerate,relate to time, etc...
Value:
param.Number(constant= True, default= 1.0, doc= """
    ...1/samplerate,relate to time, etc...""")