Fix asr begin error
This commit is contained in:
@@ -813,6 +813,12 @@ class DuplexPipeline:
|
||||
# Prime ASR with a short pre-speech context window so the utterance
|
||||
# start isn't lost while waiting for VAD to transition to Speech.
|
||||
pre_roll = self._pre_speech_buffer
|
||||
# _pre_speech_buffer already includes current speech frames; avoid
|
||||
# duplicating onset audio when we append pending speech below.
|
||||
if self._pending_speech_audio and len(pre_roll) > len(self._pending_speech_audio):
|
||||
pre_roll = pre_roll[:-len(self._pending_speech_audio)]
|
||||
elif self._pending_speech_audio:
|
||||
pre_roll = b""
|
||||
capture_audio = pre_roll + self._pending_speech_audio
|
||||
if capture_audio:
|
||||
await self.asr_service.send_audio(capture_audio)
|
||||
|
||||
Reference in New Issue
Block a user