avspeechsynthesizer

iOS text to speech: What decides the default voice returned by [AVSpeechSynthesisVoice voiceWithLanguage]?

谁说胖子不能爱 提交于 2019-12-05 01:28:47
问题 AVSpeechSynthesisVoice.voiceWithLanguage has been introduced in iOS SDK 7.0. At that time, there is only one voice per language/locale. Since iOS SDK 9.0, more voices have been added for each language/locale. So Apple introduces an new API voiceWithIdentifier so you can get the specific voice you want. My question here is, what if we still use voiceWithLanguage in iOS 9 or above. What does this API exactly returns? And more importantly, does the returned voice changed between iOS versions and

AVAudioSession mixing with AVSpeechUtterance

邮差的信 提交于 2019-12-04 19:31:36
I have an issue where I would like to have the iPod playing music in the background and in my application I would like to have AVSpeechUtterance lower the volume of the iPod, play a string of text and then I would like to have the iPod resume playing. I have tried several things but never had AVAudioSession and AVSpeechUtterance work well together. I can get the iPod to stop, pause for a bit and then start playing again. I can see my string being passed to AVSpeechUtterance , but it does not take precedence to be played over the speaker. Here is my code: View did load: - (void)viewDidLoad { /

AVSpeechSynthesizer errors in iOS 10

两盒软妹~` 提交于 2019-12-04 11:50:15
I'm currently creating a text-to-speech app using AVSpeechSynthesizer() . It's working fine in iOS 9 but has the following error in iOS 10: Could not get attribute 'LocalURL': Error Domain=MobileAssetError Code=1 "Unable to copy asset attributes" UserInfo={NSDescription=Unable to copy asset attributes} Does anyone know what's going on here? static let speechSynthesizer = AVSpeechSynthesizer() static func speak(text: String) { if speechSynthesizer.isSpeaking { speechSynthesizer.continueSpeaking() } else { let speechUtterance = AVSpeechUtterance(string: text) speechUtterance.rate = 0.45 // 0.0 -

Does in iOS 7.0 AVSpeechSynthesizer have US male voice?

别来无恙 提交于 2019-12-04 10:55:37
问题 Solution : It doesnot have US male voice I have used AVSpeechSynthesizer framework for iOS7.0 AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:@"Hello"]; if (isMale) //flag for male or female voice selected { // need US male voice as en-US is providing only US female voice utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; //UK male voice } else { utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //US female voice } I need to use US male voice

iOS9 AVSpeechUtterance rate for AVSpeechSynthesizer issue

前提是你 提交于 2019-12-04 09:44:39
问题 The AVSpeechUtterance rate does not work the same for iOS 9 and prior versions of OS. Which is the change I have to make so that the sentence is spoken at the same speed. Are there any other changes I need to make for iOS9? It seems that multiplying the AVSpeechUtterance.rate by 6.0 works fine. Thank you! 回答1: I also see the change after compiling with the new XCode. Below are my mappings from old to new speed. I now have different speed assignments if device is <= iOS8 or >= iOS9. iOS 8 iOS

iOS text to speech: What decides the default voice returned by [AVSpeechSynthesisVoice voiceWithLanguage]?

故事扮演 提交于 2019-12-03 16:04:18
AVSpeechSynthesisVoice.voiceWithLanguage has been introduced in iOS SDK 7.0. At that time, there is only one voice per language/locale. Since iOS SDK 9.0, more voices have been added for each language/locale. So Apple introduces an new API voiceWithIdentifier so you can get the specific voice you want. My question here is, what if we still use voiceWithLanguage in iOS 9 or above. What does this API exactly returns? And more importantly, does the returned voice changed between iOS versions and even between different devices? I've noticed that, what voiceWithLanguage returns is kind of relying

AVSpeechSynthesizer doesn't work on iOS10

巧了我就是萌 提交于 2019-12-03 14:57:06
问题 My AVSpeechSynthesizer code is not working on device (iOS 10), but it worked on iOS 9.x and it is working now in simulator. let str = self.audioOutput //just some string here, this string exists, and it's in english let synth = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: str) utterance.rate = AVSpeechUtteranceDefaultSpeechRate let lang = "en-US" utterance.voice = AVSpeechSynthesisVoice(language: lang) synth.speakUtterance(utterance) I'm getting this error: MobileAssetError

Does in iOS 7.0 AVSpeechSynthesizer have US male voice?

*爱你&永不变心* 提交于 2019-12-03 06:04:35
Solution : It doesnot have US male voice I have used AVSpeechSynthesizer framework for iOS7.0 AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:@"Hello"]; if (isMale) //flag for male or female voice selected { // need US male voice as en-US is providing only US female voice utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; //UK male voice } else { utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //US female voice } I need to use US male voice instead of male UK voice . iOS still doesn't provide US male voice. You can find all BCP-47 code of

AVSpeechSynthesizer doesn't work on iOS10

徘徊边缘 提交于 2019-12-03 05:36:10
My AVSpeechSynthesizer code is not working on device (iOS 10), but it worked on iOS 9.x and it is working now in simulator. let str = self.audioOutput //just some string here, this string exists, and it's in english let synth = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: str) utterance.rate = AVSpeechUtteranceDefaultSpeechRate let lang = "en-US" utterance.voice = AVSpeechSynthesisVoice(language: lang) synth.speakUtterance(utterance) I'm getting this error: MobileAssetError:1] Unable to copy asset attributes Could not get attribute 'LocalURL': Error Domain=MobileAssetError

iOS9 AVSpeechUtterance rate for AVSpeechSynthesizer issue

最后都变了- 提交于 2019-12-03 03:14:19
The AVSpeechUtterance rate does not work the same for iOS 9 and prior versions of OS. Which is the change I have to make so that the sentence is spoken at the same speed. Are there any other changes I need to make for iOS9? It seems that multiplying the AVSpeechUtterance.rate by 6.0 works fine. Thank you! I also see the change after compiling with the new XCode. Below are my mappings from old to new speed. I now have different speed assignments if device is <= iOS8 or >= iOS9. iOS 8 iOS 9 Very Slow 0 0.42 Slower 0.06 0.5 My Normal 0.15 0.53 Faster 0.23 0.56 I've bumped into this issue a few