44# SPDX-License-Identifier: BSD 2-Clause License
55#
66
7- """Camb.ai MARS-8 TTS example with local audio (microphone/speakers).
7+ """Camb.ai MARS TTS example with local audio (microphone/speakers).
88
99This example demonstrates:
10- - Basic TTS synthesis with Camb.ai MARS-8
10+ - Basic TTS synthesis with Camb.ai MARS
1111- Local audio input/output (no WebRTC or Daily needed)
1212- Handling interruptions
1313
@@ -83,7 +83,7 @@ async def main(voice_id: int):
8383 messages = [
8484 {
8585 "role" : "system" ,
86- "content" : """You are a helpful voice assistant powered by Camb.ai's MARS-8
86+ "content" : """You are a helpful voice assistant powered by Camb.ai's MARS
8787text-to-speech technology. Keep your responses concise and conversational since
8888they will be spoken aloud. Avoid special characters, emojis, or bullet points.""" ,
8989 },
@@ -117,14 +117,9 @@ async def main(voice_id: int):
117117 ),
118118 )
119119
120- # Run the pipeline
121- runner = PipelineRunner ()
122- logger .info ("Starting Camb.ai TTS bot with local audio..." )
123- logger .info ("Speak into your microphone to interact with the bot." )
124-
125- # Start the conversation with a greeting after a short delay
126- async def start_greeting ():
127- await asyncio .sleep (1 ) # Wait for pipeline to start
120+ # Start the conversation when the pipeline is ready
121+ @task .event_handler ("on_pipeline_started" )
122+ async def on_pipeline_started (task , frame ):
128123 messages .append (
129124 {
130125 "role" : "system" ,
@@ -133,20 +128,20 @@ async def start_greeting():
133128 )
134129 await task .queue_frames ([LLMRunFrame ()])
135130
136- # Run greeting and pipeline concurrently
137- await asyncio . gather (
138- runner . run ( task ),
139- start_greeting (),
140- )
131+ # Run the pipeline
132+ runner = PipelineRunner ()
133+ logger . info ( "Starting Camb.ai TTS bot with local audio..." )
134+ logger . info ( "Speak into your microphone to interact with the bot." )
135+ await runner . run ( task )
141136
142137
143138if __name__ == "__main__" :
144139 parser = argparse .ArgumentParser (description = "Camb.ai TTS example with local audio" )
145140 parser .add_argument (
146141 "--voice-id" ,
147142 type = int ,
148- default = 2681 ,
149- help = "Camb.ai voice ID to use (default: 2681 - Attic voice )" ,
143+ default = 147320 ,
144+ help = "Camb.ai voice ID to use (default: 147320 )" ,
150145 )
151146 args = parser .parse_args ()
152147 asyncio .run (main (args .voice_id ))
0 commit comments