avspeechsynthesizer

OBJC AVSpeechUtterance writeUtterance how?

[亡魂溺海] 提交于 2021-01-29 16:16:50
问题 I am trying to create a TTS to file in Objc. Since iOS13 can write it to a file. But I'm stuck with writeUtterance:toBufferCallback. Do someone has an exemple with this function in objc? [synth speakUtterance:utterance]; 回答1: Referring to the potential answer in Swift, this would be the Objective-C implementation AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init]; AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"test 123"]; AVSpeechSynthesisVoice

How to get difference language code for iOS 7 AVSpeechUtterance text to speech?

余生长醉 提交于 2020-04-29 08:16:38
问题 I want to use iOS 7 new speech synthezis API, and my application is localized in french & english,german,japanese,etc.i want set language code to read text.How to get language code? utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-ZA"]; 回答1: You can set one of the bellow language: for (AVSpeechSynthesisVoice *voice in [AVSpeechSynthesisVoice speechVoices]) { NSLog(@" %@", voice.language); } or use default locale: AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]

Join 2 different labels for text to speech conversion (swift3)

倖福魔咒の 提交于 2020-01-24 19:35:09
问题 Using the speech to text feature I can easily get one label to be spoken. But I want utterance2 to be joined to utterance. I want utterance to be spoken first then when it is finished for utterance2 to be spoken right after. let utterance = AVSpeechUtterance(string: dptext.text!) let utterance2 = AVSpeechUtterance(string: dptext2.text!) let synthesizer = AVSpeechSynthesizer() synthesizer.speak(utterance) 回答1: I think the simplest way to handle this situation is to combine the two string with

What are the supported languages with AVSpeechSynthesizer?

走远了吗. 提交于 2020-01-22 15:21:04
问题 AVSpeechSynthesizer seems to support english with multi delegates (britsh, us...) Does it support other languages? french, Portuguese ... is there a list of these languages somewhere ? 回答1: Yes, it does. Use speechVoices of AVSpeechSynthesisVoice to get a list of available voices with supported languages. Currently (as of 10 September 2018, on iOS 10.3.1 and 11.4.1) you'll find these: ar-SA cs-CZ da-DK de-DE el-GR en-AU en-GB en-IE en-US en-ZA es-ES es-MX fi-FI fr-CA fr-FR he-IL hi-IN hu-HU

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

末鹿安然 提交于 2020-01-11 10:27:14
问题 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? 回答1: 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

AVSpeechSynthesizer Text-To-Speech

ε祈祈猫儿з 提交于 2020-01-06 03:59:05
问题 AVSpeechsynthesizer with the en-us voice is pronunciation for "A" is "Capital A" but Just want "A" How can do that? 回答1: This only happens when there is single character in the string, you can use this workaround of checking if lenght of string is 1 than convert it to lowercase string, NSString *stringToUtter = @"A"; if (stringToUtter.length==1) { stringToUtter = [stringToUtter lowercaseString]; } AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:stringToUtter];

Any way to control which audio channel AVSpeechSynthesizer outputs to?

穿精又带淫゛_ 提交于 2020-01-03 16:36:51
问题 I would like to use AVSpeechSynthesizer to output sound on only one audio channel of a multi-channel surround sound setup. For example, in a 5.1 system, I would like it to output on just the right-surround channel. Right now I have: let synthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "This is the right channel") synthesizer.speakUtterance(utterance) ...however it outputs on both the left and right channels. 来源: https://stackoverflow.com/questions/32558183/any-way

Any way to control which audio channel AVSpeechSynthesizer outputs to?

亡梦爱人 提交于 2020-01-03 16:36:10
问题 I would like to use AVSpeechSynthesizer to output sound on only one audio channel of a multi-channel surround sound setup. For example, in a 5.1 system, I would like it to output on just the right-surround channel. Right now I have: let synthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "This is the right channel") synthesizer.speakUtterance(utterance) ...however it outputs on both the left and right channels. 来源: https://stackoverflow.com/questions/32558183/any-way

How to covert text of 'words per minute' to speech rate using AVSpeechUtterance in iOS 7

妖精的绣舞 提交于 2019-12-25 03:06:56
问题 I want to convert "words per minute" to speech rate of AVSpeechUtterance . How can I do this? And can I get total time length of text using speech rate? My code: - (AVSpeechUtterance*)convertTextToSpeak:(NSString*)textToSpeak { AVSpeechUtterance *speechUtterance = [[AVSpeechUtterance alloc] initWithString:textToSpeak]; speechUtterance.rate = 0.2; // default = 0.5 ; min = 0.0 ; max = 1.0 speechUtterance.pitchMultiplier = 1.0; // default = 1.0 ; range of 0.5 - 2.0 speechUtterance.voice = [self

Text to speech conversion in Swift 4

依然范特西╮ 提交于 2019-12-24 06:49:41
问题 I'm trying to integrate text to speech functionality in my iOS app. For this I'm using AVSpeechUtterance and AVSpeechSynthesisVoice classes of AVFoundation framework. extension String { func speech(with pronunciation: String) { let utterance = AVSpeechUtterance(attributedString: NSAttributedString(string: self, attributes: [.accessibilitySpeechIPANotation : pronunciation])) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") let synth = AVSpeechSynthesizer() DispatchQueue.main.async {