草庐IT

AVSpeechSynthesizer

全部标签

iOS:AVSpeechSynthesizer:需要在耳机左声道中朗读文本

我正在为TextToSpeech使用AVSpeechSynthesizer。我必须在HeadPhone左声道(Mono2)中播放讲话。我有以下设置输出channel。funcinitalizeSpeechForRightChannel(){letavSession=AVAudioSession.sharedInstance()letroute=avSession.currentRouteletoutputPorts=route.outputsvarchannels:[AVAudioSessionChannelDescription]=[]//NSMutableArray*channel

ios - 如何在 Swift 中的 while 循环的每次迭代中立即发出语音?

这是我的Playground代码:importAVFoundationvarspeechsynth:AVSpeechSynthesizer=AVSpeechSynthesizer()letwordsToSpeak=["wordone","wordtwo","wordthree","wordfour"]letendTime=NSDate().dateByAddingTimeInterval(10)whileendTime.timeIntervalSinceNow>0{//workaroundforiOS8BugvarbeforeSpeechString:String=""varbefor

ios - 如何快速向 iOS 应用程序添加/更改语音性别?我正在使用 AVSpeechSynthesisvoice 类来获取语音

我使用AVSpeechSynthesizer创建了一个具有语音功能的应用,并在TableView中显示来自AVSpeechSynthesisVoice:speechVoices()函数的语言列表。用户可以从TableView中选择语音语言。我想要实现的下一件事是添加语音性别,以便用户可以在默认的男或女声音之间切换,就像在Siri中一样应用程序。我不想让它变得复杂,所以只是寻找默认的男声或女声。从speechVoices()返回的声音具有特定于每个声音的默认男声或女声。我能改变它吗?我在应用程序设置页面上放置了一个UIPickerView以在男声和女声之间进行选择。但是,我做了一些研究,

ios - AVSpeechUtterance 静音模式下的发音

我正在使用AVSpeechUtterance来朗读给定的文本。我正在使用下面的代码,并且在“iPhone铃声模式”下工作正常,但是当我将iPhone更改为“静音模式”时,话语声音变得静音。当它是“静音模式”时,我听不到说话的声音。我应该怎么做才能听到“静音模式”中的语音。AVSpeechUtterance*utterance=[[AVSpeechUtterancealloc]initWithString:@"HelloWorld"];utterance.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@"en-US"];[utterance

ios - AVSpeechUtterance 静音模式下的发音

我正在使用AVSpeechUtterance来朗读给定的文本。我正在使用下面的代码,并且在“iPhone铃声模式”下工作正常,但是当我将iPhone更改为“静音模式”时,话语声音变得静音。当它是“静音模式”时,我听不到说话的声音。我应该怎么做才能听到“静音模式”中的语音。AVSpeechUtterance*utterance=[[AVSpeechUtterancealloc]initWithString:@"HelloWorld"];utterance.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@"en-US"];[utterance

ios - iOS 7.0 中的 AVSpeechSynthesizer 有美国男声吗?

解决方案:它没有美国男声我使用AVSpeechSynthesizerframeworkforiOS7.0AVSpeechUtterance*utt=[AVSpeechUtterancespeechUtteranceWithString:@"Hello"];if(isMale)//flagformaleorfemalevoiceselected{//needUSmalevoiceasen-USisprovidingonlyUSfemalevoiceutt.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@"en-GB"];//UKmalevo

ios - iOS 7.0 中的 AVSpeechSynthesizer 有美国男声吗?

解决方案:它没有美国男声我使用AVSpeechSynthesizerframeworkforiOS7.0AVSpeechUtterance*utt=[AVSpeechUtterancespeechUtteranceWithString:@"Hello"];if(isMale)//flagformaleorfemalevoiceselected{//needUSmalevoiceasen-USisprovidingonlyUSfemalevoiceutt.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@"en-GB"];//UKmalevo

ios - 在 didReceiveRemoteNotification 中播放声音,同时在后台使用文本到语音功能

我目前正在尝试的是当应用程序在后台收到远程通知时播放消息(或者可能从挂起状态唤醒)。应用程序从挂起模式唤醒后根本不播放声音。当应用程序在前台时,在调用didReceiveRemoteNotification:方法后立即播放声音。当应用程序从挂起模式唤醒时调用didReceiveRemoteNotification:方法时,立即播放声音的合适方法是什么?这是一些代码(语音管理器类):-(void)textToSpeechWithMessage:(NSString*)messageandLanguageCode:(NSString*)languageCode{AVAudioSession*

ios - 在 didReceiveRemoteNotification 中播放声音,同时在后台使用文本到语音功能

我目前正在尝试的是当应用程序在后台收到远程通知时播放消息(或者可能从挂起状态唤醒)。应用程序从挂起模式唤醒后根本不播放声音。当应用程序在前台时,在调用didReceiveRemoteNotification:方法后立即播放声音。当应用程序从挂起模式唤醒时调用didReceiveRemoteNotification:方法时,立即播放声音的合适方法是什么?这是一些代码(语音管理器类):-(void)textToSpeechWithMessage:(NSString*)messageandLanguageCode:(NSString*)languageCode{AVAudioSession*

ios - iOS 是否提供内置的文本到语音支持或任何类似 NSSpeechRecognizer 的类?

我发现了很多库,比如flite可以使用,如给定here,但我想知道iOSSDK是否提供了类似于OSX中提供的NSSpeechRecognizer的内置类。 最佳答案 iOS5或6中没有内置的文本转语音支持-您需要使用第三方库。如果您使用的是iOS7,那么您很幸运。iOS7中有一个名为AVSpeechSynthesizer的新类(Apple'sdocscanbefoundhere)。您可以使用它来执行文本到语音转换。这是一个简单的例子:AVSpeechUtterance*utterance=[AVSpeechUtterancespee