是否可以在AVSpeechSynthesizer的声音中改变声音的音高? [英] is it possible to change the pitch of the voice in AVSpeechSynthesizer's voice?
问题描述
我可以在AVSpeechSynthesizer中改变声音的音高,还是对输出声音产生任何影响,使声音听起来不同?
Can I change the pitch of the voice in AVSpeechSynthesizer or putting any effects on the output voice from it so it could sound differently?
推荐答案
是的,您可以更改口语句子的音高和率。
Yes, you can change the pitch and the rate of the spoken sentence.
AVSpeechUtterance
class有两个相关属性:
The AVSpeechUtterance
class has two relevant properties:
-
pitchMultiplier:Float
( 0.5 (最低音高)到 2.0 (最高音高)之间的值)。默认音高 1.0 。 -
rate:Float
(两个常量之间的值:AVSpeechUtteranceMinimumSpeechRate
(最慢的讲话率)和AVSpeechUtteranceMaximumSpeechRate
(最高讲话率)。
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) andAVSpeechUtteranceMaximumSpeechRate
(the highest rate of speech).
当你创建 AVSpeechUtterance
时,只需在获得 AVSpeechSynthesizer $之前适当地设置这些属性c $ c>说出话语。
When you create your AVSpeechUtterance
, simply set these properties appropriately before getting your AVSpeechSynthesizer
to speak the utterance.
注意:你也可以改变的声音(重音)AVSpeechUtterance
。
Note: You can also change the voice (accent) of AVSpeechUtterance
.
我希望这会有所帮助。如果我说的话不清楚,请告诉我。
I hope this helps. Let me know if anything I said was unclear.
这篇关于是否可以在AVSpeechSynthesizer的声音中改变声音的音高?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!