Merge pull request #1213 from pipecat-ai/aleix/base-transport-output-bot-vad-stop-secs
BaseOutputTransport: use specific VAD stop secs for the bot
This commit is contained in:
@@ -76,6 +76,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue that was causing `BotStoppedSpeakingFrame` to be generated too
|
||||||
|
late. This could then cause issues unblocking `STTMuteFilter` later than
|
||||||
|
desired.
|
||||||
|
|
||||||
- Fixed an issue that was causing `AudioBufferProcessor` to not record
|
- Fixed an issue that was causing `AudioBufferProcessor` to not record
|
||||||
synchronized audio.
|
synchronized audio.
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from loguru import logger
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from pipecat.audio.utils import create_default_resampler
|
from pipecat.audio.utils import create_default_resampler
|
||||||
from pipecat.audio.vad.vad_analyzer import VAD_STOP_SECS
|
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
BotSpeakingFrame,
|
BotSpeakingFrame,
|
||||||
BotStartedSpeakingFrame,
|
BotStartedSpeakingFrame,
|
||||||
@@ -38,6 +37,8 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
|||||||
from pipecat.transports.base_transport import TransportParams
|
from pipecat.transports.base_transport import TransportParams
|
||||||
from pipecat.utils.time import nanoseconds_to_seconds
|
from pipecat.utils.time import nanoseconds_to_seconds
|
||||||
|
|
||||||
|
BOT_VAD_STOP_SECS = 0.3
|
||||||
|
|
||||||
|
|
||||||
class BaseOutputTransport(FrameProcessor):
|
class BaseOutputTransport(FrameProcessor):
|
||||||
def __init__(self, params: TransportParams, **kwargs):
|
def __init__(self, params: TransportParams, **kwargs):
|
||||||
@@ -321,15 +322,10 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
)
|
)
|
||||||
yield frame
|
yield frame
|
||||||
|
|
||||||
vad_stop_secs = (
|
|
||||||
self._params.vad_analyzer.params.stop_secs
|
|
||||||
if self._params.vad_analyzer
|
|
||||||
else VAD_STOP_SECS
|
|
||||||
)
|
|
||||||
if self._params.audio_out_mixer:
|
if self._params.audio_out_mixer:
|
||||||
return with_mixer(vad_stop_secs)
|
return with_mixer(BOT_VAD_STOP_SECS)
|
||||||
else:
|
else:
|
||||||
return without_mixer(vad_stop_secs)
|
return without_mixer(BOT_VAD_STOP_SECS)
|
||||||
|
|
||||||
async def _sink_task_handler(self):
|
async def _sink_task_handler(self):
|
||||||
async for frame in self._next_frame():
|
async for frame in self._next_frame():
|
||||||
|
|||||||
Reference in New Issue
Block a user