草庐IT

AVSpeechSynthesizer

全部标签

ios - 在 iOS 7 上使用 AVSpeechSynthesizer 但保留对 iOS 6 的兼容性

你好,我知道TTS仅在iOS7中可用,但我过去通过检查该类是否可用并设法保持与以前版本的兼容性而使用了很多api,但是对于AVSpeechSynthesizer它似乎不起作用,你能拜托吗帮助我在iOS7上使用TTS并通过在iOS6中禁用它来保持兼容性,非常感谢。这是我的代码,但它似乎不起作用if(([[[UIDevicecurrentDevice]systemVersion]floatValue]>=7.0)){if([AVSpeechSynthesizerclass]){AVSpeechSynthesizer*synth=[[AVSpeechSynthesizeralloc]init

ios - AVSpeechSynthesizer 代表不在 iOS 11 中调用

这是我的文本转语音代码。在iOS11以下一切正常。但在iOS11中未调用委托(delegate)方法。AVSpeechSynthesizerDelegate设置准确。(因为它在iOS11以下工作)点击按钮AVSpeechSynthesizer*synthesizer=[[AVSpeechSynthesizeralloc]init];synthesizer.delegate=self;AVSpeechUtterance*utterance=[AVSpeechUtterancespeechUtteranceWithString:stringToSpeech];[utterancesetRa

ios - AVSpeechSynthesizer 没有停止

我在我的iOS应用程序中使用AVSpeechSynthesizerforTTS。但是没有调用didFinishSpeechUtterance方法。这是我在.h中的代码:#import@interfaceEmailViewController:UIViewController@property(nonatomic,strong)AVSpeechSynthesizer*talker;这是在.m中-(void)startTalking{NSString*hi=[NSStringstringWithFormat:@"%@",humanLanguageArray[speaknumber]];AV

ios - 如何通过调用接收器扬声器播放 AVSpeechSynthesizer?

我喜欢通过调用接收器扬声器播放音频,目前我正在使用它来播放一些文本作为音频。AVSpeechUtterance*utterance=[AVSpeechUtterancespeechUtteranceWithString:_strTextCheck];AVSpeechSynthesizer*syn=[[AVSpeechSynthesizeralloc]init];[synspeakUtterance:utterance];我明白了,但这不适用于AVSpeechSynthesizer:[AVAudioSessionoverrideOutputAudioPort:AVAudioSession

ios - 带有 ios8 的 AVSpeechSynthesizer

嗨,有人在iOS8上试过AvSpeechSynthesizer吗?我在Xcode6上做了快速应用程序,但没有音频出来,我在Xcode5上运行了同样的程序并且工作顺利。示例代码来自http://nshipster.com/avspeechsynthesizer/NSString*string=@"Hello,World!";AVSpeechUtterance*utterance=[[AVSpeechUtterancealloc]initWithString:string];utterance.voice=[AVSpeechSynthesisVoicevoiceWithLanguage:@

ios - AVSpeechSynthesizer 输出为文件?

AVSpeechSynthesizer有一个相当简单的API,它不支持保存到内置的音频文件。我想知道是否有解决此问题的方法-也许在静默播放时记录输出,以便稍后播放?或者更高效的方法。 最佳答案 这终于成为可能,在iOS13中AVSpeechSynthesizer现在有write(_:toBufferCallback:):letsynthesizer=AVSpeechSynthesizer()letutterance=AVSpeechUtterance(string:"test123")utterance.voice=AVSpeech

ios - AVSpeechSynthesizer 在后台运行后停止工作

我正在单例中使用AVSpeechSynthesizer。在iOS8中,当应用程序进入后台一段时间后,当它恢复时,AVSpeechSynthesizer单例将不再说话。此问题不会发生在iOS7上。当应用进入后台时,我的日志中会显示以下消息:AVSpeechSynthesizerAudiointerruptionnotification:{AVAudioSessionInterruptionTypeKey=1;}我在单例的init方法中像这样初始化AVSpeechSynthesizer:self.speechSynthesizer=[[AVSpeechSynthesizeralloc]in

ios - AVSpeechSynthesizer 有问题,有解决方法吗?

我正在使用AVSpeechSynthesizer来播放文本。我有一系列的话语要播放。NSMutableArray*utterances=[[NSMutableArrayalloc]init];for(NSString*textintextArray){AVSpeechUtterance*welcome=[[AVSpeechUtterancealloc]initWithString:text];welcome.rate=0.25;welcome.voice=voice;welcome.pitchMultiplier=1.2;welcome.postUtteranceDelay=0.25;

ios - AVSpeechSynthesizer 不适用于印地语

导入的AVFoundation,可以很好地处理英文字符串,但不能处理印地语字符串。当我将我的iPhone语言从我不想要的设置更改为印地语时,它正在工作。如何在不将iPhone语言更改为印地语(iPhone语言为英语)的情况下使用此代码?下面是我的代码:letsynth=AVSpeechSynthesizer()varmyUtterance=AVSpeechUtterance(string:"")overridefuncviewDidLoad(){myUtterance.voice=AVSpeechSynthesisVoice(language:"hi-IN")Speak()}funcs

ios - AVSpeechSynthesizer 检测语音何时结束

我只是不知道该怎么做...我在这里和谷歌搜索,人们谈论AVSpeechSynthesizerDelegate,但我无法使用它。我想在演讲结束时运行一个函数。我怎样才能做到这一点?如果我必须使用委托(delegate),我应该怎么做?我这样试过:funcspeechSynthesizer(synthesizer:AVSpeechSynthesizer,didFinishSpeechUtteranceutterance:AVSpeechUtterance){falando=falseprint("FINISHED")}这是我在开发人员的文档中找到的功能之一,尽管讲了演讲但没有打印任何内容。