如何配置一个带通滤波器? [英] How do I configure a bandpass filter?

查看:196
本文介绍了如何配置一个带通滤波器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用网络音频API的带通滤波器的功能,但我相信我的问题是更普遍。我不明白的带通滤波器的Q值。我希望能够配置过滤器来传递是一个中频X赫兹。ÿ赫兹范围内的频率。

I'm trying to use the Web Audio API's bandpass filter functionality, but I believe my question is more general. I don't understand the "Q" value of the bandpass filter. I would like to be able to configure the filter to pass frequencies that are within Y hertz of a middle frequency X hertz.

我是很新的音频节目,所以有​​其他变数,我需要考虑计算?问

I'm very new to audio programming, so are there other variables I need to consider to compute Q?

推荐答案

让我们假设你在1000Hz的有一个过滤器,你希望它在500Hz的结束于2000Hz时开始。

Let's say you have a filter at 1000Hz, and you want it to start at 500Hz and end at 2000Hz.

首先,你会发现它并不适用于每个方向的相同数量的赫兹。这是因为滤波器的带宽是根据八度,而不是频率。所以在这种情况下,延伸一个八度向下和一个八度的。换句话说,在频率上的低端上的高端除以2和乘以2。 - 这使得它的2个八度带宽

First off, you'll notice it doesn't extend the same number of hertz in each direction. That's because filter bandwidth is based on octaves, not frequencies. So in this case, it extends one octave down and one octave up. Put another way, the frequency was divided by 2 on the low end and multiplied by 2 on the high end - which gives it a bandwidth of 2 octaves.

总之,这里是你如何计算,假设你知道频率:

Anyway, here's how you can calculate it, assuming you know the frequencies:

Q = center_frequency /(top_frequency - bottom_frequency)

在这种情况下将 1000 /(2000 - 500)。,或0.667

Which in this case would be 1000 / ( 2000 - 500 ), or 0.667.

您还可以计算它不只要你有一个目标带宽(八度)知道心目中的顶部和底部频率:

You can also calculate it without knowing the top and bottom frequencies as long as you have a target bandwidth (in octaves) in mind:

function getQ( bandwidth ){
  return Math.sqrt( Math.pow(2, bandwidth) ) / ( Math.pow(2, bandwidth) - 1 )
}

另外,如果通过 2 作为带宽参数,你会得到相同的结果:Q = 0.667

Again, if you pass 2 as the bandwidth argument, you'll get the same result: Q = 0.667.

希望有所帮助。

这篇关于如何配置一个带通滤波器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆