jjzjj

avspeechutterance

全部标签

ios - Apple Watch/WatchKit 语音合成器

有谁知道是否可以访问AppleWatch的内置语音合成器?对于我的iOS主应用程序,我使用了AVSpeechSynthesizer,如下所示:AVSpeechUtterance*utterance=[[AVSpeechUtterancealloc]initWithString:theSpeech];utterance.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@"en-GB"];这很完美,但相同的代码在WatchKit扩展中不起作用。 最佳答案 根据developmentforum

ios - 在 Swift 中检测来自 AVSpeech 和 AVUtterance 的正在进行的语音

我知道你可以使用委托(delegate)方法来判断AV语音何时结束extensionMyViewController:AVSpeechSynthesizerDelegate{funcspeechSynthesizer(synthesizer:AVSpeechSynthesizer,didFinishSpeechUtteranceutterance:AVSpeechUtterance){print("speechfinished")}}但您如何判断语音是否正在进行且尚未结束?现在,我开始演讲voice.speak(utt)//dosomething我想在对方说话时在结束之前做点什么。仅仅

ios - AVSpeechSynthesizer 错误 : An AVSpeechUtterance shall not be enqueued twice

我有点卡住了。这是我的代码:letspeaker=AVSpeechSynthesizer()varplayQueue=[AVSpeechUtterance]()//currentqueuevarbackedQueue=[AVSpeechUtterance]()//queuebackup...funcmoveBackward(_currentUtterance:AVSpeechUtterance){speaker.stopSpeaking(at:.immediate)letcurrentIndex=getCurrentIndexOfText(currentUtterance)//outo

ios - 在 Swift 的 AVSpeech 和 AVSpeechUtterance 中强制自定义单词发音

为了使用AVSpeechUtterance说出数字,我希望Siri以符合数字类型约定的方式说出数字。对于日期,我希望它把1492读成十四九十二,而不是一千、四百、九十二。对于电话号码650-412-3456,我想说六五哦,四一二三四五六,而不是六百五十四百一十二三四百五十六。是否有使用AVSpeech和AVUtterance指定发音的方法?thedocs中似乎没有任何明显的东西。 最佳答案 虽然不是AV设置,但为说话者解析短语会得到预期的结果。例如,使用下面的扩展:letnumber="1492"letphrase=number.s

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

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

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 - 在 didReceiveRemoteNotification 中播放声音,同时在后台使用文本到语音功能

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

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

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

swift - AVSpeechUtterance - Swift - 用短语初始化

所以我只是想在Swift中使用AVSpeechSynthesizer。我不知道如何为AVSpeechUtterance设置短语。@IBActionfuncbuttonSpeakClicked(sender:UIButton){varmySpeechSynthesizer:AVSpeechSynthesizer=AVSpeechSynthesizer()varmyString:String="Thisisthephrasetosay"varmySpeechUtterance:AVSpeechUtterance=AVSpeechUtterance(string:myString)print