avspeechsynthesizer

IOS Swift : UIAccessibilitySpeechAttributeIPANotation

可紊 提交于 2019-12-02 12:57:51
问题 I am trying to make my app to speak in the IPANotation using AVSpeechSynthesizer , but it not working below is my code snippet, let synthesizer = AVSpeechSynthesizer() let attributedStr = NSMutableAttributedString(string: "Hello iPhone") attributedStr.addAttribute(NSAttributedString.Key(UIAccessibilitySpeechAttributeIPANotation), value: "ˈa͡ɪ.ˈfo͡ʊn", range: NSRange(location: 6, length: 6)) let utterance = AVSpeechUtterance(attributedString: attributedString) synthesizer.speak(utterence)

IOS Swift : UIAccessibilitySpeechAttributeIPANotation

筅森魡賤 提交于 2019-12-02 05:55:42
I am trying to make my app to speak in the IPANotation using AVSpeechSynthesizer , but it not working below is my code snippet, let synthesizer = AVSpeechSynthesizer() let attributedStr = NSMutableAttributedString(string: "Hello iPhone") attributedStr.addAttribute(NSAttributedString.Key(UIAccessibilitySpeechAttributeIPANotation), value: "ˈa͡ɪ.ˈfo͡ʊn", range: NSRange(location: 6, length: 6)) let utterance = AVSpeechUtterance(attributedString: attributedString) synthesizer.speak(utterence) Thanks Try the code snippet hereafter (iOS 12 - Swift 5.0) : let attrStr = NSMutableAttributedString(string

is it possible to change the pitch of the voice in AVSpeechSynthesizer's voice?

拜拜、爱过 提交于 2019-12-02 01:52:44
Can I change the pitch of the voice in AVSpeechSynthesizer or putting any effects on the output voice from it so it could sound differently? Yes, you can change the pitch and the rate of the spoken sentence. The AVSpeechUtterance class has two relevant properties: pitchMultiplier: Float (value between 0.5 (lowest pitch) to 2.0 (highest pitch)). The default pitch is 1.0 . rate: Float (value between two constants: AVSpeechUtteranceMinimumSpeechRate (the slowest rate of speech) and AVSpeechUtteranceMaximumSpeechRate (the highest rate of speech). When you create your AVSpeechUtterance , simply set

AVSpeechSynthesizer works on simulator but not on device

江枫思渺然 提交于 2019-12-01 18:00:54
问题 I've been trying to learn AVSpeechSynthesis. The code works fine in the iOS Simulator (both on iPad and iOS) but the text to speech feature doesn't work at all on my iPad. Here's my code. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //Load Model self.string = @"Hello World"; self.utterance = [[AVSpeechUtterance alloc] initWithString:self.string]; self.utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];

AVSpeechSynthesizer works on simulator but not on device

僤鯓⒐⒋嵵緔 提交于 2019-12-01 17:54:46
I've been trying to learn AVSpeechSynthesis. The code works fine in the iOS Simulator (both on iPad and iOS) but the text to speech feature doesn't work at all on my iPad. Here's my code. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //Load Model self.string = @"Hello World"; self.utterance = [[AVSpeechUtterance alloc] initWithString:self.string]; self.utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; self.utterance.rate = (float) 0.25; //Load UI self.textLabel.text = self.string; } - (IBAction

iOS 13 Text To Speech (TTS - AVSpeechSynthesisVoice) crashes for some users after update

你。 提交于 2019-12-01 06:34:54
问题 We are seeing a weird crashes for a small percentage of users related to a problem of TTS after updating to iOS 13. Anybody any idea why this happens? Anybody seeing the same crashes? let voices = AVSpeechSynthesisVoice.speechVoices() for voice in voices { if voice.name == storedName { synthVoice = voice break } } ... let utterance = AVSpeechUtterance(string: text) utterance.voice = self.synthVoice self.synthesizer.speak(utterance) Crashlog: Error: Fatal Exception: std::logic_error: Unable to

AVSpeechSynthesizer utterance to audio file

橙三吉。 提交于 2019-11-30 11:24:05
I'm using AVSpeechSynthesizer in my app and I'm looking to save the spoken text to an audio file or AVAsset. I went through Apple's docs and didn't see anything but figured I'd post a question to make sure. Below is my current code. AVSpeechUtterance * utterance = [AVSpeechUtterance speechUtteranceWithString:textView.text]; float rate = [speedSlider value]/1.5; utterance.rate = rate; [speechSynthesizer speakUtterance:utterance]; It is possible to record audio generated by your app (not from other apps). Although AVSpeech does not provide an API to save the generated audio, Apple has other APIs

AVSpeechSynthesizer output as file?

余生颓废 提交于 2019-11-29 14:03:23
AVSpeechSynthesizer has a fairly simple API, which doesn't have support for saving to an audio file built-in. I'm wondering if there's a way around this - perhaps recording the output as it's played silently, for playback later? Or something more efficient. As of now AVSpeechSynthesizer does not support this . There in no way get the audio file using AVSpeechSynthesizer . I tried this few weeks ago for one of my apps and found out that it is not possible , Also nothing has changed for AVSpeechSynthesizer in iOS 8. I too thought of recording the sound as it is being played , but there are so

AVSpeechSynthesizer output as file?

心不动则不痛 提交于 2019-11-28 04:13:44
问题 AVSpeechSynthesizer has a fairly simple API, which doesn't have support for saving to an audio file built-in. I'm wondering if there's a way around this - perhaps recording the output as it's played silently, for playback later? Or something more efficient. 回答1: As of now AVSpeechSynthesizer does not support this . There in no way get the audio file using AVSpeechSynthesizer . I tried this few weeks ago for one of my apps and found out that it is not possible , Also nothing has changed for