Package timeside :: Package grapher :: Module spectrogram_log :: Class SpectrogramLog
[hide private]
[frames] | no frames]

Class SpectrogramLog

source code

         object --+            
                  |            
component.Component --+        
                      |        
         core.Processor --+    
                          |    
               core.Grapher --+
                              |
                             SpectrogramLog
Known Subclasses:

Builds a PIL image representing a spectrogram of the audio stream (level vs. frequency vs. time). Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.

Nested Classes [hide private]

Inherited from core.Processor: __metaclass__

Instance Methods [hide private]
 
__init__(self, width=1024, height=256, bg_color=(0, 0, 0), color_scheme='default')
Create a new grapher.
source code
 
setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)
Allocate internal resources and reset state, so that this processor is ready for a new run.
source code
 
set_scale(self)
generate the lookup which translates y-coordinate to fft-bin
source code
 
draw_spectrum(self, x, spectrum) source code
 
process(self, frames, eod=False)
Process input frames and return a (output_frames, eod) tuple.
source code
 
post_process(self)
Apply last 2D transforms
source code

Inherited from core.Grapher: draw_anti_aliased_pixels, draw_peaks, draw_peaks_contour, draw_peaks_inverted, render, set_colors, watermark

Inherited from core.Processor: __del__, __or__, blocksize, channels, mediainfo, release, samplerate, totalframes, uuid

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
id()
Short alphanumeric, lower-case string which uniquely identify this processor, suitable for use as an HTTP/GET argument value, in filenames, etc...
source code
 
name()
Return the graph name, such as "Waveform", "Spectral view", etc..
source code
Class Variables [hide private]

Inherited from core.Grapher: fft_size, frame_cursor, lower_freq, pixel_cursor

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, width=1024, height=256, bg_color=(0, 0, 0), color_scheme='default')
(Constructor)

source code 

Create a new grapher. width and height are generally in pixels but could be something else for eg. svg rendering, etc..

Decorators:
  • @interfacedoc
Overrides: object.__init__

id()
Static Method

source code 

Short alphanumeric, lower-case string which uniquely identify this processor, suitable for use as an HTTP/GET argument value, in filenames, etc...

Decorators:
  • @interfacedoc
Overrides: core.Grapher.id

name()
Static Method

source code 

Return the graph name, such as "Waveform", "Spectral view", etc..

Decorators:
  • @interfacedoc
Overrides: core.Grapher.name

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)

source code 

Allocate internal resources and reset state, so that this processor is ready for a new run.

The channels, samplerate and/or blocksize and/or totalframes arguments may be required by processors which accept input. An error will occur if any of these arguments is passed to an output-only processor such as a decoder.

Decorators:
  • @interfacedoc
Overrides: core.Processor.setup

process(self, frames, eod=False)

source code 

Process input frames and return a (output_frames, eod) tuple. Both input and output frames are 2D numpy arrays, where columns are channels, and containing an undetermined number of frames. eod=True means that the end-of-data has been reached.

Output-only processors (such as decoders) will raise an exception if the frames argument is not None. All processors (even encoders) return data, even if that means returning the input unchanged.

Warning: it is required to call setup() before this method.

Decorators:
  • @interfacedoc
Overrides: core.Processor.process

post_process(self)

source code 

Apply last 2D transforms

Decorators:
  • @interfacedoc
Overrides: core.Processor.post_process