forked from Auxority/hackathon-team10
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextToSpeech.py
More file actions
29 lines (22 loc) · 841 Bytes
/
Copy pathTextToSpeech.py
File metadata and controls
29 lines (22 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from naoqi import ALProxy
class TextToSpeech:
DEFAULT_PITCH = 1.0
DEFAULT_SPEED = 3.0
DEFAULT_VOLUME = 80.0
DEFAULT_LANGUAGE = "English"
def __init__(self, pepper):
self.tts = ALProxy("ALTextToSpeech", pepper._ip, pepper._port)
self.reset()
def say(self, message):
self.tts.say(message)
def volume(self, volume):
self.tts.setParameter("volume", volume)
def pitch(self, pitch):
self.tts.setParameter("pitchShift", pitch)
def speed(self, speed):
self.tts.setParameter("speed", speed)
def reset(self):
self.tts.setParameter("pitchShift", self.DEFAULT_PITCH)
self.tts.setParameter("speed", self.DEFAULT_SPEED)
self.tts.setParameter("volume", self.DEFAULT_VOLUME)
self.tts.setLanguage(self.DEFAULT_LANGUAGE)