Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?


1 Answers

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.

like image 119
Loic Verrall Avatar answered Nov 26 '25 20:11

Loic Verrall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!