From 05406a1361da84f03391849958cc4d1eb9a0ae35 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 21 Nov 2023 15:30:16 -0800 Subject: [PATCH] Add save_ww and save_stt timing to context --- neon_speech/service.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 27ae9c2..1e9f014 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -149,9 +149,21 @@ def _stt_text(self, text: str, stt_context: dict): self._stt_stopwatch.report() def _save_stt(self, audio_bytes, stt_meta, save_path=None): - with Stopwatch("save_audio", True, self.bus): + stopwatch = Stopwatch("save_audio", True, self.bus) + with stopwatch: path = OVOSDinkumVoiceService._save_stt(self, audio_bytes, stt_meta, save_path) + stt_meta.setdefault('timing', dict()) + stt_meta['timing']['save_audio'] = stopwatch.time + return path + + def _save_ww(self, audio_bytes, ww_meta, save_path=None): + stopwatch = Stopwatch("save_ww", True, self.bus) + with stopwatch: + path = OVOSDinkumVoiceService._save_ww(self, audio_bytes, ww_meta, + save_path) + ww_meta.setdefault('timing', dict()) + ww_meta['timing']['save_ww'] = stopwatch.time return path def _validate_message_context(self, message: Message, native_sources=None):