dcase_util.features.MelExtractor

class dcase_util.features.MelExtractor(fs=44100, win_length_samples=None, hop_length_samples=None, win_length_seconds=0.04, hop_length_seconds=0.02, spectrogram_type='magnitude', n_fft=2048, window_type='hamming_asymmetric', n_mels=40, fmin=0, fmax=None, normalize_mel_bands=False, htk=False, logarithmic=True, **kwargs)[source]

Feature extractor class to extract mel band energy features

Constructor

Parameters
fsint

Sampling rate of the incoming signal.

win_length_samplesint

Window length in samples. Default value None

hop_length_samplesint

Hop length in samples. Default value None

win_length_secondsfloat

Window length in seconds. Default value 0.04

hop_length_secondsfloat

Hop length in seconds. Default value 0.02

spectrogram_typestr

Spectrogram type, magnitude or power spectrogram. Default value ‘magnitude’

n_fftint

Length of the FFT window. Default value 2048

window_typestr

Window function type. Default value ‘hamming_asymmetric’

n_melsint

Number of mel bands to generate Default value 40

fminint

Lowest frequency in mel bands (in Hz) Default value 0

fmaxint

Highest frequency in mel bands (in Hz), if None, fmax = fs/2.0 Default value None

normalize_mel_bandsbool

Normalize mel band to have peak at 1.0 Default value False

htkbool

Use HTK formula for mel band creation instead of Slaney Default value False

logarithmicbool

Switch for log mel-band energies Default value True

__init__(fs=44100, win_length_samples=None, hop_length_samples=None, win_length_seconds=0.04, hop_length_seconds=0.02, spectrogram_type='magnitude', n_fft=2048, window_type='hamming_asymmetric', n_mels=40, fmin=0, fmax=None, normalize_mel_bands=False, htk=False, logarithmic=True, **kwargs)[source]

Constructor

Parameters
fsint

Sampling rate of the incoming signal.

win_length_samplesint

Window length in samples. Default value None

hop_length_samplesint

Hop length in samples. Default value None

win_length_secondsfloat

Window length in seconds. Default value 0.04

hop_length_secondsfloat

Hop length in seconds. Default value 0.02

spectrogram_typestr

Spectrogram type, magnitude or power spectrogram. Default value ‘magnitude’

n_fftint

Length of the FFT window. Default value 2048

window_typestr

Window function type. Default value ‘hamming_asymmetric’

n_melsint

Number of mel bands to generate Default value 40

fminint

Lowest frequency in mel bands (in Hz) Default value 0

fmaxint

Highest frequency in mel bands (in Hz), if None, fmax = fs/2.0 Default value None

normalize_mel_bandsbool

Normalize mel band to have peak at 1.0 Default value False

htkbool

Use HTK formula for mel band creation instead of Slaney Default value False

logarithmicbool

Switch for log mel-band energies Default value True

Methods

__init__([fs, win_length_samples, ...])

Constructor

extract(y)

Extract features for the audio signal.

get_spectrogram(y[, n_fft, ...])

Spectrogram

get_window_function(n[, window_type])

Window function

log([level])

Log container content

show([mode, indent, visualize])

Print container content

to_html([indent])

Get container information in a HTML formatted string

to_string([ui, indent])

Get container information in a string

Attributes

description

Extractor description

label

Extractor label

logger

Logger instance