Why doesn't AudioKit's AKMicrophoneTracker work on a physical iOS device?

Viewed 615

When I use AudioKit's AKMicrophoneTracker on a physical device, the the frequency and amplitude are always both 0. But in the playground and in the iOS simulator, it works perfectly.

Here's a rough example:

class AppDelegate: UIResponder, UIApplicationDelegate {

    let tracker = AKMicrophoneTracker()

    func application(_ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // start the tracker and show frequency information
        tracker.start()
        Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: { _ in
            print(tracker.frequency)
            print(tracker.amplitude)
        })
    }

}

I've reset my physical device's privacy permissions, and iOS is correctly prompting me to allow microphone access. It still doesn't work even though I'm allowing microphone access.

How can I get AKMicrophoneTracker to actually read these values?

I'm using AudioKit 4.0.3. It works as expected when using:

  • the AudioKit playground on my Mac
  • a simulator iPhone 7 Plus running iOS 11.1

It does not work when using:

  • A physical iPhone 7 Plus running iOS 11.1.1 (and also occurs on iOS 11.1)

I originally posted this as a bug on AudioKit's GitHub issue tracker. However, Aure (the project maintainer) encouraged me to post here instead.

2 Answers
Related