Audio Aggregators

Audio annotation objects.

This module provides audio aggregators. We generally use frame numbers as the reference point, with the frames per second and audio sampling rate values making it possible to translate from the audio samples to visual frames.

class dvt.aggregate.audio.PowerToneAggregator(**kwargs)[source]

Bases: dvt.abstract.Aggregator

Computes the RMS of power and optionally plot the tone of chunks.

The RMS of the tone gives a rough measurement of how loud the input audio track is. The tone PNG files visualize the sound wave over time.

breaks

An increasing list of break points given by frame numbers. When given N+1 breaks, the annotator will produce N outputs.

Type:list
output_dir

Directory pointing to where to store the output spectrogram. Set to None (the default), to suppress the creation of output PNG files.

Type:str
name

A description of the aggregator. Used as a key in the output data.

Type:str
aggregate(ldframe, **kwargs)[source]

Run a collection of annotators over the input material.

If output_dir is not none, produces PNG files of the tone for each group in the desired output location. Then returns the RMS power calculated for each batch of the audio.

name = 'power'
class dvt.aggregate.audio.SpectrogramAggregator(**kwargs)[source]

Bases: dvt.abstract.Aggregator

Compute a spectrogram on the audio input.

A spectrogram shows how the spectrum of frequencies varies with time. This aggregator optionaly produces two types of output: png files visualizing the audio track, and an array of numbers describing the spectrogram.

breaks

An increasing list of break points given by frame numbers. When given N+1 breaks, the annotator will produce N outputs.

Type:list
spectrogram

Should the numeric spectrogram be returned. Defaults to False.

Type:bool
output_dir

Directory pointing to where to store the output spectrogram. Set to None (the default), to suppress the creation of output PNG files.

Type:str
name

A description of the aggregator. Used as a key in the output data.

Type:str
aggregate(ldframe, **kwargs)[source]

Run a collection of annotators over the input material.

If output_dir is not none, produces PNG files of the spectrograms for each group in the desired output location. If spectrogram is set to True, will return the numeric spectrograms. Otherwise returns an empty output.

name = 'spectrogram'