Skip to content

Commit

Permalink
Add save_ww and save_stt timing to context
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 21, 2023
1 parent 868f29d commit 05406a1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion neon_speech/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 05406a1

Please sign in to comment.