From 7814fac9ba4e33aa9c4b17224376f7f5b2603211 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 30 Jun 2022 11:53:45 +0100 Subject: [PATCH] Playing audio with mimic3 --- desktop_client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop_client.py b/desktop_client.py index 783c0b38a..aad15ee5e 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -16,6 +16,7 @@ import webbrowser import urllib.parse from pathlib import Path from random import randint +from subprocess import call from utils import text_in_file from utils import disallow_announce from utils import disallow_reply @@ -344,11 +345,16 @@ def _speaker_mimic3(pitch: int, rate: int, srange: int, text = html.unescape(say_text).replace('"', "'") if not text: return + audio_filename = '/tmp/epicyon_voice.wav' cmd = 'mimic3 -v ' + voice + \ ' --length-scale ' + length_scale + \ ' --noise-w ' + noise_w + ' --stdout' + \ - ' "' + text + '" 2> /dev/null | aplay 2> /dev/null &' - os.system(cmd) + ' "' + text + '" > ' + audio_filename + try: + os.system(cmd) + call(['aplay', audio_filename]) + except OSError: + print('EX: unable to play ' + audio_filename) def _speaker_picospeaker(pitch: int, rate: int, system_language: str,