索引不在允许范围内 [英] The index is not in the allowed range

查看:70
本文介绍了索引不在允许范围内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在使用 Safari 10.1 中的 Tone.Analyzer 时遇到问题.使用 size > 初始化 Tone.Analyzer 时Math.pow(2, 10) (1024) 我收到以下错误:IndexSizeError (DOM Exception 1): 索引不在允许范围内.

I'm currently having an issue with the Tone.Analyzer in Safari 10.1. When initializing the Tone.Analyzer with a size > Math.pow(2, 10) (1024) I get the following error: IndexSizeError (DOM Exception 1): The index is not in the allowed range.

我也将此提交到 ToneJS 存储库,但我感觉这更像是 Safari 中的一个错误,对吧?

I've also submitted this to the ToneJS repository, but I feel like this is more like an bug in Safari, right?

import Tone from 'tone';

const sampleSize = Math.pow(2, 13); // Math.pow(2, 10); works...

this.fft = new Tone.Analyser('fft', sampleSize);
this.panVol = new Tone.PanVol().fan(this.fft).toMaster();

链接到 WebpackBin 示例

然而,我在interwebz上找不到任何信息,哪个浏览器接受哪个尺寸,而Tone.js 文档 提到,值必须是 32 到 32768 范围内的 2 的幂. (与 Web Audio API 文档中的相同)

However, I can't find any information on the interwebz, which browser accepts which size, while the Tone.js documentation mentions, that the Value must be a power of two in the range 32 to 32768. (Same as in the Web Audio API documentation)

Safaris 音频 API 的 getByteFrequencyData 是否没有实现更大的尺寸?很想实现一个高精度均衡器,但对于较低的频率,样本大小需要 > 4000.

Does Safaris Audio APIs getByteFrequencyData haven't implemented higher sizes? Would love to implement a highly accurate equalizer, but the sample size needs to be > 4000 for the lower frequencies.

推荐答案

WebAudio 规范的早期版本表示,2048 是 AnalyserNode 的最大 FFT 大小.后来的版本把限制设置为至少 32k,Safari 仍然执行旧的限制.

An early version of the WebAudio spec said that 2048 was the largest FFT size for the AnalyserNode. Later versions made the limit at least 32k, Safari still implements the old limit.

这篇关于索引不在允许范围内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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