简体   繁体   English

iOS AudioKit / EZAudio FFT值

[英]iOS AudioKit / EZAudio FFT values

I have a Web Audio API based signal process application and I have to port it to iOS with AudioKit(based on EZAudio) framework. 我有一个基于Web Audio API的信号处理应用程序,我必须使用AudioKit(基于EZAudio)框架将其移植到iOS。

I need only the FrequencyDomain that is contains numbers between 0-255 in Web Audio API. 我只需要在Web Audio API中包含0-255之间的数字的FrequencyDomain。

But in the AudioKit the AKFFTTap fftData gives me back floats between -6 to 6 and sometimes <1000. 但是在AudioKit中,AKFFTTap fftData给了我-6到6之间的浮动,有时<1000。

Here is what I have already tried on ios: 这是我在ios上已经尝试过的内容:

init process ... 初始化过程......

let mic = AKMicrophone()
let fftTap = AKFFTTap.init(mic)

request ... 请求......

return fftTap.fftData

on Web Audio API: init... 在Web Audio API上:init ...

var analyser = audioContext.createAnalyser();

request... 请求...

let freqDomain = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(freqDomain);
return freqDomain

How can I get back the same data? 我怎样才能找回相同的数据?

There are two things on your web's scenario that differs from AKFFTap... Firstly it returns an 256 sized array. 您的网站场景中有两件事与AKFFTap不同......首先它返回256个大小的数组。 This probably means that the bufferSize being catched is of 512 samples. 这可能意味着被捕获的bufferSize是512个样本。 You can solve this by using this custom AKFFTTap: 您可以使用此自定义AKFFTTap解决此问题:

https://gist.github.com/denisb411/3e832a592ff8b79cca2afdbed432a0d0 https://gist.github.com/denisb411/3e832a592ff8b79cca2afdbed432a0d0

Second, seems that the way that the WebAudio is reading the binary of the samples are different. 其次,似乎WebAudio正在读取样本二进制的方式是不同的。 I suggest you to use Float32 on the web as AudioKit uses this format. 我建议你在网上使用Float32,因为AudioKit使用这种格式。 Reference for this to understand more about. 参考这个了解更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM