From 4047842ce3c1c0e1d025f87f1c1062164d994aef Mon Sep 17 00:00:00 2001 From: miro Date: Mon, 23 Dec 2024 03:05:20 +0000 Subject: [PATCH] performance: speed up b64 operations --- hivemind_mic_sat/__init__.py | 4 ++-- requirements.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hivemind_mic_sat/__init__.py b/hivemind_mic_sat/__init__.py index e223958..1de0c56 100644 --- a/hivemind_mic_sat/__init__.py +++ b/hivemind_mic_sat/__init__.py @@ -1,4 +1,4 @@ -import base64 +import pybase64 import os.path from queue import Queue from typing import Optional, List @@ -137,7 +137,7 @@ def handle_speak_b64(self, message: Message): utt = message.data["utterance"] audio_file = f"/tmp/{hash_sentence(utt)}.wav" with open(audio_file, "wb") as f: - f.write(base64.b64decode(b64data)) + f.write(pybase64.b64decode(b64data)) LOG.info(f"TTS: {audio_file}") self.playback.put(audio_file, listen=message.data.get("listen"), diff --git a/requirements.txt b/requirements.txt index 182a47d..417216d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ hivemind_bus_client>=0.1.0,<1.0.0 ovos-plugin-manager<1.0.0 ovos-audio<1.0.0 -click \ No newline at end of file +click +pybase64 \ No newline at end of file