Recognize spoken words in recorded or live audio using Speech.

Posts under Speech tag

200 Posts

Post

Replies

Boosts

Views

Activity

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
679
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
TTsError
[AXTTSCommon] _BeginSpeaking: speech cancelled error: Error Domain=TTSErrorDomain Code=-4001 "(null)" [AXTTSCommon] _BeginSpeaking: couldn't begin playback [plugin] invokeFlutter soundLevelChange [VOTSpeech] Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4005 "(null)". Attempting to speak again with fallback identifier: com.apple.voice.compact.en-US.Samantha
1
3
929
Apr ’23
AVSpeechSynthesizer error unable to list voice folder
IOS 16.4 let synthesizer = AVSpeechSynthesizer() private func speakText(text: String) { let utterance = AVSpeechUtterance(string: text) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") utterance.rate = 0.5 synthesizer.speak(utterance) print("speak code run") } The above code works fine on the emulator but not on iphone 13 or ipad pro m1. Each time these errors 2023-04-02 22:34:43.418311+0200 [45953:4354804] [catalog] Unable to list voice folder speak code run 2023-04-02 22:34:43.447608+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.452857+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.471776+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.618664+0200 [45953:4354804] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 2023-04-02 22:34:43.798930+0200 [45953:4354957] [AXTTSCommon] Failure starting audio queue \M-3<…> 2023-04-02 22:34:45.812019+0200 [45953:4354957] [AXTTSCommon] Run loop timed out waiting for free audio buffer
1
0
1.6k
Apr ’23
AVFoundation AVSpeechUtterance AVSpeechSynthesizer not working in iOS 16 Beta 4, Beta 5
Anyone experiencing issues with Speech to Text in Beta 4 ? It was working absolutely fine in earlier iOS versions.        let utterance = AVSpeechUtterance(string: "The quick brown fox jumped over the lazy dog.")       utterance.voice = AVSpeechSynthesisVoice(language: "en-US")       utterance.volume = 1       utterance.rate = 0.1       let synthesizer = AVSpeechSynthesizer()       synthesizer.speak(utterance)
15
3
6.2k
Mar ’23
com.apple.TextToSpeech.SpeechThread crash after iOS 16
Hi, I face an issue with AVSpeechSynthesizer after iOS 16. Crashed: com.apple.TextToSpeech.SpeechThread 0 libobjc.A.dylib 0x3518 objc_release + 16 1 libobjc.A.dylib 0x3518 objc_release_x0 + 16 2 libobjc.A.dylib 0x15d8 AutoreleasePoolPage::releaseUntil(objc_object**) + 196 3 libobjc.A.dylib 0x4f40 objc_autoreleasePoolPop + 256 4 libobjc.A.dylib 0x329dc objc_tls_direct_base<AutoreleasePoolPage*, (tls_key)3, AutoreleasePoolPage::HotPageDealloc>::dtor_(void*) + 168 5 libsystem_pthread.dylib 0x1bd8 _pthread_tsd_cleanup + 620 6 libsystem_pthread.dylib 0x4674 _pthread_exit + 84 7 libsystem_pthread.dylib 0x16d8 _pthread_start + 160 8 libsystem_pthread.dylib 0xba4 thread_start + 8 I got many crash reports from my clients, but unfortunately, I can't reproduce this on my test devices. Does anybody face this also?
21
4
7.1k
Mar ’23
SFSpeechRecognizer (Siri Transcription) Timeout Error on iOS App
In my iOS app, I am trying to transcribe prerecorded audio using iOS 10's latest feature, the Speech API.Multiple sources including the documentation have stated that the audio duration limit for the Speech API (more specifically SFSpeechRecognizer) is 1 minute.In my code, I have found that any audio files with a length of about 15 seconds or more, will get the following error:Error Domain=kAFAssistantErrorDomain Code=203 "SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms" UserInfo={NSLocalizedDescription=SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms, NSUnderlyingError=0x170248c40 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}}I have searched all over the internet and have set to find a solution to this. There also have been people with the same problem. Some people suspect that it's a problem with Nuance.It is also worth noting that I do get partial results from the transcription process.Here's the code from my iOS app.` // Create a speech recognizer request object. let srRequest = SFSpeechURLRecognitionRequest(url: location) srRequest.shouldReportPartialResults = false sr?.recognitionTask(with: srRequest) { (result, error) in if let error = error { // Something wrong happened print(error.localizedDescription) } else { if let result = result { print(4) print(result.bestTranscription.formattedString) if result.isFinal { print(5) transcript = result.bestTranscription.formattedString print(result.bestTranscription.formattedString) // Store the transcript into the database. print("\nSiri-Transcript: " + transcript!) // Store the audio transcript into Firebase Realtime Database self.firebaseRef = FIRDatabase.database().reference() let ud = UserDefaults.standard if let uid = ud.string(forKey: "uid") { print("Storing the transcript into the database.") let path = "users" + "/" + uid + "/" + "siri_transcripts" + "/" + date_recorded + "/" + filename.components(separatedBy: ".")[0] print("transcript database path: \(path)") self.firebaseRef.child(path).setValue(transcript) } } } } }`Thank you for your help.
6
0
5.0k
Mar ’23
AVSpeechSynthesizer not working in iOS 16 Beta
I am using below piece of code for TTS in iOS: let utterance = AVSpeechUtterance(string: "Hello World") utterance.voice = AVSpeechSynthesisVoice(language: "en-US") let synthesizer = AVSpeechSynthesizer() synthesizer.speak(utterance) It is working fine for iOS 15.6.1 and all lower versions. But the same code is giving below exception in iOS 16 Beta (latest beta 6 as well): [catalog] Unable to list voice folder The required voices are present in the iPhone and working properly in Voice Over and Spoken content. Even the voice API AVSpeechSynthesisVoice.speechVoices() is fetching all the voices, but I am getting above exception at line synthesizer.speak(utterance).
5
4
8.2k
Mar ’23
WebView doesn't play youtube after speech recognization
I use WKWebView to play embed youtube video, and also use SFSpeechRecognizer to recognize speech. But after recognize speech, webview does not play video. Please tell me how to fix it. 2023-03-04 15:27:14.100700+0900 SpeechRecognition[66390:23051497] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-04 15:27:14.100756+0900 SpeechRecognition[66390:23051497] [ProcessSuspension] 0x113000400 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=66392, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} import UIKit import AVFAudio import Speech import MediaPlayer import WebKit class ViewController: UIViewController { @IBOutlet weak var startButton: UIButton! @IBOutlet weak var cancelButton: UIButton! var recognitionTask: SFSpeechRecognitionTask? = nil var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. print("viewDidLoad") startButton.addTarget(self, action: #selector(StartSpeechRecognition), for: .touchUpInside) cancelButton.addTarget(self, action: #selector(StopSpeechRecognition), for: .touchUpInside) //startButton.addTarget(self, action: #selector(ChangeVolume), for: .touchUpInside) let webConfiguration = WKWebViewConfiguration() webConfiguration.allowsInlineMediaPlayback = true webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 200, height: 200), configuration: webConfiguration) self.view.addSubview(webView) let myURL = URL(string: "https://www.youtube.com/embed/B7BxrAAXl94?playsinline=1") let myRequest = URLRequest(url: myURL!) webView.load(myRequest) } @objc public func StartSpeechRecognition() { let audioEngine = AVAudioEngine() // Configure the audio session for the app. let audioSession = AVAudioSession.sharedInstance() try? audioSession.setCategory(.record, mode: .measurement, options: .duckOthers) try? audioSession.setActive(true, options: .notifyOthersOnDeactivation) let inputNode = audioEngine.inputNode // Create and configure the speech recognition request. let recognitionRequest = SFSpeechAudioBufferRecognitionRequest() recognitionRequest.shouldReportPartialResults = true // Configure the microphone input. let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in recognitionRequest.append(buffer) } audioEngine.prepare() try? audioEngine.start() // Create a recognition task for the speech recognition session. // Keep a reference to the task so that it can be canceled. guard let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "ja-JP")) else { return } print("Start Recognize") recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest) { result, error in var isFinal = false if let result = result { // Update the text view with the results. isFinal = result.isFinal print("Text \(result.bestTranscription.formattedString)") } if error != nil || isFinal { // Stop recognizing speech if there is a problem. audioEngine.stop() inputNode.removeTap(onBus: 0) print("Stop") print(self.recognitionTask?.isFinishing) self.recognitionTask = nil } } } @objc public func StopSpeechRecognition() { guard let recognitionTask = recognitionTask else { return } recognitionTask.finish() } }
0
0
1.1k
Mar ’23
How to get Transcription for less than 1 minute of Audio Data using SFSpeechRecognizer Api.
Why SfSpeechRecognizer is not returning Transcription properly for less than 1 minute of Audio if we are Sending Audio Data to Server. we know 1 minute of limitation is there for server . That's why i m adding some Silence to Audio File for making it exact 1 minute. it is returning Transcription (Some Segment) but not properly. it is skipping some Substring from the middle part. if i m Keeping Same Audio File(after Adding Silence) on OnDeviceSpeechRecognition ,it is working properly. so, what can i do in this situation if we want transcription from server. Does anybody knows here anything about this? Thanks.
0
0
678
Mar ’23
ContextualStrings
Hi, did anyone make contextualStrings work? I would love to use it in various languages but it does not work at all. What I want to do in my app is make it able to recognise e.g. „Quintsextakkord“ oder „F-Dur“ „B-flat Minor“ or „sixth-fifth chord“ etc. Any hints? Thanks
0
0
579
Feb ’23
Teach SFSpeechRecognizer custom words (medication names, chemistry terms, etc)
Hi, I have a question regarding the integration of the speech to text library called SFSpeechRecognizer. I need SFSpeechRecognizer to recognize terms that are not present in the iOS dictionary like medication names, chemistry terms, etc. I would have to add them, somehow, for SFSpeechRecognizer to be able to recognise them. Is this possible? Thanks
2
0
1.6k
Feb ’23
Contextual Strings not working for on-device speech recognition.
I've noticed that contextual strings do not work for on-device speech recognition. I've written a Feedback entry: FB7496068 To reproduce: Create a basic app that transcribes speech. Add “Flubbery Dubbery” or a made up couple of words to a strings array and set it equal to the contextualStrings property of SFSpeechAudioBufferRecognitionRequest For the recognition request being used, set the requiresOnDeviceRecognition Boolean property to true. Transcribe audio and say the made up couple of words. See that the device never correctly transcribes the made up couple of words. Now set the requiresOnDeviceRecognition Boolean to false. Transcribe audio and say the made up words. See that the device correctly transcribes the made up words. Has anyone else run into this problem? I would love a fix. PS, I noticed that if you add a custom word as a contact in the Contacts app, then on-device recognition picks it up. So it seems it's possible, just not implemented quite right.
2
0
1.5k
Feb ’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.6k
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
3.0k
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
679
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
iOS Speech module not detecting some simple english words
We are using the speech module to detect the voice. Whenever the user says END Task the speech module is detecting it as AND Task. This is happening with similar phrases like END Activity, END Shift etc.., Is there any workaround for this issue?
Replies
0
Boosts
1
Views
646
Activity
May ’23
TTsError
[AXTTSCommon] _BeginSpeaking: speech cancelled error: Error Domain=TTSErrorDomain Code=-4001 "(null)" [AXTTSCommon] _BeginSpeaking: couldn't begin playback [plugin] invokeFlutter soundLevelChange [VOTSpeech] Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4005 "(null)". Attempting to speak again with fallback identifier: com.apple.voice.compact.en-US.Samantha
Replies
1
Boosts
3
Views
929
Activity
Apr ’23
SFSpeechRecognizer Addspunctuation is not working why?
SFSpeechRecognizer addspunctuation is not working for all languages, it is giving only for some languages like English,Spanish,French,German,Russian , other languages not at all giving punctuation, how can I get punctuation for all languages? if anyone knows help me.
Replies
0
Boosts
2
Views
567
Activity
Apr ’23
AVSpeechSynthesizer error unable to list voice folder
IOS 16.4 let synthesizer = AVSpeechSynthesizer() private func speakText(text: String) { let utterance = AVSpeechUtterance(string: text) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") utterance.rate = 0.5 synthesizer.speak(utterance) print("speak code run") } The above code works fine on the emulator but not on iphone 13 or ipad pro m1. Each time these errors 2023-04-02 22:34:43.418311+0200 [45953:4354804] [catalog] Unable to list voice folder speak code run 2023-04-02 22:34:43.447608+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.452857+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.471776+0200 [45953:4354804] [catalog] Unable to list voice folder 2023-04-02 22:34:43.618664+0200 [45953:4354804] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2 2023-04-02 22:34:43.798930+0200 [45953:4354957] [AXTTSCommon] Failure starting audio queue \M-3<…> 2023-04-02 22:34:45.812019+0200 [45953:4354957] [AXTTSCommon] Run loop timed out waiting for free audio buffer
Replies
1
Boosts
0
Views
1.6k
Activity
Apr ’23
Local Speech Recognition on WatchOS
How can we implement audio speech recognition as of watchOs 9.1 ? i saw this question that as of watchOs 8.0 is not yet available https://developer.apple.com/forums/thread/682508#reply-to-this-question and looking at the apple store search engine its clearly that this is something that is working https://i.imgur.com/T4MN3LO.jpg
Replies
0
Boosts
0
Views
1.1k
Activity
Mar ’23
AVFoundation AVSpeechUtterance AVSpeechSynthesizer not working in iOS 16 Beta 4, Beta 5
Anyone experiencing issues with Speech to Text in Beta 4 ? It was working absolutely fine in earlier iOS versions.        let utterance = AVSpeechUtterance(string: "The quick brown fox jumped over the lazy dog.")       utterance.voice = AVSpeechSynthesisVoice(language: "en-US")       utterance.volume = 1       utterance.rate = 0.1       let synthesizer = AVSpeechSynthesizer()       synthesizer.speak(utterance)
Replies
15
Boosts
3
Views
6.2k
Activity
Mar ’23
com.apple.TextToSpeech.SpeechThread crash after iOS 16
Hi, I face an issue with AVSpeechSynthesizer after iOS 16. Crashed: com.apple.TextToSpeech.SpeechThread 0 libobjc.A.dylib 0x3518 objc_release + 16 1 libobjc.A.dylib 0x3518 objc_release_x0 + 16 2 libobjc.A.dylib 0x15d8 AutoreleasePoolPage::releaseUntil(objc_object**) + 196 3 libobjc.A.dylib 0x4f40 objc_autoreleasePoolPop + 256 4 libobjc.A.dylib 0x329dc objc_tls_direct_base<AutoreleasePoolPage*, (tls_key)3, AutoreleasePoolPage::HotPageDealloc>::dtor_(void*) + 168 5 libsystem_pthread.dylib 0x1bd8 _pthread_tsd_cleanup + 620 6 libsystem_pthread.dylib 0x4674 _pthread_exit + 84 7 libsystem_pthread.dylib 0x16d8 _pthread_start + 160 8 libsystem_pthread.dylib 0xba4 thread_start + 8 I got many crash reports from my clients, but unfortunately, I can't reproduce this on my test devices. Does anybody face this also?
Replies
21
Boosts
4
Views
7.1k
Activity
Mar ’23
SFSpeechRecognizer (Siri Transcription) Timeout Error on iOS App
In my iOS app, I am trying to transcribe prerecorded audio using iOS 10's latest feature, the Speech API.Multiple sources including the documentation have stated that the audio duration limit for the Speech API (more specifically SFSpeechRecognizer) is 1 minute.In my code, I have found that any audio files with a length of about 15 seconds or more, will get the following error:Error Domain=kAFAssistantErrorDomain Code=203 "SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms" UserInfo={NSLocalizedDescription=SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms, NSUnderlyingError=0x170248c40 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}}I have searched all over the internet and have set to find a solution to this. There also have been people with the same problem. Some people suspect that it's a problem with Nuance.It is also worth noting that I do get partial results from the transcription process.Here's the code from my iOS app.` // Create a speech recognizer request object. let srRequest = SFSpeechURLRecognitionRequest(url: location) srRequest.shouldReportPartialResults = false sr?.recognitionTask(with: srRequest) { (result, error) in if let error = error { // Something wrong happened print(error.localizedDescription) } else { if let result = result { print(4) print(result.bestTranscription.formattedString) if result.isFinal { print(5) transcript = result.bestTranscription.formattedString print(result.bestTranscription.formattedString) // Store the transcript into the database. print("\nSiri-Transcript: " + transcript!) // Store the audio transcript into Firebase Realtime Database self.firebaseRef = FIRDatabase.database().reference() let ud = UserDefaults.standard if let uid = ud.string(forKey: "uid") { print("Storing the transcript into the database.") let path = "users" + "/" + uid + "/" + "siri_transcripts" + "/" + date_recorded + "/" + filename.components(separatedBy: ".")[0] print("transcript database path: \(path)") self.firebaseRef.child(path).setValue(transcript) } } } } }`Thank you for your help.
Replies
6
Boosts
0
Views
5.0k
Activity
Mar ’23
AVSpeechSynthesizer not working in iOS 16 Beta
I am using below piece of code for TTS in iOS: let utterance = AVSpeechUtterance(string: "Hello World") utterance.voice = AVSpeechSynthesisVoice(language: "en-US") let synthesizer = AVSpeechSynthesizer() synthesizer.speak(utterance) It is working fine for iOS 15.6.1 and all lower versions. But the same code is giving below exception in iOS 16 Beta (latest beta 6 as well): [catalog] Unable to list voice folder The required voices are present in the iPhone and working properly in Voice Over and Spoken content. Even the voice API AVSpeechSynthesisVoice.speechVoices() is fetching all the voices, but I am getting above exception at line synthesizer.speak(utterance).
Replies
5
Boosts
4
Views
8.2k
Activity
Mar ’23
WebView doesn't play youtube after speech recognization
I use WKWebView to play embed youtube video, and also use SFSpeechRecognizer to recognize speech. But after recognize speech, webview does not play video. Please tell me how to fix it. 2023-03-04 15:27:14.100700+0900 SpeechRecognition[66390:23051497] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-04 15:27:14.100756+0900 SpeechRecognition[66390:23051497] [ProcessSuspension] 0x113000400 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=66392, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} import UIKit import AVFAudio import Speech import MediaPlayer import WebKit class ViewController: UIViewController { @IBOutlet weak var startButton: UIButton! @IBOutlet weak var cancelButton: UIButton! var recognitionTask: SFSpeechRecognitionTask? = nil var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. print("viewDidLoad") startButton.addTarget(self, action: #selector(StartSpeechRecognition), for: .touchUpInside) cancelButton.addTarget(self, action: #selector(StopSpeechRecognition), for: .touchUpInside) //startButton.addTarget(self, action: #selector(ChangeVolume), for: .touchUpInside) let webConfiguration = WKWebViewConfiguration() webConfiguration.allowsInlineMediaPlayback = true webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 200, height: 200), configuration: webConfiguration) self.view.addSubview(webView) let myURL = URL(string: "https://www.youtube.com/embed/B7BxrAAXl94?playsinline=1") let myRequest = URLRequest(url: myURL!) webView.load(myRequest) } @objc public func StartSpeechRecognition() { let audioEngine = AVAudioEngine() // Configure the audio session for the app. let audioSession = AVAudioSession.sharedInstance() try? audioSession.setCategory(.record, mode: .measurement, options: .duckOthers) try? audioSession.setActive(true, options: .notifyOthersOnDeactivation) let inputNode = audioEngine.inputNode // Create and configure the speech recognition request. let recognitionRequest = SFSpeechAudioBufferRecognitionRequest() recognitionRequest.shouldReportPartialResults = true // Configure the microphone input. let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in recognitionRequest.append(buffer) } audioEngine.prepare() try? audioEngine.start() // Create a recognition task for the speech recognition session. // Keep a reference to the task so that it can be canceled. guard let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "ja-JP")) else { return } print("Start Recognize") recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest) { result, error in var isFinal = false if let result = result { // Update the text view with the results. isFinal = result.isFinal print("Text \(result.bestTranscription.formattedString)") } if error != nil || isFinal { // Stop recognizing speech if there is a problem. audioEngine.stop() inputNode.removeTap(onBus: 0) print("Stop") print(self.recognitionTask?.isFinishing) self.recognitionTask = nil } } } @objc public func StopSpeechRecognition() { guard let recognitionTask = recognitionTask else { return } recognitionTask.finish() } }
Replies
0
Boosts
0
Views
1.1k
Activity
Mar ’23
How to get Transcription for less than 1 minute of Audio Data using SFSpeechRecognizer Api.
Why SfSpeechRecognizer is not returning Transcription properly for less than 1 minute of Audio if we are Sending Audio Data to Server. we know 1 minute of limitation is there for server . That's why i m adding some Silence to Audio File for making it exact 1 minute. it is returning Transcription (Some Segment) but not properly. it is skipping some Substring from the middle part. if i m Keeping Same Audio File(after Adding Silence) on OnDeviceSpeechRecognition ,it is working properly. so, what can i do in this situation if we want transcription from server. Does anybody knows here anything about this? Thanks.
Replies
0
Boosts
0
Views
678
Activity
Mar ’23
AVSpeechUtterance speed up or partial play
Hello, In car navigation application I experience TTS glitches. Most likely because audio is processed on GPU at the same time as it renders map. Is there a way to solve that? My first guess is to pre-create AVSpeechUtterance, and then send this object to speak when it's time to speak this phrase. Does it makes sense?
Replies
0
Boosts
0
Views
1k
Activity
Feb ’23
iPAD & iOS 15 - webkitSpeechRecognition not working
Apple added support for WebKit speech recognition in Safari 14.1. We're trying to use it in our WebApp and facing some issues. The issue is mic never stops after the user stops speaking and we never get the recognized text on iPhone and iPad. Here is a simple WebApp to test : https://oiyw7.csb.app/
Replies
1
Boosts
3
Views
3.1k
Activity
Feb ’23
ContextualStrings
Hi, did anyone make contextualStrings work? I would love to use it in various languages but it does not work at all. What I want to do in my app is make it able to recognise e.g. „Quintsextakkord“ oder „F-Dur“ „B-flat Minor“ or „sixth-fifth chord“ etc. Any hints? Thanks
Replies
0
Boosts
0
Views
579
Activity
Feb ’23
Teach SFSpeechRecognizer custom words (medication names, chemistry terms, etc)
Hi, I have a question regarding the integration of the speech to text library called SFSpeechRecognizer. I need SFSpeechRecognizer to recognize terms that are not present in the iOS dictionary like medication names, chemistry terms, etc. I would have to add them, somehow, for SFSpeechRecognizer to be able to recognise them. Is this possible? Thanks
Replies
2
Boosts
0
Views
1.6k
Activity
Feb ’23
Contextual Strings not working for on-device speech recognition.
I've noticed that contextual strings do not work for on-device speech recognition. I've written a Feedback entry: FB7496068 To reproduce: Create a basic app that transcribes speech. Add “Flubbery Dubbery” or a made up couple of words to a strings array and set it equal to the contextualStrings property of SFSpeechAudioBufferRecognitionRequest For the recognition request being used, set the requiresOnDeviceRecognition Boolean property to true. Transcribe audio and say the made up couple of words. See that the device never correctly transcribes the made up couple of words. Now set the requiresOnDeviceRecognition Boolean to false. Transcribe audio and say the made up words. See that the device correctly transcribes the made up words. Has anyone else run into this problem? I would love a fix. PS, I noticed that if you add a custom word as a contact in the Contacts app, then on-device recognition picks it up. So it seems it's possible, just not implemented quite right.
Replies
2
Boosts
0
Views
1.5k
Activity
Feb ’23