ertk.preprocessing.spectrogram.SpectrogramExtractorConfig
- class ertk.preprocessing.spectrogram.SpectrogramExtractorConfig(kind: str = 'mel', pre_emphasis: float = 0, window_size: float = 0.025, window_shift: float = 0.01, win_length_samp: int | None = None, hop_length_samp: int | None = None, n_mels: int = 128, htk_mel: bool = False, n_fft: int = 2048, n_chroma: int = 12, clip_db: float | None = None, fmin: float = 0, fmax: float | None = 8000, power: int = 2, to_log: str | None = 'db', mel_norm: str = 'slaney')
Bases:
ERTKConfigConfiguration for SpectrogramExtractor.
- __init__(kind: str = 'mel', pre_emphasis: float = 0, window_size: float = 0.025, window_shift: float = 0.01, win_length_samp: int | None = None, hop_length_samp: int | None = None, n_mels: int = 128, htk_mel: bool = False, n_fft: int = 2048, n_chroma: int = 12, clip_db: float | None = None, fmin: float = 0, fmax: float | None = 8000, power: int = 2, to_log: str | None = 'db', mel_norm: str = 'slaney') None
Methods
__init__([kind, pre_emphasis, window_size, ...])Inherited Methods
default()Create default config.
from_config(config)Create config object from any compatible config.
from_file(path)Create config from YAML file and optionlly override some values.
merge_with_args(args)Merge config with command-line arguments.
merge_with_config(config)Merge other config into this config.
to_dictconfig()Convert config to DictConfig.
to_file(path)Write config to YAML file.
to_string()Generate YAML string representation of config.
Attributes
Whether to clip noise floor at a given level in dB below maximum.
Maximum frequency for mel bands.
Minimum frequency for mel bands.
The hop size in samples.
Use HTK formula for mel calculation.
The kind of spectrogram to calculate.
Normalisation to apply to mel filters.
Number of chroma bands.
Number of FFT bins.
Number of mel bands.
Raise spectrogram magnitudes to this power.
Amount of pre-emphasis to apply.
Whether to convert spectrogram to logarithmic domain.
The window length in samples.
Amount window moves each frame, in seconds.
Size of window in seconds.
- clip_db: float | None = None
Whether to clip noise floor at a given level in dB below maximum. Default is
Nonewhich does no clipping. This is only used ifto_dbisTrue.
- hop_length_samp: int | None = None
The hop size in samples. This overrides
window_shiftif given.
- kind: str = 'mel'
The kind of spectrogram to calculate. “mel” calculates a mel spectrogram, whereas “stft” just uses linear frequency.
- n_fft: int = 2048
Number of FFT bins. Default is to use the next power of 2 greater than
window_size * sr.
- power: int = 2
Raise spectrogram magnitudes to this power. Default is 2 which is the usual power spectrogram.
- to_log: str | None = 'db'
Whether to convert spectrogram to logarithmic domain. Default is
dbwhich converts to dB units. Ifto_log=='log'then the natual logarithm is taken. Note that this argument is mainly only useful ifpower == 2.
- win_length_samp: int | None = None
The window length in samples. This overrides
window_sizeif given.