# How can I change epspeak parameters for text\_to\_speach in python

**URL:** <https://forum.sunfounder.com/t/how-can-i-change-epspeak-parameters-for-text-to-speach-in-python/460>\
**Category:** Robotic kit for Raspberry Pi\
**Created:** [August 13, 2023, 4:04am UTC](https://forum.sunfounder.com/t/how-can-i-change-epspeak-parameters-for-text-to-speach-in-python/460 "2023-08-13T04:04:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![slowbot](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@slowbot](https://forum.sunfounder.com/u/slowbot)\
**Post date:** [August 13, 2023, 4:04am UTC](https://forum.sunfounder.com/t/how-can-i-change-epspeak-parameters-for-text-to-speach-in-python/460/1 "2023-08-13T04:04:34Z")

</div>

Does anyone have an example of how to change the parameters for TTS?  
**The documentation:**  
([class TTS - text to speech — SunFounder Robot HAT documentation](https://docs.sunfounder.com/projects/robot-hat/en/latest/pythonApi/TTS.html))  
**says:**  
_/# amp: amplitude, volume  
/# speed: speaking speed  
/# gap: gap  
/# pitch: pitch  
def espeak\_params(self, amp=None, speed=None, gap=None, pitch=None)_  
   
But doesn’t show how to implement this as a function.  
Can anyone put up an example?

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [August 14, 2023, 9:32am UTC](https://forum.sunfounder.com/t/how-can-i-change-epspeak-parameters-for-text-to-speach-in-python/460/2 "2023-08-14T09:32:42Z")

</div>

Note the selection of the espeak speech engine.

```auto
from robot_hat import TTS
# https://github.com/sunfounder/robot-hat/blob/main/robot_hat/tts.py

tts = TTS({'engine':'espeak'}) # create a TTS object

# "espeak -h"
# Amp should be in 0 to 200
# gap： unit ms
# speed should be in 80 to 260
# pitch should be in 0 to 99
tts.espeak_params(amp=100, speed=200, gap=5, pitch=50)

tts.say('Hello. Nice to meet you.') # speak word

```

---

<div class="post-metadata">

**Author:** ![slowbot](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@slowbot](https://forum.sunfounder.com/u/slowbot)\
**Post date:** [August 17, 2023, 10:39pm UTC](https://forum.sunfounder.com/t/how-can-i-change-epspeak-parameters-for-text-to-speach-in-python/460/3 "2023-08-17T22:39:48Z")

</div>

Fantastic! thank you. I love the Picar!  
Cheers,
