Grapher

Core module

class timeside.core.grapher.DisplayAnalyzer(width=1024, height=256, bg_color=(0, 0, 0), color_scheme='default')[source]

image from analyzer result This is an Abstract base class

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

post_process(self)[source]

Post-Process data after processign the input frames with process()

Processors such as analyzers will produce Results during the Post-Process

process(self, frames, eod=False)[source]

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.

class timeside.core.grapher.Grapher(width=1024, height=256, bg_color=None, color_scheme='default')[source]

Generic abstract class for the graphers

draw_anti_aliased_pixels(self, x, y1, y2, color)[source]

vertical anti-aliasing at y1 and y2

draw_peaks(self, x, peaks, line_color)[source]

Draw 2 peaks at x

draw_peaks_inverted(self, x, peaks, line_color)[source]

Draw 2 inverted peaks at x

render(self, output=None)[source]

Return a PIL Image object visually representing all of the data passed by repeatedly calling process() and write the image to the output if specified

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

class timeside.core.grapher.Spectrum(fft_size, samplerate, blocksize, totalframes, lower, higher, window_function=None)[source]

FFT based frequency analysis of audio frames.

process(self, frames, eod, spec_range=120.0)[source]

Returns a tuple containing the spectral centroid and the spectrum (dB scales) of the input audio frames. FFT window sizes are adatable to the input frame size.

Graphers

Waveform

class timeside.plugins.grapher.waveform_simple.Waveform(width=1024, height=256, bg_color=(255, 255, 255), color_scheme='default')[source]

Simple monochrome waveform image.

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

static id()[source]

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

static name()[source]

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

post_process(self, output=None)[source]

Post-Process data after processign the input frames with process()

Processors such as analyzers will produce Results during the Post-Process

process(self, frames, eod=False)[source]

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.

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor

WaveformCentroid

class timeside.plugins.grapher.waveform_centroid.WaveformCentroid(width=4096, height=256, bg_color=(0, 0, 0), color_scheme='default')[source]

Waveform where peaks are colored relatively to the spectral centroids of each frame buffer.

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

static id()[source]

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

static name()[source]

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

process(self, frames, eod=False)[source]

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.

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor

WaveformTransparent

class timeside.plugins.grapher.waveform_transparent.WaveformTransparent(width=1024, height=256, bg_color=None, color_scheme='default')[source]

Transparent waveform.

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

static id()[source]

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

static name()[source]

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

process(self, frames, eod=False)[source]

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.

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor

WaveformContour

class timeside.plugins.grapher.waveform_contour.WaveformContourBlack(width=1024, height=256, bg_color=(0, 0, 0), color_scheme='default')[source]

Black amplitude contour waveform.

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

static id()[source]

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

static name()[source]

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

process(self, frames, eod=False)[source]

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.

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor

class timeside.plugins.grapher.waveform_contour.WaveformContourWhite(width=1024, height=256, bg_color=(255, 255, 255), color_scheme='default')[source]

an white amplitude contour wavform.

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

static id()[source]

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

static name()[source]

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

SpectrogramLog

class timeside.plugins.grapher.spectrogram_log.SpectrogramLog(width=4096, height=256, bg_color=(0, 0, 0), color_scheme='default')[source]

Logarithmic scaled spectrogram (level vs. frequency vs. time).

Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.

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

static id()[source]

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

static name()[source]

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

post_process(self)[source]

Apply last 2D transforms

process(self, frames, eod=False)[source]

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.

set_scale(self)[source]

generate the lookup which translates y-coordinate to fft-bin

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor

SpectrogramLin

class timeside.plugins.grapher.spectrogram_lin.SpectrogramLinear(width=4096, height=256, bg_color=(0, 0, 0), color_scheme='default')[source]

Linear scaled spectrogram (level vs. frequency vs. time).

Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.

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

static id()[source]

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

static name()[source]

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

set_scale(self)[source]

generate the lookup which translates y-coordinate to fft-bin

setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None)[source]

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.

static version()[source]

Return the version of the processor