AnalyserNode 在什么时候执行它的 FFT?

At what point does AnalyserNode execute its FFT?

我正在尝试使用网络音频编写自相关算法 API。自相关仅依赖于时域中的数据,而不依赖于频域中的数据,因此我只使用 getByteTimeDomainData()。我很难找到有关如何实施 AnalyserNode 的信息。根据我在 MDN Docs 中阅读的内容,我不清楚 FFT 是否仅在调用 getByteFrequencyData() 时才为 运行,或者无论如何都会得到 运行。大的 FFT 非常昂贵,所以我不想要它们 运行不管怎样都行。

根据规范,我会说期望是在您要求时计算 FFT。
getByteFrequencyData():

The most recent fftSize frames are used in computing the frequency data.

如果你经常请求它,它甚至会返回一个缓存的结果:

If another call to getByteFrequencyData() or getFloatFrequencyData() occurs within the same render quantum as a previous call, the current frequency data is not updated with the same data. Instead, the previously computed data is returned.

这个措辞还表明计算应该根据要求进行。