Timeside Core Analyzers

Global analyzers

Mean DC Shift

class timeside.plugins.analyzer.dc.MeanDCShift[source]

Bases: timeside.core.analyzer.Analyzer

Mean DC shift analyzer

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 analyzer name, such as “Mean Level”, “Max level”, “Total length, 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.

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 unit()[source]

Return the unit of the data such as “dB”, “seconds”, etc…

static version()[source]

Return the version of the processor

Level

class timeside.plugins.analyzer.level.Level[source]

Bases: timeside.core.analyzer.Analyzer

Audio level analyzer

Examples

>>> import timeside
>>> from timeside.core import get_processor
>>> from timeside.core.tools.test_samples import samples
>>> source = samples['sweep.mp3']
>>> decoder = get_processor('file_decoder')(uri=source)
>>> level = get_processor('level')()
>>> (decoder | level).run()
>>> ('level.max' in level.results.keys()) and ('level.rms' in level.results.keys() )
True
>>> max = level.results['level.max']
>>> print(max.data)
[0.]
>>> rms = level.results['level.rms']
>>> print(rms.data)  
[-3.7...]
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 analyzer name, such as “Mean Level”, “Max level”, “Total length, 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.

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 unit()[source]

Return the unit of the data such as “dB”, “seconds”, etc…

static version()[source]

Return the version of the processor

Value Analyzers

Spectrogram

class timeside.plugins.analyzer.spectrogram.Spectrogram(input_blocksize=2048, input_stepsize=None, fft_size=None)[source]

Bases: timeside.core.analyzer.Analyzer

Spectrogram image builder with an extensible buffer based on tables

Parameters
input_blocksizeint, optional

Blocksize of the input signal, default to 2048

input_stepsizestr, optional

The second parameter, default to half blocksize.

fft_sizeint, optional

The size of the fft, default to blocksize.

Examples

>>> import timeside
>>> from timeside.core import get_processor
>>> from timeside.core.tools.test_samples import samples
>>> audio_source = samples['sweep.wav']
>>> decoder = get_processor('file_decoder')(uri=audio_source)
>>> spectrogram = get_processor('spectrogram_analyzer')(input_blocksize=2048, input_stepsize=1024)
>>> pipe = (decoder | spectrogram)
>>> pipe.run()
>>> 'spectrogram_analyzer' in spectrogram.results.keys()
True
>>> result = spectrogram.results['spectrogram_analyzer']
>>> result.data.shape
(344, 1025)

import timeside from timeside.core import get_processor from timeside.core.tools.test_samples import samples audio_source = samples[‘sweep.wav’] decoder = get_processor(‘file_decoder’)(uri=audio_source) spectrogram = get_processor(‘spectrogram_analyzer’)(input_blocksize=2048,

input_stepsize=1024)

pipe = (decoder | spectrogram) pipe.run() res = spectrogram.results[‘spectrogram_analyzer’] res.render()

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 analyzer name, such as “Mean Level”, “Max level”, “Total length, 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.

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 unit()[source]

Return the unit of the data such as “dB”, “seconds”, etc…

static version()[source]

Return the version of the processor