Skip to content

Commit

Permalink
Merge pull request #492 from pipecat-ai/khk/flush-more-audio
Browse files Browse the repository at this point in the history
add calls to flush_audio for say() and rtvi action
  • Loading branch information
kwindla authored Sep 25, 2024
2 parents 2703813 + 3d43ad0 commit 8f2941c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pipecat/services/ai_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ def __init__(
async def flush_audio(self):
pass

async def say(self, text: str):
await super.say(text)
await self.flush_audio()

async def start(self, frame: StartFrame):
await super().start(frame)
if self._push_stop_frames:
Expand All @@ -278,6 +282,11 @@ async def cancel(self, frame: CancelFrame):
await self._stop_frame_task
self._stop_frame_task = None

async def process_frame(self, frame: Frame, direction: FrameDirection):
await super().process_frame(frame, direction)
if isinstance(frame, TTSSpeakFrame):
await self.flush_audio()

async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
await super().push_frame(frame, direction)

Expand Down

0 comments on commit 8f2941c

Please sign in to comment.