gpt4 book ai didi

python - 警告 'Empty filters detected in mel frequency basis. ' 是关于什么的?

转载 作者:行者123 更新时间:2023-12-05 01:15:05 25 4
gpt4 key购买 nike

我正在尝试使用以下代码从具有 13 个 MFCC 的音频文件中提取 MFCC 特征:

import librosa as l

x, sr = l.load('/home/user/Data/Audio/Tracks/Dev/FS_P01_dev_001.wav', sr = 8000)
n_fft = int(sr * 0.02)
hop_length = n_fft // 2
mfccs = l.feature.mfcc(x, sr=sr, n_mfcc=13, hop_length=hop_length, n_fft=n_fft)

但是它显示了这个警告。这是什么意思,我该如何摆脱它?

UserWarning: Empty filters detected in mel frequency basis. Some channels will produce empty responses. Try increasing your sampling rate (and fmax) or reducing n_mels.
warnings.warn('Empty filters detected in mel frequency basis. '

最佳答案

MFCC 基于梅尔频谱图,而梅尔频谱图又通常基于 discrete Fourier transform (DFT) .傅立叶变换从时域获取信号并将其转换为频域。这意味着 N 个时域样本被转换为 N 个频域值(注意对称性——您实际上只有 N/2 个频率值)。就像时域样本在线性时间尺度上一样,频域样本在线性频率尺度上。相比之下,mel-scale不是线性的,而是(近似)对数的。

您需要了解以下有关傅里叶变换的知识。当您有 F_s = 8000Hz 且窗口长度为 N 的信号时:

  • 不同频点的个数为:SL = N/2
  • 您可以编码的最高频率是:F_max = F_s/2 ( Nyquist-Shannon )
  • 频率分辨率为:Δf = F_max/SL

现在考虑如何 MFCCs计算(另见 here ):

  1. Take the Fourier transform of (a windowed excerpt of) a signal.
  2. Map the powers of the spectrum obtained above onto the mel scale, using triangular overlapping windows.
  3. Take the logs of the powers at each of the mel frequencies.
  4. Take the discrete cosine transform of the list of mel log powers, as if it were a signal.
  5. The MFCCs are the amplitudes of the resulting spectrum.

在第 2 步中,您必须将 DFT 生成的任何内容映射到不同的尺度,即梅尔尺度。如果 DFT 分辨率 Δf 太低而无法将功率值映射到(可能)更精细的梅尔尺度,则这不起作用。把它想象成一幅图像:当你有一个粗糙的图像时,你不能通过将它映射到更高分辨率来提高质量。这意味着,您必须确保您的 DFT 分辨率 Δf 对于您要使用的梅尔波段来说足够好。

为确保这一点,您必须使用更长的窗口 N 或更少的梅尔波段 n_mfcc。其核心问题是,您不能同时拥有高频分辨率高时间分辨率。

另见 IRCAM Intro on FFT parameters .

关于python - 警告 'Empty filters detected in mel frequency basis. ' 是关于什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56929874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com