I am using AudioKit to monitor frequency for a simple guitar tuner application and am experiencing discrepancies in frequency after updating from AudioKit ~4.2 to 4.4, Xcode 9.x to 10, and iOS 11 to 12. Before the updates, I was achieving correct frequency readings on my device. After updating, I am getting accurate results for a low E1 (82.4 Hz) on the simulator, but false readings on the device (alternates from ~23 to ~47 kHz).
I have tried using another device, but achieve the same results.
My viewDidLoad() setting up AudioKit is relatively simple, and I used the AudioKit playgrounds as a guideline:
override func viewDidLoad() {
super.viewDidLoad()
// Enable microphone tracking.
AKSettings.audioInputEnabled = true
let mic = AKMicrophone()
let tracker = AKFrequencyTracker(mic)
let silence = AKBooster(tracker, gain: 0)
AudioKit.output = silence
do {
try AudioKit.start()
}
catch {
print("AudioKit did not start!")
}
mic.start()
tracker.start()
// Track input frequency, 100ms intervals
timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) {
[weak self] (timer) in
guard let this = self else { return }
this.frequencyLabel.text = String(format: "Frequency: %.3f Hz", tracker.frequency)
this.frequencyLabel.sizeToFit()
}
}
As a sidenote, I am getting Objective-C console output regarding AudioKit classes being implemented in two places. Would this contribute to the issue?
objc[517]: Class AKRhodesPianoAudioUnit is implemented in both /private/var/containers/Bundle/Application/5A294050-2DB2-45C9-BB0A-3A0DE25E87C6/Tuner.app/Frameworks/AudioKitUI.framework/AudioKitUI (0x1058413f0) and /var/containers/Bundle/Application/5A294050-2DB2-45C9-BB0A-3A0DE25E87C6/Tuner.app/Tuner (0x104e177e8). One of the two will be used. Which one is undefined.
Any ideas? Thanks in advance!