Tag: avspeechsynthesizer

目标C:等到AVSpeechSynthesizer完成一个单词的发音

我需要禁用与用户的交互,直到应用程序完成讲话。 看下面的例子代码: self.view.userInteractionEnabled = NO; [self speak :@"wait for me to speak"]; self.view.userInteractionEnabled = YES; -(void)speak:(NSString*)word { AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:word]; utterance.rate = AVSpeechUtteranceMinimumSpeechRate; utterance.rate = 0.2f; utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage [AVSpeechSynthesisVoice currentLanguageCode]]; [synthesizer speakUtterance:utterance]; }

AVSpeechSynthesizer文字转语音

与我们的AVSpeechsynthesizer语音是发音为“A”是“资本A”,但只是想“A”怎么可以做到这一点?

如何通过呼叫接收器扬声器播放AVSpeechSynthesizer?

我喜欢通过电话接收扬声器播放audio,目前我正在使用这个播放一些文本作为audio。 AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:_strTextCheck]; AVSpeechSynthesizer *syn = [[AVSpeechSynthesizer alloc] init]; [syn speakUtterance:utterance]; 我得到了,但这不是AVSpeechSynthesizer: [AVAudioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error]; 正确地讲它在一个普通的演讲者上工作,但我想通过电话接收器扬声器来演奏,是否有可能做到这一点?

任何方式来控制AVSpeechSynthesizer输出到哪个audio通道?

我想使用AVSpeechSynthesizer只在一个多声道环绕声设置的一个audio通道上输出声音。 例如,在5.1系统中,我希望它只在右环绕声道上输出。 现在我有: let synthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "This is the right channel") synthesizer.speakUtterance(utterance) …然而它在左右声道都输出。

AVSpeechSynthesizer输出文件?

AVSpeechSynthesizer有一个相当简单的API,它不支持保存到内置的audio文件。 我想知道是否有办法解决这个问题 – 也许录制输出,因为它默默地播放,稍后回放? 或者更有效率的东西

如果在设备的Accessiblity设置中未启用SpeakSelection,则对于文本到语音使用AVSpeechSynthesizer / AVSpeechUtterance将不起作用

我使用AVSpeechSynthesizer和AVSpeechUserrance进行文本到语音转换。 它工作正常,但用户必须在他/她的设备的辅助function设置中启用SpeakSelectionfunction。 有没有办法为他们做,或至less检查设置,并警告他们?

Swift:试图迅速改变语音到iPhone的声音时,iPhone的音量很低

我正在尝试语音识别示例。 如果我开始通过麦克风来识别我的发言,那么我试图让iPhone识别文本的声音。 这是工作。 但是,声音太低了。 你能指导我吗? 而不是,如果我正在尝试简单的button操作,与AVSpeechUtterance代码,音量是正常的。 之后,如果我使用startRecognise()方法,则音量太低。 我的代码 func startRecognise() { let audioSession = AVAudioSession.sharedInstance() //2 do { try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord) try audioSession.setMode(AVAudioSessionModeDefault) try audioSession.setMode(AVAudioSessionModeMeasurement) try audioSession.setActive(true, with: .notifyOthersOnDeactivation) try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSessionPortOverride.speaker) } catch { print("audioSession properties weren't set because of an error.") } recognitionRequest = SFSpeechAudioBufferRecognitionRequest() guard let inputNode = audioEngine.inputNode else { fatalError("Audio engine has […]

AVSpeechSynthesizer发音到audio文件

我正在使用AVSpeechSynthesizer在我的应用程序,我正在寻找将口头文本保存到audio文件或AVAsset。 我浏览了苹果公司的文档,没有看到任何东西,但认为我会发布一个问题,以确保。 以下是我目前的代码。 AVSpeechUtterance * utterance = [AVSpeechUtterance speechUtteranceWithString:textView.text]; float rate = [speedSlider value]/1.5; utterance.rate = rate; [speechSynthesizer speakUtterance:utterance];

在iOS 7.0 AVSpeechSynthesizer有美国男声吗?

解决scheme :没有US male voice 我已经使用iOS7.0 framework AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:@"Hello"]; if (isMale) //flag for male or female voice selected { // need US male voice as en-US is providing only US female voice utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; //UK male voice } else { utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //US female voice } 我需要使用US male voice而不是male […]

AVSpeechSynthesizer不能在iOS10上运行

我的AVSpeechSynthesizer代码不能在设备上运行(iOS 10),但是它在iOS 9.x上运行,现在在模拟器中运行。 let str = self.audioOutput //just some string here, this string exists, and it's in english let synth = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: str) utterance.rate = AVSpeechUtteranceDefaultSpeechRate let lang = "en-US" utterance.voice = AVSpeechSynthesisVoice(language: lang) synth.speakUtterance(utterance) 我得到这个错误: MobileAssetError:1] Unable to copy asset attributes Could not get attribute 'LocalURL': Error Domain=MobileAssetError Code=1 "Unable […]