From 0c1eb26ae7c2a8469e0fb28e0d5c2c023ac2aa33 Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 27 Apr 2023 16:53:02 -0700 Subject: [PATCH] using subprocess --- basic_text_to_speech/talk.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/basic_text_to_speech/talk.py b/basic_text_to_speech/talk.py index 4936562..5b11f93 100644 --- a/basic_text_to_speech/talk.py +++ b/basic_text_to_speech/talk.py @@ -1,18 +1,15 @@ import time -import os +from subprocess import call def robot(text): print("executing command") - command = 'espeak --stdin "' + text + '" | aplay -D plughw:2,0 ' - os.system(command) - return command + call(['espeak', '--stdin', '"Hello world how are you doing today?"', '|', 'aplay', '-D', 'plughw:2,0']) if __name__ == '__main__': while True: - try: print("initializing") command = robot("Hello world how are you doing today?")