...
The goal of SIC is to provide easy to use high level access to devices and services. Playing sound on To make a NAO robot say something, follow the startup instruction in https://socialrobotics.atlassian.net/wiki/spaces/CBSR/pages/2180415493/Install#Starting-SIC-on-the-Robot and run the following python script on your laptop.
Code Block | ||
---|---|---|
| ||
class DemoText2Speech(SICApplication): def run(self): # configure and connect services and devices conf = Text2SpeechConf(keyfile="path/to/google_key_file.json")from sic_framework import SICApplication from sic_framework.devices.common_naoqi.naoqi_speakers import NaoqiTextToSpeechAction, NaoqiTextToSpeechRequest class DemoTextToSpeech(SICApplication): tts = self.connect(Text2Speech, device_id='local', conf=conf)def run(self): speaker nao3_action = self.connect(DesktopSpeakersNaoqiTextToSpeechAction, device_id='localnao') # Convert text to audio and play audio audio = ttsnao3_action.request(GetSpeechRequestNaoqiTextToSpeechRequest(text="Hello, how are you?")) speaker.send_message(audio) # wait for audio to complete time.sleep(10 world!")) if __name__ == '__main__': test_app = DemoText2SpeechDemoTextToSpeech() test_app.run() |