Post

Replies

Boosts

Views

Activity

iOS Speech Framework EARErrorDomain Code=0
Xcode 12.3 iOS 14.3 iPad Mini gen. 5 Context: In our app, we use voice as the main input for users to navigate the functionalities. Each time they're expected to provide input, the app calls start() to create a fresh instance of SFSpeechAudioBufferRecognitionRequest, which is used to instantiate a recognitionTask. Once voice input is recognized, stop() is called, which calls recognitionTask.cancel or recognitionTask.finish (See below). func start(resultHandler: @escaping ResultHandler) throws {     switch self.state {     case .stopping:       throw SpeechSessionError.notReadyToStart     case .started:       throw SpeechSessionError.invalidState     case .unconfigured, .stopped:       break     }     self.resultHandler = resultHandler     self.sawBestTranscription = false     self.mostRecentlyProcessedSegmentDuration = 0     let request = SFSpeechAudioBufferRecognitionRequest.init()     if recognizer.supportsOnDeviceRecognition {       print("SpeechSession: Using on-device recognition")       request.requiresOnDeviceRecognition = true     } else {       print("SpeechSession: Using remote recognition")     }     self.request = request     if self.state == .unconfigured || self.state == .stopped {       let audioSession = AVAudioSession.sharedInstance()       try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.default, options: .interruptSpokenAudioAndMixWithOthers)       try audioSession.setActive(true, options: [.notifyOthersOnDeactivation])       let node = self.audioEngine.inputNode       let recordingFormat = node.outputFormat(forBus: 0)       node.removeTap(onBus: 0)       node.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { [weak self] (audioPCMBuffer, _) in         self?.request?.append(audioPCMBuffer)       }       self.state = .stopped     }     print("SpeechSession start()")     try self.audioEngine.start()     let task = self.recognizer.recognitionTask(with: request, delegate: self.recognizerDelegate)     self.task = task     self.state = .started   }       func stop(continueDeliveringTranscriptions: Bool) throws {     guard self.state == .started else { throw SpeechSessionError.invalidState }     print("SpeechSession stop()")     self.state = .stopping(continueDeliveringTranscriptions: continueDeliveringTranscriptions)           self.audioEngine.stop()     self.request?.endAudio()     if continueDeliveringTranscriptions {       self.task?.finish()     } else {       self.task?.cancel()       self.state = .stopped     }   } Problem: The app would work normally at first. However, after 30 minutes or so, the bug would appear after start() is called and voice input is provided; instead of transcribing the voice input, it triggered the didFinish handler with the error Error Domain=EARErrorDomain Code=0 "Quasar executor C++ exception: 0x2d102dc28: Could not vm_allocate 4194304 of N5kaldi6quasar9TokenHeap11ForwardLinkE: 3 This error is not mentioned anywhere. Googling didn't return any relevant result. Does anyone know where this error is coming from and how to get around it?
0
0
914
Jan ’21
Speech recognition started and immediately failed with kAFAssistantErrorDomain error 7
Some details: iOS14.0.1 Xcode 12.0.1 iPad Mini gen 5 Our app uses voice as the main user input to navigate the functionalities. Upon app start, speech recognition works normally. The user would start saying simple English words (Yes/No), and the speech recognizer would start hypothesizing transcription. However, after a few iterations, the speech recognizer would stop working. Instead of hypothesizing transcription when user speaks, it jumps straight to the didFinish task delegate and indicates that speech transcription was unsuccessful with the following error message: The operation couldn’t be completed. (kAFAssistantErrorDomain error 7.) This bug only appeared recently in iOS14 and was not an issue in iOS13. I have googled for this error code/message but could not find much detail. Does any one know what this means/why it is failing?
5
0
1.9k
Oct ’20