Recognize spoken words in recorded or live audio using Speech.

Posts under Speech tag

200 Posts

Post

Replies

Boosts

Views

Activity

XCode 14 & iOS 16 Beta: No AVSpeechSynthesisVoice.speechVoices available
I'm testing my App in the Xcode 14 beta (released with WWDC22) on iOS 16, and it seems that AVSpeechSynthesisVoice is not working correctly. The following code always returns an empty array: AVSpeechSynthesisVoice.speechVoices() Additionally, attempting to initialize AVSpeechSynthesisVoice returns nil for all of the following: AVSpeechSynthesisVoice(language: AVSpeechSynthesisVoice.currentLanguageCode()) AVSpeechSynthesisVoice(language: "en") AVSpeechSynthesisVoice(language: "en-US") AVSpeechSynthesisVoice(identifier: AVSpeechSynthesisVoiceIdentifierAlex) AVSpeechSynthesisVoice.speechVoices().first
15
3
5.1k
Feb ’23
Can't hear audio in VoIP call when i grant media permission to webView
VoIP call works perfectly fine at start until i grant access to WKWebView media(microphone access). I am using WKWebView to highlight the spoken word using web speech engine. If i use webView i can't hear VoIP call audio and if i stop webView VoIP call works perfectly fine. What i want to achieve is to stay in VoIP call as well as work with webView to highlight the spoken words and I want to know if there is any problem in giving microphone access to VoIP as well as WKWebView simultaneously. Please post your question if i am not clear about anything or you want to know more information.
0
0
637
Feb ’23
iOS 16 TTS is horrible, it doesn’t work!
iOS 15 Siri voices worked perfectly. However, iOS 16 has a lot of issues - such as skipping words and sentences, and stopping reading all together. Obviously, this is a problem with the TTS I myself use Siri to read books while driving, but I regret updating to iOS 16. I went as far as upgrading my iPhone SE to my iPhone 14 Pro thinking it was the memory issue, but it's the same issue on both phones even my Mac M1 Pro with 16Gigs has same issues. https://youtu.be/g58nbW4J0DY It would be nice to receive and update or even a roll back to iOS 15 state of TTS
3
1
2.7k
Jan ’23
Switch voice on AVSpeechSynthesizer is causing "[AXTTSCommon] Invalid rule"
Simplifying, if I implement a code like the following let utterance = AVSpeechUtterance(string: "Hello world.") utterance.voice = AVSpeechSynthesisVoice(language: "en-GB") self.synthesizer.speak(utterance) let utterance = AVSpeechUtterance(string: "Hola mundo.") utterance.voice = AVSpeechSynthesisVoice(language: "es-ES") self.synthesizer.speak(utterance) After the second speak, I get the following error messages from the console [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(1\/2\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "M_FRACTION_OF_$1 EXPANSION_SG_OF_$2" # 1/2 mm --> medio milímetro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "M_FRACTION_OF_$1 de EXPANSION_SG_OF_$2" # 1/4 km² --> un cuarto de kilómetro cuadrado" [AXTTSCommon] Invalid rule: /(?<=\d\s)(\d\/\d\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "$2 y M_FRACTION_OF_$1" # 1/6m --> un sexto de metro [AXTTSCommon] Invalid rule: /(1\/2\s)(milímetro|centímetro|metro|metro cuadrado|metro cúbico|kilómetro|kilómetro cuadrado|kilómetro cúbico|miligramo|gramo|kilo|kilogramo|mililitro|litro)\b/i --> "M_FRACTION_OF_$1 $2" # 1/2 milímetro --> medio milímetro [AXTTSCommon] Invalid rule: /(milímetros?|centímetros?|metros?|metros? cuadrados?|metros? cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\sy?\s?(1\/2)\b/i --> "$1 y M_FRACTION_OF_$2" # 3 metros y 1/2 --> tres metros y medio [AXTTSCommon] Invalid rule: /M_FRACTION_OF_1\/2/ --> "medio" # 1/2 m --> medio metro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s?)(milímetros?|centímetros?|metros?|metros? cuadrados?|metros? cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramoS?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b/i --> "M_FRACTION_OF_$1 de $2" # 1/4 kilómetro --> un cuarto de kilómetro [AXTTSCommon] Invalid rule: /(?<=\d\s)(\d\/\d\s?)(milímetros?|centímetros?|metros?|metros? cuadrados?|metro cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b/i --> "$2 y M_FRACTION_OF_$1" # 2 1/4 kilómetros --> dos kilómetros y un cuarto [AXTTSCommon] Invalid rule: /(milímetros?|centímetros?|metros?|metro cuadrados?|metro cúbicos?|kilómetros?|kilómetro cuadrados?|kilómetro cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\sy?\s?(\d\/\d\s?)/ --> "$1 y M_FRACTION_OF_$2" # 2 milímetros y 1/2 --> dos milímetros y medio [AXTTSCommon] Invalid rule: /M_FRACTION_OF_(\d\/\d)/ --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 --> un cuarto [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)(?=de (pan|masa|taza|hora)\b)/i --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 de pan --> un cuarto de pan [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)(?=de (milímetros?|centímetros?|metros?|metro cuadrados?|metro cúbicos?|kilómetros?|kilómetro cuadrados?|kilómetro cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b)/i --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 de metro --> un cuarto de metro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)/ --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # catch-all rule for fractions, to avoid "1/4" --> "uno cuatro" The final behavior is correct, the expression is reproduced despite de console messages. However, after approximately 400 iterations the application consumes all memory resources in processes related to AXTTSCommon and Regex.
4
0
2.1k
Jan ’23
Web Speech Synthesis API: not all voices installed listed
I'm developing an application using the Web Speech API for speech synthesis. According to the API specification SpeechSynthesis.getVoices() should retrieve the voices available on the system. On my iPad Pro, 12,9 inch, 3rd generation, iOS 16 however this doesn't return all voices installed on the system. In system settings (Accessibility -> Spoken content -> Voices -> German) e.g. I see these voices: Anna Eloquence Markus Petra Siri Viktor Yannick However if for SpeechSynthesis.getVoices() I only get the voices within the group "Eloquence": Eddy Flo Grandma Grandpa Reed Rocko Sandy Shelley All other voices (Anna, Markus, etc.) are missing. Is this a bug or is it intended by Apple that it's impossible to use all voices? This is independent of the browser, it's the same for Safari, Chrome or Firefox. Use this in order to test which voices are available using the WebSpeech API: https://plnkr.co/edit/E2etsrUZVOVfrDwG
7
6
3.7k
Jan ’23
Same file, but length becomes zero when put in a different directory
I'm trying to read an AVAudioFile into a buffer. I found that when the directory is /Users/myusername/Library/Developer/CoreSimulator/Devices/112C1F73-326A-408F-B9CA-2DE6739D60F4/data/Containers/Data/Application/F98B01D3-8136-4188-8589-0E40E8C96559/Documents/rawAudioData/0_rawAudio.wav the length becomes zero. But when I move the same file to /Users/myusername/Downloads/swiftApps/0_rawAudio.wav the length and becomes normal again. I checked that the file is reachable phonebook directories. So why is this happening? Thanks!
0
0
747
Dec ’22
How to make speech recognition more accurate?
Hi, I'm using the Speech library to get speech recognition from AVAudioRecorder and store the text to database. However, most of the time it is not accurate. Heck, even "test 123" gave me entirely different words (eg. "this one till three", "this one ticket", etc). The funny thing was, it was correct a few times when it was still progressing, but then it changed into the wrong final words. So, how do I increase the accuracy of it? This is what I got as the settings:           try audioSession.setCategory(.record, mode: .spokenAudio, options: .duckOthers)          try audioSession.setActive(true, options: .notifyOthersOnDeactivation)      let recorderSettings: [String:Any] = [       AVFormatIDKey: NSNumber(value: kAudioFormatAppleLossless),        AVSampleRateKey: 44100.0,        AVNumberOfChannelsKey: 1,        AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue     ] Is there anything else to improve? Thank you.
0
0
1k
Dec ’22
Why can't I get more info on why SFSpeechRecognizer won't read my recorded audio files?
Updated info below Full disclosure: I do have this question over on StackOverflow, but I am at a standstill till I find a way to move forward, debug, etc. I am trying to recognize prerecorded speech in Swift. Essentially it either detects no speech, detects blank speech, or works on the one prerecorded file where I screamed a few words. I can't tell where the headache lies and can't figure out if there's a more detailed way to debug this. I can't find any properties that give more detailed info. Someone on SO did recommend I go through Apple's demo, here. This works just fine, and my code is very similar to it. Yet the main difference remains if there is something about the way I save my audio files or something else is leading to my headaches. If anyone has any insight into this I would very much appreciate any hints. My question over on StackOverflow Updated info below, and new code Updated info It appears that I was calling SFSpeechURLRecognitionRequest too often, and before I completed the first request. Perhaps I need to create a new instance of SFSpeechRecognizer? Unsure. Regardless, I quickly/sloppily adjusted the code to only run it once the previous instance returned its results. The results were much better, except one audio file still came up as no results. Not an error, just no text. This file is the same as the previous file, in that I took an audio recording and split it in two. So the formats and volumes are the same. So I still need a better way to debug this, to find out what it going wrong with that file. The code where I grab the file and attempt to read it func findAudioFiles(){ let fm = FileManager.default var aFiles : URL print ("\(urlPath)") do { let items = try fm.contentsOfDirectory(atPath: documentsPath) let filteredInterestArray1 = items.filter({$0.hasSuffix(".m4a")}) let filteredInterestArray2 = filteredInterestArray1.filter({$0.contains("SS-X-")}) let sortedItems = filteredInterestArray2.sorted() for item in sortedItems { audioFiles.append(item) } NotificationCenter.default.post(name: Notification.Name("goAndRead"), object: nil, userInfo: myDic) } catch { print ("\(error)") } } @objc func goAndRead(){ audioIndex += 1 if audioIndex != audioFiles.count { let fileURL = NSURL.fileURL(withPath: documentsPath + "/" + audioFiles[audioIndex], isDirectory: false) transcribeAudio(url: fileURL, item: audioFiles[audioIndex]) } } func requestTranscribePermissions() { SFSpeechRecognizer.requestAuthorization { [unowned self] authStatus in DispatchQueue.main.async { if authStatus == .authorized { print("Good to go!") } else { print("Transcription permission was declined.") } } } } func transcribeAudio(url: URL, item: String) { guard let recognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US")) else {return} let request = SFSpeechURLRecognitionRequest(url: url) if !recognizer.supportsOnDeviceRecognition { print ("offline not available") ; return } if !recognizer.isAvailable { print ("not available") ; return } request.requiresOnDeviceRecognition = true request.shouldReportPartialResults = true recognizer.recognitionTask(with: request) {(result, error) in guard let result = result else { print("\(item) : There was an error: \(error.debugDescription)") return } if result.isFinal { print("\(item) : \(result.bestTranscription.formattedString)") NotificationCenter.default.post(name: Notification.Name("goAndRead"), object: nil, userInfo: self.myDic) } } }
0
0
973
Dec ’22
SFTranscriptionSegment confidence is always 0 for Saudi Arabia, but ok for USA
Hello, I have SFSpeechRecognizer initialised with Locale(identifier: "en-US") After setting Region (on phone settings) to one of these countries: Saudi Arabia United Arab Emirates Malaysia SFTranscriptionSegment always have confidence 0. Setting Region back to United States (or Russia) makes confidence correct (non-zero value). This issue is 100% reproducible on Simulator &amp; Device with SpeakToMe sample App by Apple https://developer.apple.com/library/archive/samplecode/SpeakToMe/Introduction/Intro.html I'm adopted it to Swift 5 and added logging. Modified Sample project's ViewController.swift is attached. ViewController.swift - https://developer.apple.com/forums/content/attachment/8695df58-1a4a-4e14-8c1b-4b052d437f68 To reproduce: Tap "Start recording" Say "My name is Max" Tap "Stop recording" Last output for Saudi Arabia: New result from recognition task Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Last output for United States: New result from recognition task Segment confidence: 0.925 Segment confidence: 0.929 Segment confidence: 0.929 Segment confidence: 0.931 Segment confidence: 0.922
1
0
1.1k
Nov ’22
iOS 16 Text-To-Speech Crash
My app uses text to speech and i am getting crashes on a daily basis by users using iOS 16. The app has never had such issues before iOS16. Crashed: com.apple.TextToSpeech.SpeechThread EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x0000000ffd6be900 0 libobjc.A.dylib objc_release + 16 1 libobjc.A.dylib objc_release_x0 + 16 2 libobjc.A.dylib AutoreleasePoolPage::releaseUntil(objc_object**) + 196 3 libobjc.A.dylib objc_autoreleasePoolPop + 256 4 libobjc.A.dylib objc_tls_direct_base<AutoreleasePoolPage*, (tls_key)3, AutoreleasePoolPage::HotPageDealloc>::dtor_(void*) + 168 5 libsystem_pthread.dylib _pthread_tsd_cleanup + 620 6 libsystem_pthread.dylib _pthread_exit + 84 7 libsystem_pthread.dylib _pthread_start + 160 8 libsystem_pthread.dylib thread_start + 8
1
1
1.6k
Nov ’22
Critical BUG! Could you fix it asap or at least set the try/catch block with the reporting via NSError or somehow else?
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
4
0
1.3k
Nov ’22
Question: How to stop a sound that has lost control (AVSpeechSynthesizer)
I'm struggling with a recent bug in iOS 16. There are various errors and bugs Currently struggling with AVSpeechSynthesizer. AutoReleasePool crashes frequently. I also posted a similar post on the forum before. https://developer.apple.com/forums/tags/speech There seems to be a lot of similar cases in the forum posts above. When AVSpeechSynthesizer is stopped, it does not stop immediately, but continues to play to the end. In that situation, even if you stop again, you lose control and cannot stop. Is there any way to stop the currently playing sound at will when I lose control like this? (I was also able to confirm that the error persisted without being fixed when I tested it on a device that just installed the 16.2 beta.)
2
0
1k
Nov ’22
Build a virtual keyboard that dictate Cantonese continuously without stopping
I feel the need to have a virtual keyboard that dictate Cantonese continuously until manually stopping it, instead of automatically stopping itself every 1 minute. So is it possible to build a keyboard like the in-built one in iPhone 6s, with a dictate microphone icon? And if there any existing codes that can be reused and easily making modification to it so that it can run without stopping itself? Thanks
0
0
735
Oct ’22
Web Speech API bugs in iOS 15.1 and macOS Monterey
Hi, I've been working on a project that utilizes the Web Speech API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API. However, I've noticed some strange behavior in the newest versions of Safari on iOS, iPadOS, and macOS. One issue that occurs regularly is that the text input will repeat after voice input has ended. This can be seen on this demo provided by Google: https://www.google.com/intl/en/chrome/demos/speech.html This was not happening when I tested on 14.1 (the version I upgraded from). Upon debugging, it appears the doubling of text is included in transcriptions that are not flagged as isFinal, as well as transcriptions that are, which makes me think that something isn't working properly in the implementation of the API. Anecdotally, the speech synthesis appears to be much less accurate now as well, and I've noticed some odd behavior when I set the continuous flag to false as well. The API delegates the actual speech synthesis work to Siri, so I'm wondering why there would be a different here compared to using dictation in other apps. My main question is: has anyone else run into problems like this? If so, how are you working around them?
5
2
6.3k
Oct ’22
XCode 14 & iOS 16 Beta: No AVSpeechSynthesisVoice.speechVoices available
I'm testing my App in the Xcode 14 beta (released with WWDC22) on iOS 16, and it seems that AVSpeechSynthesisVoice is not working correctly. The following code always returns an empty array: AVSpeechSynthesisVoice.speechVoices() Additionally, attempting to initialize AVSpeechSynthesisVoice returns nil for all of the following: AVSpeechSynthesisVoice(language: AVSpeechSynthesisVoice.currentLanguageCode()) AVSpeechSynthesisVoice(language: "en") AVSpeechSynthesisVoice(language: "en-US") AVSpeechSynthesisVoice(identifier: AVSpeechSynthesisVoiceIdentifierAlex) AVSpeechSynthesisVoice.speechVoices().first
Replies
15
Boosts
3
Views
5.1k
Activity
Feb ’23
Can't hear audio in VoIP call when i grant media permission to webView
VoIP call works perfectly fine at start until i grant access to WKWebView media(microphone access). I am using WKWebView to highlight the spoken word using web speech engine. If i use webView i can't hear VoIP call audio and if i stop webView VoIP call works perfectly fine. What i want to achieve is to stay in VoIP call as well as work with webView to highlight the spoken words and I want to know if there is any problem in giving microphone access to VoIP as well as WKWebView simultaneously. Please post your question if i am not clear about anything or you want to know more information.
Replies
0
Boosts
0
Views
637
Activity
Feb ’23
iOS 16 TTS is horrible, it doesn’t work!
iOS 15 Siri voices worked perfectly. However, iOS 16 has a lot of issues - such as skipping words and sentences, and stopping reading all together. Obviously, this is a problem with the TTS I myself use Siri to read books while driving, but I regret updating to iOS 16. I went as far as upgrading my iPhone SE to my iPhone 14 Pro thinking it was the memory issue, but it's the same issue on both phones even my Mac M1 Pro with 16Gigs has same issues. https://youtu.be/g58nbW4J0DY It would be nice to receive and update or even a roll back to iOS 15 state of TTS
Replies
3
Boosts
1
Views
2.7k
Activity
Jan ’23
Switch voice on AVSpeechSynthesizer is causing "[AXTTSCommon] Invalid rule"
Simplifying, if I implement a code like the following let utterance = AVSpeechUtterance(string: "Hello world.") utterance.voice = AVSpeechSynthesisVoice(language: "en-GB") self.synthesizer.speak(utterance) let utterance = AVSpeechUtterance(string: "Hola mundo.") utterance.voice = AVSpeechSynthesisVoice(language: "es-ES") self.synthesizer.speak(utterance) After the second speak, I get the following error messages from the console [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(1\/2\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "M_FRACTION_OF_$1 EXPANSION_SG_OF_$2" # 1/2 mm --> medio milímetro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "M_FRACTION_OF_$1 de EXPANSION_SG_OF_$2" # 1/4 km² --> un cuarto de kilómetro cuadrado" [AXTTSCommon] Invalid rule: /(?<=\d\s)(\d\/\d\s?)(mm|cm|m|m²|m2|m³|m3|km|km²|km2|km³|km3|mg|g|kg|l|ml)\b/i --> "$2 y M_FRACTION_OF_$1" # 1/6m --> un sexto de metro [AXTTSCommon] Invalid rule: /(1\/2\s)(milímetro|centímetro|metro|metro cuadrado|metro cúbico|kilómetro|kilómetro cuadrado|kilómetro cúbico|miligramo|gramo|kilo|kilogramo|mililitro|litro)\b/i --> "M_FRACTION_OF_$1 $2" # 1/2 milímetro --> medio milímetro [AXTTSCommon] Invalid rule: /(milímetros?|centímetros?|metros?|metros? cuadrados?|metros? cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\sy?\s?(1\/2)\b/i --> "$1 y M_FRACTION_OF_$2" # 3 metros y 1/2 --> tres metros y medio [AXTTSCommon] Invalid rule: /M_FRACTION_OF_1\/2/ --> "medio" # 1/2 m --> medio metro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s?)(milímetros?|centímetros?|metros?|metros? cuadrados?|metros? cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramoS?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b/i --> "M_FRACTION_OF_$1 de $2" # 1/4 kilómetro --> un cuarto de kilómetro [AXTTSCommon] Invalid rule: /(?<=\d\s)(\d\/\d\s?)(milímetros?|centímetros?|metros?|metros? cuadrados?|metro cúbicos?|kilómetros?|kilómetros? cuadrados?|kilómetros? cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b/i --> "$2 y M_FRACTION_OF_$1" # 2 1/4 kilómetros --> dos kilómetros y un cuarto [AXTTSCommon] Invalid rule: /(milímetros?|centímetros?|metros?|metro cuadrados?|metro cúbicos?|kilómetros?|kilómetro cuadrados?|kilómetro cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\sy?\s?(\d\/\d\s?)/ --> "$1 y M_FRACTION_OF_$2" # 2 milímetros y 1/2 --> dos milímetros y medio [AXTTSCommon] Invalid rule: /M_FRACTION_OF_(\d\/\d)/ --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 --> un cuarto [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)(?=de (pan|masa|taza|hora)\b)/i --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 de pan --> un cuarto de pan [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)(?=de (milímetros?|centímetros?|metros?|metro cuadrados?|metro cúbicos?|kilómetros?|kilómetro cuadrados?|kilómetro cúbicos?|miligramos?|gramos?|kilos?|kilogramos?|mililitros?|litros?)\b)/i --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # 1/4 de metro --> un cuarto de metro [AXTTSCommon] Invalid rule: /(?<!\d|\d\s)(\d\/\d\s)/ --> "\e\\tn=fraction\\$1\e\\tn=normal\\" # catch-all rule for fractions, to avoid "1/4" --> "uno cuatro" The final behavior is correct, the expression is reproduced despite de console messages. However, after approximately 400 iterations the application consumes all memory resources in processes related to AXTTSCommon and Regex.
Replies
4
Boosts
0
Views
2.1k
Activity
Jan ’23
Web Speech Synthesis API: not all voices installed listed
I'm developing an application using the Web Speech API for speech synthesis. According to the API specification SpeechSynthesis.getVoices() should retrieve the voices available on the system. On my iPad Pro, 12,9 inch, 3rd generation, iOS 16 however this doesn't return all voices installed on the system. In system settings (Accessibility -> Spoken content -> Voices -> German) e.g. I see these voices: Anna Eloquence Markus Petra Siri Viktor Yannick However if for SpeechSynthesis.getVoices() I only get the voices within the group "Eloquence": Eddy Flo Grandma Grandpa Reed Rocko Sandy Shelley All other voices (Anna, Markus, etc.) are missing. Is this a bug or is it intended by Apple that it's impossible to use all voices? This is independent of the browser, it's the same for Safari, Chrome or Firefox. Use this in order to test which voices are available using the WebSpeech API: https://plnkr.co/edit/E2etsrUZVOVfrDwG
Replies
7
Boosts
6
Views
3.7k
Activity
Jan ’23
Is Speech Framework is available for Apple Tv
We are not able to find speech framework for apple tv. we have to implement Speech to Text in our application. When we are import speech framework in Apple Tv we get Error Like (No such module 'Speech' Please provide solution for this. )
Replies
0
Boosts
0
Views
1.2k
Activity
Jan ’23
Same file, but length becomes zero when put in a different directory
I'm trying to read an AVAudioFile into a buffer. I found that when the directory is /Users/myusername/Library/Developer/CoreSimulator/Devices/112C1F73-326A-408F-B9CA-2DE6739D60F4/data/Containers/Data/Application/F98B01D3-8136-4188-8589-0E40E8C96559/Documents/rawAudioData/0_rawAudio.wav the length becomes zero. But when I move the same file to /Users/myusername/Downloads/swiftApps/0_rawAudio.wav the length and becomes normal again. I checked that the file is reachable phonebook directories. So why is this happening? Thanks!
Replies
0
Boosts
0
Views
747
Activity
Dec ’22
Crash: SLDictLookup::Create unable to handle this locale.
My app uses AVSpeechSynthesizer.And when I setup russian language in settings like main language and use voice with identifier which contain com.apple.speech.synthesis.voice, i catch crash Crash: SLDictLookup::Create unable to handle this locale.
Replies
1
Boosts
0
Views
884
Activity
Dec ’22
How to make speech recognition more accurate?
Hi, I'm using the Speech library to get speech recognition from AVAudioRecorder and store the text to database. However, most of the time it is not accurate. Heck, even "test 123" gave me entirely different words (eg. "this one till three", "this one ticket", etc). The funny thing was, it was correct a few times when it was still progressing, but then it changed into the wrong final words. So, how do I increase the accuracy of it? This is what I got as the settings:           try audioSession.setCategory(.record, mode: .spokenAudio, options: .duckOthers)          try audioSession.setActive(true, options: .notifyOthersOnDeactivation)      let recorderSettings: [String:Any] = [       AVFormatIDKey: NSNumber(value: kAudioFormatAppleLossless),        AVSampleRateKey: 44100.0,        AVNumberOfChannelsKey: 1,        AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue     ] Is there anything else to improve? Thank you.
Replies
0
Boosts
0
Views
1k
Activity
Dec ’22
Why can't I get more info on why SFSpeechRecognizer won't read my recorded audio files?
Updated info below Full disclosure: I do have this question over on StackOverflow, but I am at a standstill till I find a way to move forward, debug, etc. I am trying to recognize prerecorded speech in Swift. Essentially it either detects no speech, detects blank speech, or works on the one prerecorded file where I screamed a few words. I can't tell where the headache lies and can't figure out if there's a more detailed way to debug this. I can't find any properties that give more detailed info. Someone on SO did recommend I go through Apple's demo, here. This works just fine, and my code is very similar to it. Yet the main difference remains if there is something about the way I save my audio files or something else is leading to my headaches. If anyone has any insight into this I would very much appreciate any hints. My question over on StackOverflow Updated info below, and new code Updated info It appears that I was calling SFSpeechURLRecognitionRequest too often, and before I completed the first request. Perhaps I need to create a new instance of SFSpeechRecognizer? Unsure. Regardless, I quickly/sloppily adjusted the code to only run it once the previous instance returned its results. The results were much better, except one audio file still came up as no results. Not an error, just no text. This file is the same as the previous file, in that I took an audio recording and split it in two. So the formats and volumes are the same. So I still need a better way to debug this, to find out what it going wrong with that file. The code where I grab the file and attempt to read it func findAudioFiles(){ let fm = FileManager.default var aFiles : URL print ("\(urlPath)") do { let items = try fm.contentsOfDirectory(atPath: documentsPath) let filteredInterestArray1 = items.filter({$0.hasSuffix(".m4a")}) let filteredInterestArray2 = filteredInterestArray1.filter({$0.contains("SS-X-")}) let sortedItems = filteredInterestArray2.sorted() for item in sortedItems { audioFiles.append(item) } NotificationCenter.default.post(name: Notification.Name("goAndRead"), object: nil, userInfo: myDic) } catch { print ("\(error)") } } @objc func goAndRead(){ audioIndex += 1 if audioIndex != audioFiles.count { let fileURL = NSURL.fileURL(withPath: documentsPath + "/" + audioFiles[audioIndex], isDirectory: false) transcribeAudio(url: fileURL, item: audioFiles[audioIndex]) } } func requestTranscribePermissions() { SFSpeechRecognizer.requestAuthorization { [unowned self] authStatus in DispatchQueue.main.async { if authStatus == .authorized { print("Good to go!") } else { print("Transcription permission was declined.") } } } } func transcribeAudio(url: URL, item: String) { guard let recognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US")) else {return} let request = SFSpeechURLRecognitionRequest(url: url) if !recognizer.supportsOnDeviceRecognition { print ("offline not available") ; return } if !recognizer.isAvailable { print ("not available") ; return } request.requiresOnDeviceRecognition = true request.shouldReportPartialResults = true recognizer.recognitionTask(with: request) {(result, error) in guard let result = result else { print("\(item) : There was an error: \(error.debugDescription)") return } if result.isFinal { print("\(item) : \(result.bestTranscription.formattedString)") NotificationCenter.default.post(name: Notification.Name("goAndRead"), object: nil, userInfo: self.myDic) } } }
Replies
0
Boosts
0
Views
973
Activity
Dec ’22
SFTranscriptionSegment confidence is always 0 for Saudi Arabia, but ok for USA
Hello, I have SFSpeechRecognizer initialised with Locale(identifier: "en-US") After setting Region (on phone settings) to one of these countries: Saudi Arabia United Arab Emirates Malaysia SFTranscriptionSegment always have confidence 0. Setting Region back to United States (or Russia) makes confidence correct (non-zero value). This issue is 100% reproducible on Simulator &amp; Device with SpeakToMe sample App by Apple https://developer.apple.com/library/archive/samplecode/SpeakToMe/Introduction/Intro.html I'm adopted it to Swift 5 and added logging. Modified Sample project's ViewController.swift is attached. ViewController.swift - https://developer.apple.com/forums/content/attachment/8695df58-1a4a-4e14-8c1b-4b052d437f68 To reproduce: Tap "Start recording" Say "My name is Max" Tap "Stop recording" Last output for Saudi Arabia: New result from recognition task Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Segment confidence: 0.0 Last output for United States: New result from recognition task Segment confidence: 0.925 Segment confidence: 0.929 Segment confidence: 0.929 Segment confidence: 0.931 Segment confidence: 0.922
Replies
1
Boosts
0
Views
1.1k
Activity
Nov ’22
SFSpeechURLRecognitionRequest error couldn’t be opened because you don’t have permission to view it.
I get that this "file couldn’t be opened because you don’t have permission to view it." error when I try and transcribe audio using a URL What could be the issue?
Replies
0
Boosts
0
Views
617
Activity
Nov ’22
iOS 16 Text-To-Speech Crash
My app uses text to speech and i am getting crashes on a daily basis by users using iOS 16. The app has never had such issues before iOS16. Crashed: com.apple.TextToSpeech.SpeechThread EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x0000000ffd6be900 0 libobjc.A.dylib objc_release + 16 1 libobjc.A.dylib objc_release_x0 + 16 2 libobjc.A.dylib AutoreleasePoolPage::releaseUntil(objc_object**) + 196 3 libobjc.A.dylib objc_autoreleasePoolPop + 256 4 libobjc.A.dylib objc_tls_direct_base<AutoreleasePoolPage*, (tls_key)3, AutoreleasePoolPage::HotPageDealloc>::dtor_(void*) + 168 5 libsystem_pthread.dylib _pthread_tsd_cleanup + 620 6 libsystem_pthread.dylib _pthread_exit + 84 7 libsystem_pthread.dylib _pthread_start + 160 8 libsystem_pthread.dylib thread_start + 8
Replies
1
Boosts
1
Views
1.6k
Activity
Nov ’22
Critical BUG! Could you fix it asap or at least set the try/catch block with the reporting via NSError or somehow else?
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
Replies
4
Boosts
0
Views
1.3k
Activity
Nov ’22
Question: How to stop a sound that has lost control (AVSpeechSynthesizer)
I'm struggling with a recent bug in iOS 16. There are various errors and bugs Currently struggling with AVSpeechSynthesizer. AutoReleasePool crashes frequently. I also posted a similar post on the forum before. https://developer.apple.com/forums/tags/speech There seems to be a lot of similar cases in the forum posts above. When AVSpeechSynthesizer is stopped, it does not stop immediately, but continues to play to the end. In that situation, even if you stop again, you lose control and cannot stop. Is there any way to stop the currently playing sound at will when I lose control like this? (I was also able to confirm that the error persisted without being fixed when I tested it on a device that just installed the 16.2 beta.)
Replies
2
Boosts
0
Views
1k
Activity
Nov ’22
speech recognition
speech recognition stop listing to voice
Replies
1
Boosts
0
Views
859
Activity
Oct ’22
Build a virtual keyboard that dictate Cantonese continuously without stopping
I feel the need to have a virtual keyboard that dictate Cantonese continuously until manually stopping it, instead of automatically stopping itself every 1 minute. So is it possible to build a keyboard like the in-built one in iPhone 6s, with a dictate microphone icon? And if there any existing codes that can be reused and easily making modification to it so that it can run without stopping itself? Thanks
Replies
0
Boosts
0
Views
735
Activity
Oct ’22
Web Speech API bugs in iOS 15.1 and macOS Monterey
Hi, I've been working on a project that utilizes the Web Speech API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API. However, I've noticed some strange behavior in the newest versions of Safari on iOS, iPadOS, and macOS. One issue that occurs regularly is that the text input will repeat after voice input has ended. This can be seen on this demo provided by Google: https://www.google.com/intl/en/chrome/demos/speech.html This was not happening when I tested on 14.1 (the version I upgraded from). Upon debugging, it appears the doubling of text is included in transcriptions that are not flagged as isFinal, as well as transcriptions that are, which makes me think that something isn't working properly in the implementation of the API. Anecdotally, the speech synthesis appears to be much less accurate now as well, and I've noticed some odd behavior when I set the continuous flag to false as well. The API delegates the actual speech synthesis work to Siri, so I'm wondering why there would be a different here compared to using dictation in other apps. My main question is: has anyone else run into problems like this? If so, how are you working around them?
Replies
5
Boosts
2
Views
6.3k
Activity
Oct ’22
Why SFSpeechRecognizer.supportsOnDeviceRecognition is writable?
Why supportsOnDeviceRecognition option of SFSpeechRecognizer object is writable? Does it make any sense to set it to true? What will happen?
Replies
0
Boosts
0
Views
536
Activity
Sep ’22
AVSpeechSynthesizer privacy question
Hello! I have a question about AVSpeechSynthesizer relating to privacy. I'm wondering if the processing that happens in AVSpeechSynthesizer is local to the app I'm building or some part of the audio/text is shared with Apple in order to improve the service or for some other purpose.
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’22