From 4e16e514dd4d46fd77c80ab8bd3eb9b826336901 Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Sun, 10 Mar 2024 19:43:06 -0700 Subject: [PATCH] attempting to change tts to deepgram in example 04 --- .../foundational/04-utterance-and-speech.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/examples/foundational/04-utterance-and-speech.py b/src/examples/foundational/04-utterance-and-speech.py index bcd2a6798..1d25a6c1a 100644 --- a/src/examples/foundational/04-utterance-and-speech.py +++ b/src/examples/foundational/04-utterance-and-speech.py @@ -7,6 +7,7 @@ from dailyai.pipeline.pipeline import Pipeline from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService +from dailyai.services.deepgram_ai_services import DeepgramTTSService from dailyai.pipeline.frames import EndFrame, LLMMessagesQueueFrame from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService from examples.support.runner import configure @@ -25,7 +26,6 @@ async def main(room_url: str): duration_minutes=1, mic_enabled=True, mic_sample_rate=16000, - camera_enabled=False, ) llm = AzureLLMService( @@ -37,6 +37,11 @@ async def main(room_url: str): api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"), ) + + deepgram_tts = DeepgramTTSService( + aiohttp_session=session, + api_key=os.getenv("DEEPGRAM_API_KEY"), + ) elevenlabs_tts = ElevenLabsTTSService( aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), @@ -64,6 +69,15 @@ async def main(room_url: str): transport.send_queue, ) + # khk: deepgram_tts.say() doesn't seem to put bytes in the transport + # queue. I get a debug log line that indicates we're set up okay, but + # no further log lines or audio bytes. debug this later: + # 20 2024-03-10 13:24:46,235 Running deepgram tts for My friend the LLM is now going to tell a joke about llamas. + # await deepgram_tts.say( + # "My friend the LLM is now going to tell a joke about llamas.", + # transport.send_queue, + # ) + async def buffer_to_send_queue(): while True: frame = await buffer_queue.get() @@ -73,7 +87,6 @@ async def main(room_url: str): break await asyncio.gather(pipeline_run_task, buffer_to_send_queue()) - await transport.stop_when_done() await transport.run()