I am implementing Speech Recognition in my app. When I first present the view controller with the speech recognition logic, everything works fine. However, when I try presen
First, a small issue. When tapping the device's microphone, you'll want to use the format of the input bus:
let recordingFormat = node.inputFormat(forBus: 0)
Second, after some digging it seems like this crash most commonly stems from your application's shared AVAudioSession category settings. Make sure you have your audio session configured like so if you're going to be performing live microphone audio processing:
private func configureAudioSession() {
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with: .mixWithOthers)
try AVAudioSession.sharedInstance().setActive(true)
} catch { }
}