forked from BuddhiGamage/pepper_exp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
54 lines (47 loc) · 3.34 KB
/
test
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class MyClass(GeneratedClass):
def _init_(self):
GeneratedClass._init_(self)
def onLoad(self):
#put initialization code here
pass
def onUnload(self):
#put clean-up code here
pass
def onInput_onStart(self):
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech")
tts.setParameter("speed", 85)
dialogue = {
"yoga_1": "Hello, my name is Pepper. How are you today?",
"yoga_2": "I would like to ask for your help if that would be okay. I am training to become a Yoga instructor and need to practice taking clients through a series of gentle stretches. Would you mind being my client?",
"yoga_3": "Please stand up.",
"yoga_4": "Please follow my instructions through these gentle stretches. If you feel any discomfort please stop immediately and let me know.",
"yoga_5": "Please stretch your left arm out in front like this and flex your hand.",
"yoga_6": "Please stretch your right arm out in front like this and flex your hand.",
"yoga_7": "Please stretch both arms out in front like this and flex your hands.",
"yoga_8": "Please move your left arm out to the side like this and flex your hand.",
"yoga_9": "Please move your right arm out to the side like this and flex your hand.",
"yoga_10": "Please move both arms out to the side like this and flex your hands.",
"yoga_11": "Please lift your left arm over your head like this and flex your hand.",
"yoga_12": "Please lift your right arm over your head like this and flex your hand.",
"yoga_13": "Please lift both arms over your head like this and flex your hands.",
"yoga_14": "Please take a seat.",
"yoga_15": "Thank you for being my client. I would like to play a quick game with you. Would you mind?",
"ult_1": "I will explain the game and the rules. This game is called the Ultimatum Game. Let’s pretend that we have been given 100 dollars to share and I have to decide how we split the money. I will make you an offer that you can accept or reject. We will play for 5 rounds. Are you ready?",
"ult_2": "I will offer you 30 dollars and will keep 70 dollars. Do you accept or reject?",
"ult_3": "I will offer you 40 dollars and will keep 60 dollars. Do you accept or reject?",
"ult_4": "I will offer you 50 dollars and will keep 50 dollars. Do you accept or reject?",
"ult_5": "I will offer you 60 dollars and will keep 40 dollars. Do you accept or reject?",
"ult_6": "I will offer you 70 dollars and will keep 30 dollars. Do you accept or reject?",
"ult_7": "That was fun. Thank you for playing with me. The researcher will come and get you shortly. It was nice to meet you."
}
# Iterating through each key-value pair in the dictionary
for key, value in dialogue.items():
audio_file_path = "/home/nao/sharni/"+key+".wav"
# Generate TTS output and save it to the file
tts.sayToFile(value,audio_file_path)
self.onStopped() #activate the output of the box
pass
def onInput_onStop(self):
self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
self.onStopped() #activate the output of the box