问题描述
我正在研究html5音频API。
我注意到分析模块在处理高频时遇到问题。
就好像它里面有一个构建过滤器。
例如,如果我发出20Khz音并绘制 getFloatFrequencyData
的结果,我会看到以下频谱:
但是,如果我使用Audacity,相同的信号如下所示:(注意峰值@ 20khz)
I am studying the html5 audio API.I have noticed the analysis module has problems processing high frequencies.It is as if there is a build in filter in it.For example, if I emitting a 20Khz tone and plot the outcome of getFloatFrequencyData
I see the following spectrum:However, if I use Audacity, the same signal looks like this: (notice the peak @ 20khz)
我可以禁用内置过滤分析模型?
p.s.根据上下文画布,采样率足够高,所以我不会怀疑别名问题。
Can I disable the built in filter of the analysis model?p.s. the sampling rate is high enough according to the context canvas so I would not suspect aliasing problems.
推荐答案
@cwilso有它,默认情况下,输入被过滤,您需要将正确形成的约束对象传递给getUserMedia。格式有点繁琐,但考虑到它的豁免,这是不可避免的。规范还没有完全由每个人实现,每个浏览器都有自己的一组前缀未记录的预处理器。这就是我用来获得最新音频的消息(2016年10月中旬)。这个列表可能也不完整 - 到目前为止我只看过FF和Ch。有没有其他人?
@cwilso has it, the input is filtered by default, you need to pass a properly formed constraints object to getUserMedia. The format is a little fiddly but that's kind of unavoidable considering it's remit. The spec is not fully implemented by everyone yet either and each browser has it's own set of prefixed undocumented pre-processors. This is what I've been using to get the rawest audio available (Mid October 2016). This list is probably not complete either - I have only looked at FF and Ch so far. Anyone got any others?
let constraints = {
audio: {
optional: [
{echoCancellation: false},
{mozAutoGainControl: false},
{mozNoiseSuppression: false},
{googEchoCancellation: false},
{googAutoGainControl: false},
{googNoiseSuppression: false},
{googHighpassFilter: false}
]
}
};
let mediaInput = navigator.mediaDevices.getUserMedia( constraints );
这篇关于如何禁用Web-Audio分析器过滤高频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!