Recognize spoken words in recorded or live audio using Speech.

Posts under Speech tag

200 Posts

Post

Replies

Boosts

Views

Activity

AVSpeechSynthesisVoice.speechVoices() Includes Voices That Aren't Available after Upgrading iOS
AVSpeechSynthesisVoice.speechVoices() returns voices that are no longer available after upgrading from iOS 16 to iOS 17 (although this has been an issue for a long time, I think). To reproduce: On iOS 16 download 1 or more enhanced voices under “Accessibility > Spoken Content > Voices”. Upgrade to iOS 17 Call AVSpeechSynthesisVoice.speechVoices() and note that the voices installed in step (1) are still present, yet they are no longer downloaded, therefore they don’t work. And there is no property on AVSpeechSynthesisVoice to indicate if the voice is still available or not. This is a problem for apps that allow users to choose among the available system voices. I receive many support emails surrounding iOS upgrades about this issue. I have to tell them to re-download the voices which is not obvious to them. I've created a feedback item for this as well (FB12994908).
1
1
1.1k
Aug ’23
Complete process of how to add my voice as speech synthesis
Hello, I am deaf and blind. So my Apple studies are in text vi aBraille. One question: how do I add my voice as voice synthesis? Do I have to record it somewhere first? What is the complete process, starting with recording my voice? Do I have to record my voice reading something and then add it as voice synthesis? What's the whole process of that? There is no text explaining this' I found one about authorizing personal voice, but not the whole process starting the recording and such' Thanks!
3
0
2.2k
Aug ’23
SFSpeechRecognizer kLSRErrorDomain 102
I have updated to macOS Monterrey and my code for SFSPeechRecognizer just broke. I get this error if I try to configure an offline speech recognizer for macOS Error Domain=kLSRErrorDomain Code=102 "Failed to access assets" UserInfo={NSLocalizedDescription=Failed to access assets, NSUnderlyingError=0x6000003c5710 {Error Domain=kLSRErrorDomain Code=102 "No asset installed for language=es-ES" UserInfo={NSLocalizedDescription=No asset installed for language=es-ES}}} Here is a code snippet from a demo project: private func process(url: URL) throws {     speech = SFSpeechRecognizer.init(locale: Locale(identifier: "es-ES"))     speech.supportsOnDeviceRecognition = true     let request = SFSpeechURLRecognitionRequest(url: url)     request.requiresOnDeviceRecognition = true     request.shouldReportPartialResults = false     speech.recognitionTask(with: request) { result, error in       guard let result = result else {         if let error = error {           print(error)           return         }         return       }       if let error = error {         print(error)         return       }       if result.isFinal {         print(result.bestTranscription.formattedString)       }     }   } I have tried with different languages (es-ES, en-US) and it says the same error each time. Any idea on how to install these assets or how to fix this?
3
2
3.1k
Aug ’23
Creating a list of voices available by locale
I'm trying to create a list that users can pick for the voice they want to use in my app. The code below works for US but if I change my locale settings to any other country, it fails to load any available voices even though I have downloaded other for other countries.. func voices() -> [String] {          AVSpeechSynthesisVoice.speechVoices().filter { $0.language == NSLocale.current.voiceLanguage }.map { $0.name }                    // AVSpeechSynthesisVoice.speechVoices().map { $0.name }     } If I list all voices available, I can select the voices for other countries that are loaded.
3
0
1.6k
Jul ’23
TTSPlugins doesn't exist in Xcode Version 15.0 beta 4 (15A5195m)
Download this Apple Speech Project https://developer.apple.com/documentation/accessibility/wwdc21_challenge_speech_synthesizer_simulator The project uses IOS15 deployment, when building and running I receive below errors. Setting deployment to IOS17 results in same errors. Appreciate if anyone else has determined how to re-engage this basic functionality. TTS appears to no longer to work. __ Folder ), NSFilePath=/Library/Developer/CoreSimulator/Volumes/iOS_21A5277g/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/TTSPlugins, NSUnderlyingError=0x600000c75d40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} Failed to get sandbox extensions Query for com.apple.MobileAsset.VoiceServicesVocalizerVoice failed: 2 #FactoryInstall Unable to query results, error: 5 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.CustomVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder
3
1
2.0k
Jul ’23
Issue with recognitionTask(with:resultHandler:) and SFSpeechURLRecognitionRequest
Xcode Version 15.0 beta 4 (15A5195m) or Version 14.3.1 (14E300c) same issue when running iOS Simulator iPhone 14 Pro (iOS 17 or iOS 16.4) or iPhone 12 (iOS 17.0 build 21A5277j) just started to play around with SFSpeechRecognition. Ran into the issue with SFSpeechURLRecognitionRequest. the simple project is just a ContentView with 2 buttons ( one for selecting audio file, one for starting transcribing ), a SpeechRecognizer ( from Apple sample code "Transcribing speech to text" with minor additions ) After selecting an audio file, tap the transcribe button, the following error logs appear in the debugger console after the execution of recognitionTask(with:resultHandler:). 2023-07-18 13:58:16.562706-0400 TranscriberMobile[6818:475161] [] <<<< AVAsset >>>> +[AVURLAsset _getFigAssetCreationOptionsFromURLAssetInitializationOptions:assetLoggingIdentifier:figAssetCreationFlags:error:]: AVURLAssetHTTPHeaderFieldsKey must be a dictionary 2023-07-18 13:58:16.792219-0400 TranscriberMobile[6818:475166] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000023dd00> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2023-07-18 13:58:16.824333-0400 TranscriberMobile[6818:475166] HALC_ProxyObjectMap.cpp:153 HALC_ProxyObjectMap::_CopyObjectByObjectID: failed to create the local object 2023-07-18 13:58:16.824524-0400 TranscriberMobile[6818:475166] HALC_ShellDevice.cpp:2609 HALC_ShellDevice::RebuildControlList: couldn't find the control object 2023-07-18 13:58:16.872935-0400 TranscriberMobile[6818:475165] [] <<<< FAQ Offline Mixer >>>> FigAudioQueueOfflineMixerCreate: [0x10744b8d0] failed to query kAudioConverterPrimeInfo err=561211770, assuming zero priming 2023-07-18 13:58:16.890002-0400 TranscriberMobile[6818:474951] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.mediaexperience" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.mediaexperience}> 2023-07-18 13:58:16.890319-0400 TranscriberMobile[6818:474951] [AMCP] 259 HALRBSAssertionGlue.mm:98 Failed to acquire the AudioRecording RBSAssertion for pid: 6818 with code: 1 - RBSServiceErrorDomain 2023-07-18 13:58:16.893137-0400 TranscriberMobile[6818:474951] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.mediaexperience" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.mediaexperience}> 2023-07-18 13:58:16.893652-0400 TranscriberMobile[6818:474951] [AMCP] 259 HALRBSAssertionGlue.mm:98 Failed to acquire the MediaPlayback RBSAssertion for pid: 6818 with code: 1 - RBSServiceErrorDomain Since the AVURLAsset is not created manually, how to get around the initial error "AVURLAssetHTTPHeaderFieldsKey must be a dictionary"? SpeechRecognizer.swift import Foundation import AVFoundation import Speech import SwiftUI /// A helper for transcribing speech to text using SFSpeechRecognizer and AVAudioEngine. actor SpeechRecognizer: ObservableObject { // ... @MainActor func startTranscribingAudioFile(_ audioURL: URL?) { Task { await transcribeAudioFile(audioURL) } } // ... private func transcribeAudioFile(_ audioURL: URL?) { guard let recognizer, recognizer.isAvailable else { self.transcribe(RecognizerError.recognizerIsUnavailable) return } guard let audioURL else { self.transcribe(RecognizerError.nilAudioFileURL) return } let request = SFSpeechURLRecognitionRequest(url: audioURL) request.shouldReportPartialResults = true self.audioURLRequest = request self.task = recognizer.recognitionTask(with: request, resultHandler: { [weak self] result, error in self?.audioFileRecognitionHandler(result: result, error: error) }) } // ... nonisolated private func audioFileRecognitionHandler(result: SFSpeechRecognitionResult?, error: Error?) { if let result { transcribe(result.bestTranscription.formattedString) } if let error { Task { @MainActor in await reset() transcribe(error) } } } } ContentView.swift import SwiftUI struct ContentView: View { @State var showFileBrowser = false @State var audioFileURL: URL? = nil @StateObject var speechRecognizer = SpeechRecognizer() var body: some View { VStack(spacing: 24) { Button { self.showFileBrowser.toggle() } label: { Text("Select an audio file to transcribe") } Text(audioFileURL != nil ? audioFileURL!.absoluteString : "No audio file selected") .multilineTextAlignment(.center) Button { speechRecognizer.startTranscribingAudioFile(audioFileURL) } label: { Text("Transcribe") } Text(speechRecognizer.transcript == "" ? "No transcript yet" : speechRecognizer.transcript) .multilineTextAlignment(.leading) } .padding() .fileImporter(isPresented: $showFileBrowser, allowedContentTypes: [.audio]) { result in switch result { case .success(let fileURL): fileURL.startAccessingSecurityScopedResource() audioFileURL = fileURL print(fileURL) case .failure(let error): NSLog("%s", error.localizedDescription) } } } }
2
1
1.5k
Jul ’23
Send touch events programmatically
We are using the Speech framework to enable users to interact with our app via voice commands. When a user says "start test" we send DispatchQueue.main.async { self.startButton.sendActions(for: .touchUpInside) } This works beautifully, except that the screen goes into auto lockout in the middle of a test. Apparently, using sendActions does not actually send a touch event to the OS. My question is how can I tell the OS that a touch event happened programmatically? Thank you
2
0
1.6k
Jul ’23
SFSpeechRecognizer specify timeout duration?
For my project, I would really benefit from continuous on-device speech recognition without the automatic timeout, or at least with a much longer one. In the WebKit web speech implementation, it looks like there are some extra setters for SFSpeechRecognizer exposing exactly this functionality: https://github.com/WebKit/WebKit/blob/8b1a13b39bbaaf306c9d819c13b0811011be55f2/Source/WebCore/Modules/speech/cocoa/WebSpeechRecognizerTask.mm#L105 Is there a chance Apple could enable programmable duration/time-out? If it’s available in WebSpeech, then why not in native applications?
0
0
987
Jul ’23
What is this error???
[catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 [AXTTSCommon] Invalid rule: [AXTTSCommon] Invalid rule: [AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/20700159d3b64fc92fc033a3e3946535bd231e4b.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated
1
0
1.3k
Jul ’23
kAFAssistantErrorDomain error codes
Are these error codes documented anywhere? Error codes 203 and 1110 seems to happen regularly. I think they mean the following: 203: some limit reached (happens very regularly when using server-side speech recognition, less often when using on-device recognition) 1110: no speech detected I have gotten a new one now: 1107 No idea what that means.
1
1
3.6k
Jun ’23
Can we use SFSpeechRecognizer with call Kit
We are creating an online book reading app in which we are initiating video call (group call:- for video call. we are using agora SDK) and at the join of call we start book reading and highlight words at other members' end also and recording/recognition text we are using SFSpeechRecognizer but whenever call kit start and video call start SFSpeechRecognizer start to record audio at others end it's getting failed always, can you please provide any solution to record audio during the video call. // // Speech.swift // Edsoma // // Created by Kapil on 16/02/22. // import Foundation import AVFoundation import Speech protocol SpeechRecognizerDelegate {   func didSpoke(speechRecognizer : SpeechRecognizer , word : String?) } class SpeechRecognizer: NSObject {       private let speechRecognizer = SFSpeechRecognizer(locale: Locale.init(identifier: "en-US")) //1   private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest?   private var recognitionTask: SFSpeechRecognitionTask?   private let audioEngine = AVAudioEngine()   var delegate : SpeechRecognizerDelegate?   static let shared = SpeechRecognizer()   var isOn = false       func setup(){     speechRecognizer?.delegate = self //3           SFSpeechRecognizer.requestAuthorization { (authStatus) in //4               var isButtonEnabled = false               switch authStatus { //5       case .authorized:         isButtonEnabled = true                 case .denied:         isButtonEnabled = false         print("User denied access to speech recognition")                 case .restricted:         isButtonEnabled = false         print("Speech recognition restricted on this device" )                 case .notDetermined:         isButtonEnabled = false         print("Speech recognition not yet authorized")       @unknown default:         break;       }               OperationQueue.main.addOperation() {         // self.microphoneButton.isEnabled = isButtonEnabled       }     }   }   func transcribeAudio(url: URL) {     // create a new recognizer and point it at our audio     let recognizer = SFSpeechRecognizer()     let request = SFSpeechURLRecognitionRequest(url: url)     // start recognition!     recognizer?.recognitionTask(with: request) { [unowned self] (result, error) in       // abort if we didn't get any transcription back       guard let result = result else {         print("There was an error: \(error!)")         return       }       // if we got the final transcription back, print it       if result.isFinal {         // pull out the best transcription...         print(result.bestTranscription.formattedString)       }     }   }       func startRecording() {     isOn = true     let inputNode = audioEngine.inputNode     if recognitionTask != nil {       inputNode.removeTap(onBus: 0)       self.audioEngine.stop()       self.recognitionRequest = nil       self.recognitionTask = nil       DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {         self.startRecording()       }       return       debugPrint("****** recognitionTask != nil *************")     }           let audioSession = AVAudioSession.sharedInstance()     do {               try audioSession.setCategory(AVAudioSession.Category.multiRoute)       try audioSession.setMode(AVAudioSession.Mode.measurement)       try audioSession.setActive(true, options: .notifyOthersOnDeactivation)     } catch {       print("audioSession properties weren't set because of an error.")     }           recognitionRequest = SFSpeechAudioBufferRecognitionRequest()                 guard let recognitionRequest = recognitionRequest else {       fatalError("Unable to create an SFSpeechAudioBufferRecognitionRequest object")     }           recognitionRequest.shouldReportPartialResults = true           recognitionRequest.taskHint = .search           recognitionTask = speechRecognizer?.recognitionTask(with: recognitionRequest, resultHandler: { (result, error) in               var isFinal = false               if result != nil {         self.delegate?.didSpoke(speechRecognizer: self, word: result?.bestTranscription.formattedString)          debugPrint(result?.bestTranscription.formattedString)         isFinal = (result?.isFinal)!                 }               if error != nil {         debugPrint("Speech Error ====>",error)         inputNode.removeTap(onBus: 0)         self.audioEngine.stop()         self.recognitionRequest = nil         self.recognitionTask = nil         if BookReadingSettings.isSTTEnable{           DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {             self.startRecording()           }         }         // self.microphoneButton.isEnabled = true       }     })          // let recordingFormat = AVAudioFormat.init(commonFormat: .pcmFormatFloat32, sampleRate: <#T##Double#>, interleaved: <#T##Bool#>, channelLayout: <#T##AVAudioChannelLayout#>)//inputNode.outputFormat(forBus: 0)     inputNode.removeTap(onBus: 0)     let sampleRate = AVAudioSession.sharedInstance().sampleRate     let recordingFormat = AVAudioFormat(standardFormatWithSampleRate: sampleRate, channels: 1)     inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer, when) in       self.recognitionRequest?.append(buffer)     }           audioEngine.prepare()           do {       try audioEngine.start()     } catch {       print("audioEngine couldn't start because of an error.")     }     debugPrint("Say something, I'm listening!")     //textView.text = "Say something, I'm listening!"         }       /* func stopRecording(){     isOn = false     debugPrint("Recording stoped")     self.audioEngine.stop()     recognitionTask?.cancel()     let inputNode = audioEngine.inputNode     inputNode.removeTap(onBus: 0)     self.recognitionRequest = nil     self.recognitionTask = nil         }*/       func stopRecording(){     isOn = false     debugPrint("Recording stoped")     let inputNode = audioEngine.inputNode     inputNode.removeTap(onBus: 0)     self.audioEngine.stop()     recognitionTask?.cancel()     self.recognitionRequest = nil     self.recognitionTask = nil    }     } extension SpeechRecognizer : SFSpeechRecognizerDelegate {     }
1
0
1.3k
Jun ’23
[AXTTSCommon] Failure starting audio queue
When the screen is unlocked the AVSpeechSynthesizer.speak is working fine and in locked not working do { try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, mode: .default, options: .defaultToSpeaker) try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation) } catch { print("audioSession properties weren't set because of an error.") } let utterance = AVSpeechUtterance(string: voiceOutdata) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") let synth = AVSpeechSynthesizer() synth.speak(utterance) defer { disableAVSession() } Error Log in the locked state [AXTTSCommon] Failure starting audio queue alp![AXTTSCommon] _BeginSpeaking: couldn't begin playback
1
0
2.9k
Jun ’23
AVSpeechSynthesizer delay issue, [AXTTSCommon] Invalid rule:
AVSpeechSynthesizer delay issue, [AXTTSCommon] Invalid rule: Play text using AVSpeechSynthesizer. Sound comes out normally. If you call speak(_ utterance: AVSpeechUtterance) to play text as speech [AXTTSCommon] Invalid rule: The log is displayed and it is called two or three times and the sound comes out late. It is judged that there are cases where delays of more than 1 second occur depending on the user, device, or situation, usually ranging from 0.6 seconds. [AXTTSCommon] Invalid rule: There is no additional reasoning behind the log. [AXTTSCommon] Invalid rule: [AXTTSCommon] Invalid rule: In this way, it is called a second time. This issue occurs after iOS 16.0. Is there any way to fix that issue? or not I would like to know if there is a way to reduce the delay at startup even if that log is displayed after the speak(_ utterance: AVSpeechUtterance) call.
1
0
1.4k
Jun ’23
SFSpeechRecognitionRequest
I'm looking at the SFSpeechRecognitionRequest object but it's saying not to use it, and instead use SFSpeechAudioBufferRecognitionRequest: https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest I want to work with the contextualStrings but I'm not seeing that as an option in the other objects. Do I ignore this warning and use it anyway?
0
0
677
May ’23
Are there any background processing restrictions for Audio background mode?
Hi, I'd like to develop an iOS application that keeps the mic open for voice recording and processing even when the screen is off. I want to perform speech-to-text requests whenever samples of voice are detected (using a voice activity detection library) and also send requests to the cloud based on what is spoken. I've enabled the Audio background mode and preliminary testing seems to indicate that this is working. That is, I can press "record" in my app, switch to another app then shut the screen off, and speak for several seconds before auto-stopping the recording and sending it to a SFSpeechRecognizer task, which appears to succeed. However, I have read that this should not be supported so before going further down this path, I wanted to understand what exactly are the processing limitations in this mode? The documentation doesn't seem very clear to me. Thanks, -- B.
5
0
2.1k
May ’23
AVSpeechSynthesizer & iOS 17 - Some voices are just not working
Hello, Using iOS 17.0, I can see a list of available voices. However, some will just not work, meaning that when selected there will be no sound produced and no errors. This is true when using my app and AVSpeechUtterance, but it is also true in the settings where the preview button does nothing.
Replies
1
Boosts
3
Views
2.2k
Activity
Aug ’23
AVSpeechSynthesisVoice.speechVoices() Includes Voices That Aren't Available after Upgrading iOS
AVSpeechSynthesisVoice.speechVoices() returns voices that are no longer available after upgrading from iOS 16 to iOS 17 (although this has been an issue for a long time, I think). To reproduce: On iOS 16 download 1 or more enhanced voices under “Accessibility > Spoken Content > Voices”. Upgrade to iOS 17 Call AVSpeechSynthesisVoice.speechVoices() and note that the voices installed in step (1) are still present, yet they are no longer downloaded, therefore they don’t work. And there is no property on AVSpeechSynthesisVoice to indicate if the voice is still available or not. This is a problem for apps that allow users to choose among the available system voices. I receive many support emails surrounding iOS upgrades about this issue. I have to tell them to re-download the voices which is not obvious to them. I've created a feedback item for this as well (FB12994908).
Replies
1
Boosts
1
Views
1.1k
Activity
Aug ’23
Complete process of how to add my voice as speech synthesis
Hello, I am deaf and blind. So my Apple studies are in text vi aBraille. One question: how do I add my voice as voice synthesis? Do I have to record it somewhere first? What is the complete process, starting with recording my voice? Do I have to record my voice reading something and then add it as voice synthesis? What's the whole process of that? There is no text explaining this' I found one about authorizing personal voice, but not the whole process starting the recording and such' Thanks!
Replies
3
Boosts
0
Views
2.2k
Activity
Aug ’23
SFSpeechRecognizer kLSRErrorDomain 102
I have updated to macOS Monterrey and my code for SFSPeechRecognizer just broke. I get this error if I try to configure an offline speech recognizer for macOS Error Domain=kLSRErrorDomain Code=102 "Failed to access assets" UserInfo={NSLocalizedDescription=Failed to access assets, NSUnderlyingError=0x6000003c5710 {Error Domain=kLSRErrorDomain Code=102 "No asset installed for language=es-ES" UserInfo={NSLocalizedDescription=No asset installed for language=es-ES}}} Here is a code snippet from a demo project: private func process(url: URL) throws {     speech = SFSpeechRecognizer.init(locale: Locale(identifier: "es-ES"))     speech.supportsOnDeviceRecognition = true     let request = SFSpeechURLRecognitionRequest(url: url)     request.requiresOnDeviceRecognition = true     request.shouldReportPartialResults = false     speech.recognitionTask(with: request) { result, error in       guard let result = result else {         if let error = error {           print(error)           return         }         return       }       if let error = error {         print(error)         return       }       if result.isFinal {         print(result.bestTranscription.formattedString)       }     }   } I have tried with different languages (es-ES, en-US) and it says the same error each time. Any idea on how to install these assets or how to fix this?
Replies
3
Boosts
2
Views
3.1k
Activity
Aug ’23
Creating a list of voices available by locale
I'm trying to create a list that users can pick for the voice they want to use in my app. The code below works for US but if I change my locale settings to any other country, it fails to load any available voices even though I have downloaded other for other countries.. func voices() -> [String] {          AVSpeechSynthesisVoice.speechVoices().filter { $0.language == NSLocale.current.voiceLanguage }.map { $0.name }                    // AVSpeechSynthesisVoice.speechVoices().map { $0.name }     } If I list all voices available, I can select the voices for other countries that are loaded.
Replies
3
Boosts
0
Views
1.6k
Activity
Jul ’23
Accessibility Bundle Name - CFBundleSpokenName dont work
CFBundleSpokenName = "Apple 123" CFBundleName = "Apple" Accessibility Bundle Name don't work without opening app. When I touch the application on device home screen, voiceover reads the app as "Apple". After the app launched, it reads as "Apple 123". I want reading as "Apple 123" on home screen, too. Can you help me?
Replies
2
Boosts
1
Views
946
Activity
Jul ’23
TTSPlugins doesn't exist in Xcode Version 15.0 beta 4 (15A5195m)
Download this Apple Speech Project https://developer.apple.com/documentation/accessibility/wwdc21_challenge_speech_synthesizer_simulator The project uses IOS15 deployment, when building and running I receive below errors. Setting deployment to IOS17 results in same errors. Appreciate if anyone else has determined how to re-engage this basic functionality. TTS appears to no longer to work. __ Folder ), NSFilePath=/Library/Developer/CoreSimulator/Volumes/iOS_21A5277g/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/TTSPlugins, NSUnderlyingError=0x600000c75d40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} Failed to get sandbox extensions Query for com.apple.MobileAsset.VoiceServicesVocalizerVoice failed: 2 #FactoryInstall Unable to query results, error: 5 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.CustomVoice failed: 2 Unable to list voice folder Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Unable to list voice folder
Replies
3
Boosts
1
Views
2.0k
Activity
Jul ’23
Issue with recognitionTask(with:resultHandler:) and SFSpeechURLRecognitionRequest
Xcode Version 15.0 beta 4 (15A5195m) or Version 14.3.1 (14E300c) same issue when running iOS Simulator iPhone 14 Pro (iOS 17 or iOS 16.4) or iPhone 12 (iOS 17.0 build 21A5277j) just started to play around with SFSpeechRecognition. Ran into the issue with SFSpeechURLRecognitionRequest. the simple project is just a ContentView with 2 buttons ( one for selecting audio file, one for starting transcribing ), a SpeechRecognizer ( from Apple sample code "Transcribing speech to text" with minor additions ) After selecting an audio file, tap the transcribe button, the following error logs appear in the debugger console after the execution of recognitionTask(with:resultHandler:). 2023-07-18 13:58:16.562706-0400 TranscriberMobile[6818:475161] [] <<<< AVAsset >>>> +[AVURLAsset _getFigAssetCreationOptionsFromURLAssetInitializationOptions:assetLoggingIdentifier:figAssetCreationFlags:error:]: AVURLAssetHTTPHeaderFieldsKey must be a dictionary 2023-07-18 13:58:16.792219-0400 TranscriberMobile[6818:475166] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000023dd00> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2023-07-18 13:58:16.824333-0400 TranscriberMobile[6818:475166] HALC_ProxyObjectMap.cpp:153 HALC_ProxyObjectMap::_CopyObjectByObjectID: failed to create the local object 2023-07-18 13:58:16.824524-0400 TranscriberMobile[6818:475166] HALC_ShellDevice.cpp:2609 HALC_ShellDevice::RebuildControlList: couldn't find the control object 2023-07-18 13:58:16.872935-0400 TranscriberMobile[6818:475165] [] <<<< FAQ Offline Mixer >>>> FigAudioQueueOfflineMixerCreate: [0x10744b8d0] failed to query kAudioConverterPrimeInfo err=561211770, assuming zero priming 2023-07-18 13:58:16.890002-0400 TranscriberMobile[6818:474951] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.mediaexperience" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.mediaexperience}> 2023-07-18 13:58:16.890319-0400 TranscriberMobile[6818:474951] [AMCP] 259 HALRBSAssertionGlue.mm:98 Failed to acquire the AudioRecording RBSAssertion for pid: 6818 with code: 1 - RBSServiceErrorDomain 2023-07-18 13:58:16.893137-0400 TranscriberMobile[6818:474951] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.mediaexperience" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.mediaexperience}> 2023-07-18 13:58:16.893652-0400 TranscriberMobile[6818:474951] [AMCP] 259 HALRBSAssertionGlue.mm:98 Failed to acquire the MediaPlayback RBSAssertion for pid: 6818 with code: 1 - RBSServiceErrorDomain Since the AVURLAsset is not created manually, how to get around the initial error "AVURLAssetHTTPHeaderFieldsKey must be a dictionary"? SpeechRecognizer.swift import Foundation import AVFoundation import Speech import SwiftUI /// A helper for transcribing speech to text using SFSpeechRecognizer and AVAudioEngine. actor SpeechRecognizer: ObservableObject { // ... @MainActor func startTranscribingAudioFile(_ audioURL: URL?) { Task { await transcribeAudioFile(audioURL) } } // ... private func transcribeAudioFile(_ audioURL: URL?) { guard let recognizer, recognizer.isAvailable else { self.transcribe(RecognizerError.recognizerIsUnavailable) return } guard let audioURL else { self.transcribe(RecognizerError.nilAudioFileURL) return } let request = SFSpeechURLRecognitionRequest(url: audioURL) request.shouldReportPartialResults = true self.audioURLRequest = request self.task = recognizer.recognitionTask(with: request, resultHandler: { [weak self] result, error in self?.audioFileRecognitionHandler(result: result, error: error) }) } // ... nonisolated private func audioFileRecognitionHandler(result: SFSpeechRecognitionResult?, error: Error?) { if let result { transcribe(result.bestTranscription.formattedString) } if let error { Task { @MainActor in await reset() transcribe(error) } } } } ContentView.swift import SwiftUI struct ContentView: View { @State var showFileBrowser = false @State var audioFileURL: URL? = nil @StateObject var speechRecognizer = SpeechRecognizer() var body: some View { VStack(spacing: 24) { Button { self.showFileBrowser.toggle() } label: { Text("Select an audio file to transcribe") } Text(audioFileURL != nil ? audioFileURL!.absoluteString : "No audio file selected") .multilineTextAlignment(.center) Button { speechRecognizer.startTranscribingAudioFile(audioFileURL) } label: { Text("Transcribe") } Text(speechRecognizer.transcript == "" ? "No transcript yet" : speechRecognizer.transcript) .multilineTextAlignment(.leading) } .padding() .fileImporter(isPresented: $showFileBrowser, allowedContentTypes: [.audio]) { result in switch result { case .success(let fileURL): fileURL.startAccessingSecurityScopedResource() audioFileURL = fileURL print(fileURL) case .failure(let error): NSLog("%s", error.localizedDescription) } } } }
Replies
2
Boosts
1
Views
1.5k
Activity
Jul ’23
Send touch events programmatically
We are using the Speech framework to enable users to interact with our app via voice commands. When a user says "start test" we send DispatchQueue.main.async { self.startButton.sendActions(for: .touchUpInside) } This works beautifully, except that the screen goes into auto lockout in the middle of a test. Apparently, using sendActions does not actually send a touch event to the OS. My question is how can I tell the OS that a touch event happened programmatically? Thank you
Replies
2
Boosts
0
Views
1.6k
Activity
Jul ’23
SFSpeechRecognizer specify timeout duration?
For my project, I would really benefit from continuous on-device speech recognition without the automatic timeout, or at least with a much longer one. In the WebKit web speech implementation, it looks like there are some extra setters for SFSpeechRecognizer exposing exactly this functionality: https://github.com/WebKit/WebKit/blob/8b1a13b39bbaaf306c9d819c13b0811011be55f2/Source/WebCore/Modules/speech/cocoa/WebSpeechRecognizerTask.mm#L105 Is there a chance Apple could enable programmable duration/time-out? If it’s available in WebSpeech, then why not in native applications?
Replies
0
Boosts
0
Views
987
Activity
Jul ’23
What is this error???
[catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 [AXTTSCommon] Invalid rule: [AXTTSCommon] Invalid rule: [AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/20700159d3b64fc92fc033a3e3946535bd231e4b.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated
Replies
1
Boosts
0
Views
1.3k
Activity
Jul ’23
Text to speech stop working in background on iOS 16.5
Hi, I'm creating a Text to speech app to read aloud PDF/Epub files. I was working fine on iOS older version but stop working for iOS 16.5 in background. Speaking stop just after couple mins that I don't want. I'm really appreciate if you can provide me a solution for this!
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’23
kAFAssistantErrorDomain error codes
Are these error codes documented anywhere? Error codes 203 and 1110 seems to happen regularly. I think they mean the following: 203: some limit reached (happens very regularly when using server-side speech recognition, less often when using on-device recognition) 1110: no speech detected I have gotten a new one now: 1107 No idea what that means.
Replies
1
Boosts
1
Views
3.6k
Activity
Jun ’23
Can we use SFSpeechRecognizer with call Kit
We are creating an online book reading app in which we are initiating video call (group call:- for video call. we are using agora SDK) and at the join of call we start book reading and highlight words at other members' end also and recording/recognition text we are using SFSpeechRecognizer but whenever call kit start and video call start SFSpeechRecognizer start to record audio at others end it's getting failed always, can you please provide any solution to record audio during the video call. // // Speech.swift // Edsoma // // Created by Kapil on 16/02/22. // import Foundation import AVFoundation import Speech protocol SpeechRecognizerDelegate {   func didSpoke(speechRecognizer : SpeechRecognizer , word : String?) } class SpeechRecognizer: NSObject {       private let speechRecognizer = SFSpeechRecognizer(locale: Locale.init(identifier: "en-US")) //1   private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest?   private var recognitionTask: SFSpeechRecognitionTask?   private let audioEngine = AVAudioEngine()   var delegate : SpeechRecognizerDelegate?   static let shared = SpeechRecognizer()   var isOn = false       func setup(){     speechRecognizer?.delegate = self //3           SFSpeechRecognizer.requestAuthorization { (authStatus) in //4               var isButtonEnabled = false               switch authStatus { //5       case .authorized:         isButtonEnabled = true                 case .denied:         isButtonEnabled = false         print("User denied access to speech recognition")                 case .restricted:         isButtonEnabled = false         print("Speech recognition restricted on this device" )                 case .notDetermined:         isButtonEnabled = false         print("Speech recognition not yet authorized")       @unknown default:         break;       }               OperationQueue.main.addOperation() {         // self.microphoneButton.isEnabled = isButtonEnabled       }     }   }   func transcribeAudio(url: URL) {     // create a new recognizer and point it at our audio     let recognizer = SFSpeechRecognizer()     let request = SFSpeechURLRecognitionRequest(url: url)     // start recognition!     recognizer?.recognitionTask(with: request) { [unowned self] (result, error) in       // abort if we didn't get any transcription back       guard let result = result else {         print("There was an error: \(error!)")         return       }       // if we got the final transcription back, print it       if result.isFinal {         // pull out the best transcription...         print(result.bestTranscription.formattedString)       }     }   }       func startRecording() {     isOn = true     let inputNode = audioEngine.inputNode     if recognitionTask != nil {       inputNode.removeTap(onBus: 0)       self.audioEngine.stop()       self.recognitionRequest = nil       self.recognitionTask = nil       DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {         self.startRecording()       }       return       debugPrint("****** recognitionTask != nil *************")     }           let audioSession = AVAudioSession.sharedInstance()     do {               try audioSession.setCategory(AVAudioSession.Category.multiRoute)       try audioSession.setMode(AVAudioSession.Mode.measurement)       try audioSession.setActive(true, options: .notifyOthersOnDeactivation)     } catch {       print("audioSession properties weren't set because of an error.")     }           recognitionRequest = SFSpeechAudioBufferRecognitionRequest()                 guard let recognitionRequest = recognitionRequest else {       fatalError("Unable to create an SFSpeechAudioBufferRecognitionRequest object")     }           recognitionRequest.shouldReportPartialResults = true           recognitionRequest.taskHint = .search           recognitionTask = speechRecognizer?.recognitionTask(with: recognitionRequest, resultHandler: { (result, error) in               var isFinal = false               if result != nil {         self.delegate?.didSpoke(speechRecognizer: self, word: result?.bestTranscription.formattedString)          debugPrint(result?.bestTranscription.formattedString)         isFinal = (result?.isFinal)!                 }               if error != nil {         debugPrint("Speech Error ====>",error)         inputNode.removeTap(onBus: 0)         self.audioEngine.stop()         self.recognitionRequest = nil         self.recognitionTask = nil         if BookReadingSettings.isSTTEnable{           DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {             self.startRecording()           }         }         // self.microphoneButton.isEnabled = true       }     })          // let recordingFormat = AVAudioFormat.init(commonFormat: .pcmFormatFloat32, sampleRate: <#T##Double#>, interleaved: <#T##Bool#>, channelLayout: <#T##AVAudioChannelLayout#>)//inputNode.outputFormat(forBus: 0)     inputNode.removeTap(onBus: 0)     let sampleRate = AVAudioSession.sharedInstance().sampleRate     let recordingFormat = AVAudioFormat(standardFormatWithSampleRate: sampleRate, channels: 1)     inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer, when) in       self.recognitionRequest?.append(buffer)     }           audioEngine.prepare()           do {       try audioEngine.start()     } catch {       print("audioEngine couldn't start because of an error.")     }     debugPrint("Say something, I'm listening!")     //textView.text = "Say something, I'm listening!"         }       /* func stopRecording(){     isOn = false     debugPrint("Recording stoped")     self.audioEngine.stop()     recognitionTask?.cancel()     let inputNode = audioEngine.inputNode     inputNode.removeTap(onBus: 0)     self.recognitionRequest = nil     self.recognitionTask = nil         }*/       func stopRecording(){     isOn = false     debugPrint("Recording stoped")     let inputNode = audioEngine.inputNode     inputNode.removeTap(onBus: 0)     self.audioEngine.stop()     recognitionTask?.cancel()     self.recognitionRequest = nil     self.recognitionTask = nil    }     } extension SpeechRecognizer : SFSpeechRecognizerDelegate {     }
Replies
1
Boosts
0
Views
1.3k
Activity
Jun ’23
[AXTTSCommon] Failure starting audio queue
When the screen is unlocked the AVSpeechSynthesizer.speak is working fine and in locked not working do { try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, mode: .default, options: .defaultToSpeaker) try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation) } catch { print("audioSession properties weren't set because of an error.") } let utterance = AVSpeechUtterance(string: voiceOutdata) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") let synth = AVSpeechSynthesizer() synth.speak(utterance) defer { disableAVSession() } Error Log in the locked state [AXTTSCommon] Failure starting audio queue alp![AXTTSCommon] _BeginSpeaking: couldn't begin playback
Replies
1
Boosts
0
Views
2.9k
Activity
Jun ’23
AVSpeechSynthesizer delay issue, [AXTTSCommon] Invalid rule:
AVSpeechSynthesizer delay issue, [AXTTSCommon] Invalid rule: Play text using AVSpeechSynthesizer. Sound comes out normally. If you call speak(_ utterance: AVSpeechUtterance) to play text as speech [AXTTSCommon] Invalid rule: The log is displayed and it is called two or three times and the sound comes out late. It is judged that there are cases where delays of more than 1 second occur depending on the user, device, or situation, usually ranging from 0.6 seconds. [AXTTSCommon] Invalid rule: There is no additional reasoning behind the log. [AXTTSCommon] Invalid rule: [AXTTSCommon] Invalid rule: In this way, it is called a second time. This issue occurs after iOS 16.0. Is there any way to fix that issue? or not I would like to know if there is a way to reduce the delay at startup even if that log is displayed after the speak(_ utterance: AVSpeechUtterance) call.
Replies
1
Boosts
0
Views
1.4k
Activity
Jun ’23
Speech recognition API in Safari is slow on iPhone 14
Hi, We have recently noticed that the speech recognition API in Safari is extremely slow and inaccurate, specifically on iPhone 14 with iOS 16.1.1 … but works fine on iPhone 12 with the same iOS 16.1.1. Does anybody else run into the same issue or have any suggestions?
Replies
1
Boosts
0
Views
2.5k
Activity
May ’23
AVSpeechSynthesizer write method is broken in iOS 16
Using the write method from AVSpeechSynthesizer produces the following error: [AXTTSCommon] TTSPlaybackEnqueueFullAudioQueueBuffer: error -66686 enqueueing buffer This issue has first been seen on iOS 16. More information and code snippet: https://stackoverflow.com/questions/73716508/play-audio-buffers-generated-by-avspeechsynthesizer-directly
Replies
4
Boosts
4
Views
2.9k
Activity
May ’23
SFSpeechRecognitionRequest
I'm looking at the SFSpeechRecognitionRequest object but it's saying not to use it, and instead use SFSpeechAudioBufferRecognitionRequest: https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest I want to work with the contextualStrings but I'm not seeing that as an option in the other objects. Do I ignore this warning and use it anyway?
Replies
0
Boosts
0
Views
677
Activity
May ’23
Are there any background processing restrictions for Audio background mode?
Hi, I'd like to develop an iOS application that keeps the mic open for voice recording and processing even when the screen is off. I want to perform speech-to-text requests whenever samples of voice are detected (using a voice activity detection library) and also send requests to the cloud based on what is spoken. I've enabled the Audio background mode and preliminary testing seems to indicate that this is working. That is, I can press "record" in my app, switch to another app then shut the screen off, and speak for several seconds before auto-stopping the recording and sending it to a SFSpeechRecognizer task, which appears to succeed. However, I have read that this should not be supported so before going further down this path, I wanted to understand what exactly are the processing limitations in this mode? The documentation doesn't seem very clear to me. Thanks, -- B.
Replies
5
Boosts
0
Views
2.1k
Activity
May ’23