fix: ElevenLabsTTSService reset context when flushing audio
This commit is contained in:
@@ -23,6 +23,9 @@ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
|||||||
- Fixed an issue with various TTS services that would cause audio glitches at
|
- Fixed an issue with various TTS services that would cause audio glitches at
|
||||||
the start of every bot turn.
|
the start of every bot turn.
|
||||||
|
|
||||||
|
- Fixed an `ElevenLabsTTSService` issue where a context warning was printed
|
||||||
|
when pushing a `TTSSpeakFrame`.
|
||||||
|
|
||||||
- Fixed an `AssemblyAISTTService` issue that could cause unexpected behavior
|
- Fixed an `AssemblyAISTTService` issue that could cause unexpected behavior
|
||||||
when yielding empty `Frame()`s.
|
when yielding empty `Frame()`s.
|
||||||
|
|
||||||
|
|||||||
@@ -279,9 +279,12 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
|
|||||||
await self._disconnect()
|
await self._disconnect()
|
||||||
|
|
||||||
async def flush_audio(self):
|
async def flush_audio(self):
|
||||||
if self._websocket and self._context_id:
|
if not self._context_id or not self._websocket:
|
||||||
msg = {"context_id": self._context_id, "flush": True}
|
return
|
||||||
await self._websocket.send(json.dumps(msg))
|
logger.trace(f"{self}: flushing audio")
|
||||||
|
msg = {"context_id": self._context_id, "flush": True}
|
||||||
|
await self._websocket.send(json.dumps(msg))
|
||||||
|
self._context_id = None
|
||||||
|
|
||||||
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
|
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
|
||||||
await super().push_frame(frame, direction)
|
await super().push_frame(frame, direction)
|
||||||
|
|||||||
Reference in New Issue
Block a user