torchaudio.compliance.kaldi.mfcc¶
- torchaudio.compliance.kaldi.mfcc(waveform: Tensor, blackman_coeff: float = 0.42, cepstral_lifter: float = 22.0, channel: int = -1, dither: float = 0.0, energy_floor: float = 1.0, frame_length: float = 25.0, frame_shift: float = 10.0, high_freq: float = 0.0, htk_compat: bool = False, low_freq: float = 20.0, num_ceps: int = 13, min_duration: float = 0.0, num_mel_bins: int = 23, preemphasis_coefficient: float = 0.97, raw_energy: bool = True, remove_dc_offset: bool = True, round_to_power_of_two: bool = True, sample_frequency: float = 16000.0, snip_edges: bool = True, subtract_mean: bool = False, use_energy: bool = False, vtln_high: float = -500.0, vtln_low: float = 100.0, vtln_warp: float = 1.0, window_type: str = 'povey') Tensor [源代码]¶
从原始音频信号创建 mfcc。这与 Kaldi 的 compute-mfcc-feats 的输入/输出相匹配。
- 参数:
waveform (Tensor) – 大小为 (c, n) 的音频张量,其中 c 的范围为 [0,2)
blackman_coeff (float, 可选) – 广义 Blackman 窗口的常数系数。(默认值:
0.42
)cepstral_lifter (float, 可选) – 控制 MFCC 缩放的常数 (默认值:
22.0
)channel (int, 可选) – 要提取的通道 (-1 -> 期望单声道, 0 -> 左声道, 1 -> 右声道) (默认值:
-1
)dither (float, 可选) – 抖动常数 (0.0 表示无抖动)。如果关闭此项,则应设置 energy_floor 选项,例如设置为 1.0 或 0.1 (默认值:
0.0
)energy_floor (float, 可选) – 频谱图计算中能量的下限 (绝对值,而非相对值)。注意:此下限应用于表示总信号能量的第零个分量。各个频谱图元素的下限固定为 std::numeric_limits<float>::epsilon()。(默认值:
1.0
)frame_length (float, 可选) – 帧长,以毫秒为单位 (默认值:
25.0
)frame_shift (float, 可选) – 帧移,以毫秒为单位 (默认值:
10.0
)high_freq (float, 可选) – Mel 频段的高截止频率 (如果 <= 0,则从奈奎斯特频率偏移) (默认值:
0.0
)htk_compat (bool, 可选) – 如果为 true,则将能量放在最后。警告:不足以获得 HTK 兼容的特征 (需要更改其他参数)。(默认值:
False
)low_freq (float, 可选) – Mel 频段的低截止频率 (默认值:
20.0
)num_ceps (int, 可选) – MFCC 计算中的倒谱系数数量 (包括 C0) (默认值:
13
)min_duration (float, 可选) – 要处理的段的最小持续时间 (以秒为单位)。(默认值:
0.0
)num_mel_bins (int, 可选) – 三角形 mel 频率箱的数量 (默认值:
23
)preemphasis_coefficient (float, 可选) – 用于信号预加重的系数 (默认值:
0.97
)raw_energy (bool, 可选) – 如果为 True,则在预加重和加窗之前计算能量 (默认值:
True
)remove_dc_offset (bool, 可选) – 从每个帧上的波形中减去均值 (默认值:
True
)round_to_power_of_two (bool, 可选) – 如果为 True,则通过将输入零填充到 FFT,将窗口大小四舍五入为 2 的幂。(默认值:
True
)sample_frequency (float, 可选) – 波形数据采样频率 (必须与波形文件匹配,如果已在其中指定) (默认值:
16000.0
)snip_edges (bool, 可选) – 如果为 True,则端部效应将通过仅输出完全适合文件的帧来处理,并且帧数取决于 frame_length。如果为 False,则帧数仅取决于 frame_shift,并且我们在末端反射数据。(默认值:
True
)subtract_mean (bool, 可选) – 减去每个特征文件的均值 [CMS];不建议以这种方式进行。(默认值:
False
)use_energy (bool, 可选) – 向 FBANK 输出添加一个包含能量的额外维度。(默认值:
False
)vtln_high (float, 可选) – 分段线性 VTLN 扭曲函数中的高拐点 (如果为负数,则从 high-mel-freq 偏移 (默认值:
-500.0
)vtln_low (float, 可选) – 分段线性 VTLN 扭曲函数中的低拐点 (默认值:
100.0
)vtln_warp (float, 可选) – Vtln 扭曲因子 (仅当未指定 vtln_map 时适用) (默认值:
1.0
)window_type (str, 可选) – 窗口类型 (‘hamming’|’hanning’|’povey’|’rectangular’|’blackman’) (默认值:
"povey"
)
- 返回:
与 Kaldi 输出相同的 mfcc。形状为 (m,
num_ceps
),其中 m 在 _get_strided 中计算- 返回类型:
Tensor