AudioKit error message: Too Many Frames to Process

Viewed 229

I'm using the (very cool) AudioKit framework to process audio for a macOS music visualizer app. My audio source ("mic") is iTunes 12 via Rogue Amoeba Loopback.

In the Xcode debug window, I'm seeing the following error message each time I launch my app:

kAudioUnitErr_TooManyFramesToProcess : inFramesToProcess=513, mMaxFramesPerSlice=512

I've gathered from searches that this is probably related to sample rate, but I haven't found a clear description of what this error indicates (or if it even matters). My app is functioning normally, but I'm wondering if this could be affecting efficiency.

EDIT: The error message does not appear if I use Audio MIDI Setup to set the Loopback device output to 44.1kHz. (I set it initially to 48.0kHz to match my other audio devices, which I keep configured to the video standard.)

Keeping Loopback at 44.1kHz is an acceptable solution, but now my question would be: Is it possible to avoid this error even with a 48.0kHz input? (I tried AKSettings.sampleRate = 48000 but that made no difference.) Or can I just safely ignore the error in any case?

AudioKit is initialized thusly:

    AKSettings.audioInputEnabled = true
    mic = AKMicrophone()
    do {
        try mic.setDevice(AudioKit.inputDevices![inputDeviceNumber])
    }
    catch  {
        AKLog("Device not set")
    }
    amplitudeTracker = AKAmplitudeTracker(mic)
    AudioKit.output = AKBooster(amplitudeTracker, gain: 0)
    do {
        try AudioKit.start()
    } catch {
        AKLog("AudioKit did not start")
    }
    mic.start()
    amplitudeTracker?.start()
1 Answers

This string saved my app

try? AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.02)
Related