什么时候应该使用低通滤波器?

发布于 2024-12-25 18:17:52 字数 219 浏览 1 评论 0原文

我正在尝试找到吉他弦的音高。声音以 44100 的采样率通过麦克风传入。我使用 2048 位作为缓冲区大小。考虑到奈奎斯特速率,没有必要使用更大的缓冲区大小。收到数据后,我应用汉宁窗......这就是我感到困惑的地方。我应该在时域使用低通滤波器还是先进行 FFT?如果我先进行 FFT,那么只使用样本的前半部分而忽略另一半不是更容易吗,因为我需要 50-1000 范围内的频率? FFT 后,我将使用谐波乘积频谱来查找基频。

I'm trying to find a pitch of a guitar string. Sound is coming in through mic at a sample rate of 44100. I'm using 2048 bites for a buffer size. Considering the Nyquist rate there is no point for using bigger buffer size. After recieving the data, I apply hanning window... and this is the point where I get confused. Should I use Lowpass filter in the time domain or take FFT first? If I would take FFT first, wouldn't it be easier to use just the first half of the samples, disregarding the other half, because I need frequencies in range of 50-1000? After FFT I will use Harmonic Product Spectrum to find fundamental frequency.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

暮倦 2025-01-01 18:17:52

您的建议有一定道理:如果您不需要低频,则不需要使用长样本。使用长样本,您可以获得频率分辨率,这在某些情况下可能很有用,但您会失去时间分辨率(从某种意义上说,连续样本相距较远)。

有一些没有意义的事情:

1)在 FFT 之前的计算中使用低通数字滤波器(我假设这就是你的意思)只会花费额外的计算时间并且不会真正为你带来任何好处。

2)“考虑到奈奎斯特速率,没有必要使用更大的缓冲区大小”:这些并不真正相关。奈奎斯特速率决定 FFT 的最大频率,缓冲区大小决定频率分辨率,因此也决定最低频率。

What you suggest makes some sense: if you don't need low frequencies you don't need to use long samples. With long samples you gain frequency resolution, which might be useful in some circumstances, but you lose time resolution (in the sense that successive samples are further apart).

A few things that don't make sense:

1) using a low-pass digital filter in the computation prior to the FFT (I'm assuming this is what you mean) just takes extra computation time and doesn't really gain you anything.

2) "Considering the Nyquist rate there is no point for using bigger buffer size": these aren't really related. The Nyquist rate determines the maximum frequency of the FFT, and the buffer size determines the frequency resolution, and therefore also the lowest frequency.

风铃鹿 2025-01-01 18:17:52

这实际上取决于您的音高检测算法,但为什么您首先要使用低通滤波器呢?

此外,吉他通常会产生远远超过 1000Hz 的频谱信息。高 E 弦上的音符很容易产生 4-5kHz 及以上的谐波,而这些谐波正是使您的 HPS 优美而清晰的原因。

It really depends on your pitch detection algorithm, but why would you use a low-pass filter in the first place?

In addition, a guitar usually produces spectral information way beyond 1000Hz. Notes on the high E string easily produce harmonics at 4-5kHz and beyond, and these harmonics are exactly what will make your HPS nice and clear.

风吹短裙飘 2025-01-01 18:17:52

使用的数据越少或 FFT 越短,得到的 FFT 频率分辨率就越低。

The less data used or the shorter your FFT, the lower the resulting FFT frequency resolution.

相对绾红妆 2025-01-01 18:17:52

根据我此处读到的吉他音域为 82.4 (空弦第 6 弦)到 659.2(第 1 弦第 12 品),最低 2 个音符之间的差异约为 5Hz。
如果可能的话,我会在麦克风之后、采样电路之前应用模拟滤波器。如果做不到这一点,您通常会在使用 Hanning 函数对所有内容进行整形之前应用 FIR 滤波器。您还可以使用抽取来降低采样率,或者简单地选择较低的采样率来开始。
由于无论如何您都在进行 FFT,因此只需丢弃高于 1000 Hz 的结果即可。遗憾的是,您无法减少样本数量 - 减少采样率会降低频率分辨率。

44100 Hz 下的 2048 个样本将提供与 22050 Hz 下的 1024 个样本相同的分辨率。
与 11025 Hz 下的 512 个样本相同。

From what I read here a guitar ranges from 82.4 (open 6th string) to 659.2 (12th fret on 1st string) and the difference between the lowest 2 notes is about 5Hz.
If possible, I would apply an analog filter after the mic, but before the sampling circuit. Failing that, you would normally apply an FIR filter before shaping everything with the Hanning function. You could also use Decimation to reduce the sample rate, or simply choose a lower sample rate to start with.
Since you are doing an FFT anyway, simply throw away results above 1000 Hz. Sadly, you can't cut back on the number of samples - cutting the sample rate reduces frequency resolution.

2048 samples at 44100 Hz will give the same resolution as 1024 samples at 22050 Hz.
Which the same as 512 samples at 11025 Hz.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文