简体   繁体   English

iOS Audiokit FFTTap BufferSize 异常错误

[英]iOS Audiokit FFTTap BufferSize Exception Error

I am trying to use fftTap from iOS microphone with AudioKit, and here is the code我正在尝试使用带有 AudioKit 的 iOS 麦克风的 fftTap,这是代码

fft = FFTTap(highPassFilter2!, bufferSize: 8192 * 4, fftValidBinCount: nil, handler: {data in})

I tried using a bufferSize of 8192 * 4, which has allowed me to detect HZ at intervals of about 1.3 (Sample Rate is 44100, 44100 / (8192 * 4) = 1.34582519531, am I correct?) but I always get the exception error in File BaseTap around line 90.我尝试使用 8192 * 4 的缓冲区大小,这使我能够以大约 1.3 的间隔检测 HZ(采样率为 44100、44100 / (8192 * 4) = 1.34582519531,对吗?)但我总是得到异常错误在第 90 行附近的 File BaseTap 中。

private func handleTapBlock(buffer: AVAudioPCMBuffer, at time: AVAudioTime) {
        // Call on the main thread so the client doesn't have to worry
        // about thread safety.
        buffer.frameLength = bufferSize <<<<< here

The log shows日志显示

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: length <= _imp->_frameCapacity'
terminating with uncaught exception of type NSException

It seems not work, but I want to be able to capture the accuracy less than 2 Hz, is there any way to try?好像不行,但是我希望能够捕捉到2Hz以下的精度,有什么办法可以试试吗?

Really Thanks.真的谢谢。

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

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