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

拜拜、爱过 提交于 2019-12-02 01:52:44

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 AVSpeechUtteranceMaximumSpeechRate (the highest rate of speech).

When you create your AVSpeechUtterance, simply set these properties appropriately before getting your AVSpeechSynthesizer to speak the utterance.

Note: You can also change the voice (accent) of AVSpeechUtterance.

I hope this helps. Let me know if anything I said was unclear.

Srinivas Goud

The default pitch is 0.5.

AVSpeechUtteranceMinimumSpeechRate is 0.0

AVSpeechUtteranceMaximumSpeechRate is 1.0 (the highest rate of speech).

AVSpeechSynthesizer *synthesizer= [[AVSpeechSynthesizer alloc]init];
synthesizer.delegate=self; 
AVSpeechUtterance *utterances =
[AVSpeechUtterance speechUtteranceWithString:text];utterances.voice
= [AVSpeechSynthesisVoice voiceWithLanguage:@"de-DE"];//change voice utterances.rate=0.5;//default rate
[synthesizer
speakUtterance:utterances];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!