pytimbre.timbre_features.metrics.level.LevelMetrics

class pytimbre.timbre_features.metrics.level.LevelMetrics

Bases: object

This class combines the various level metrics that have existed within the Spectra, TimeHistory, and Waveform classes. But as some of these metrics can be calculated from different methods, this class provides a method to represent the creation of these levels.

__init__()

Create the local copy of all the data that will be provided as properties

Methods

__init__()

Create the local copy of all the data that will be provided as properties

from_spectrum(s)

This function inserts a spectrum object into the class that will be used for the calculation of the various metrics.

from_time_history(time_history)

This will put the time history object as the root data object and permit the determination of the elements from the contents of the time history.

from_waveform(wfm)

This calculates the applicable metrics within the level metric based on the methods that exist within the class for the Waveform class.

get_features()

Attributes

overall_a_weighted_level

A-weighted overall sound pressure level.

overall_c_weighted_level

C-weighted overall sound pressure level.

overall_level

Overall sound pressure level, unweighted (i.e. flat weighted, Z-weighted).

perceived_noise_level

spectrum

time_history

waveform

static from_spectrum(s: Spectrum)

This function inserts a spectrum object into the class that will be used for the calculation of the various metrics. :param s: The object containing the sound pressure levels and the frequencies for the waveform :type s: Spectrum :return: The collection of level metrics organized into the class :rtype: LevelMetrics

static from_time_history(time_history: SpectralTimeHistory)

This will put the time history object as the root data object and permit the determination of the elements from the contents of the time history. :param time_history: The collection of spectra for the calculation of data :type time_history: SpectralTimeHistory :return: The LevelMetrics object that holds the acoustic data :rtype: LevelMetrics

static from_waveform(wfm: Waveform)

This calculates the applicable metrics within the level metric based on the methods that exist within the class for the Waveform class. :param wfm: The audio data object :type wfm: Waveform :return: The collection of level metrics that were created from the waveform :rtype: LevelMetrics

property overall_a_weighted_level

A-weighted overall sound pressure level. Calculated as the energetic sum of the A-weighted power spectrum.

property overall_c_weighted_level

C-weighted overall sound pressure level. Calculated as the energetic sum of the C-weighted power spectrum.

property overall_level

Overall sound pressure level, unweighted (i.e. flat weighted, Z-weighted). Calculated as the energetic sum of the power spectrum.