From 4d7b59b9b911618f83d0391ecb964ba33d266624 Mon Sep 17 00:00:00 2001 From: miro Date: Wed, 23 Oct 2024 16:03:55 +0100 Subject: [PATCH] fix:b64 --- ovos_audio/service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ovos_audio/service.py b/ovos_audio/service.py index 52a725c..d9565a2 100644 --- a/ovos_audio/service.py +++ b/ovos_audio/service.py @@ -283,10 +283,11 @@ def handle_b64_audio(self, message): ctxt = self.tts._get_ctxt({"message": message}) wav, _ = self.tts.synth(utterance, ctxt) - with open(wav, "rb") as f: + # cast to str() to get a path, as it is a AudioFile object from tts cache + with open(str(wav), "rb") as f: audio = f.read() - b64_audio = base64.b64encode(audio) + b64_audio = base64.b64encode(audio).decode("utf-8") self.bus.emit(message.response({"audio": b64_audio, "listen": listen, 'tts_id': self.tts.plugin_id,