services(lmnt): change to subclass of AsyncTTSService

This commit is contained in:
Aleix Conchillo Flaqué
2024-09-12 00:20:06 -07:00
parent 80f6d74e80
commit a98d78cdea

View File

@@ -20,7 +20,7 @@ from pipecat.frames.frames import (
TTSStartedFrame, TTSStartedFrame,
TTSStoppedFrame, TTSStoppedFrame,
) )
from pipecat.services.ai_services import TTSService from pipecat.services.ai_services import AsyncTTSService
from loguru import logger from loguru import logger
@@ -34,7 +34,7 @@ except ModuleNotFoundError as e:
raise Exception(f"Missing module: {e}") raise Exception(f"Missing module: {e}")
class LmntTTSService(TTSService): class LmntTTSService(AsyncTTSService):
def __init__( def __init__(
self, self,
@@ -44,11 +44,9 @@ class LmntTTSService(TTSService):
sample_rate: int = 24000, sample_rate: int = 24000,
language: str = "en", language: str = "en",
**kwargs): **kwargs):
super().__init__(**kwargs)
# Let TTSService produce TTSStoppedFrames after a short delay of # Let TTSService produce TTSStoppedFrames after a short delay of
# no activity. # no activity.
self._push_stop_frames = True super().__init__(push_stop_frames=True, **kwargs)
self._api_key = api_key self._api_key = api_key
self._voice_id = voice_id self._voice_id = voice_id