From 78fa2ab65e7746e376cc09beae15cee103c3a312 Mon Sep 17 00:00:00 2001 From: Neil Ruaro Date: Fri, 9 Jan 2026 21:22:33 +0900 Subject: [PATCH] Update default voice ID, fix MARS naming, and clean up example --- .../07zb-interruptible-camb-local.py | 31 ++++++++----------- src/pipecat/services/camb/tts.py | 12 +++---- tests/test_camb_tts.py | 2 +- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/examples/foundational/07zb-interruptible-camb-local.py b/examples/foundational/07zb-interruptible-camb-local.py index d2c1cfcd8..19ef0bbed 100644 --- a/examples/foundational/07zb-interruptible-camb-local.py +++ b/examples/foundational/07zb-interruptible-camb-local.py @@ -4,10 +4,10 @@ # SPDX-License-Identifier: BSD 2-Clause License # -"""Camb.ai MARS-8 TTS example with local audio (microphone/speakers). +"""Camb.ai MARS TTS example with local audio (microphone/speakers). This example demonstrates: -- Basic TTS synthesis with Camb.ai MARS-8 +- Basic TTS synthesis with Camb.ai MARS - Local audio input/output (no WebRTC or Daily needed) - Handling interruptions @@ -83,7 +83,7 @@ async def main(voice_id: int): messages = [ { "role": "system", - "content": """You are a helpful voice assistant powered by Camb.ai's MARS-8 + "content": """You are a helpful voice assistant powered by Camb.ai's MARS text-to-speech technology. Keep your responses concise and conversational since they will be spoken aloud. Avoid special characters, emojis, or bullet points.""", }, @@ -117,14 +117,9 @@ they will be spoken aloud. Avoid special characters, emojis, or bullet points."" ), ) - # Run the pipeline - runner = PipelineRunner() - logger.info("Starting Camb.ai TTS bot with local audio...") - logger.info("Speak into your microphone to interact with the bot.") - - # Start the conversation with a greeting after a short delay - async def start_greeting(): - await asyncio.sleep(1) # Wait for pipeline to start + # Start the conversation when the pipeline is ready + @task.event_handler("on_pipeline_started") + async def on_pipeline_started(task, frame): messages.append( { "role": "system", @@ -133,11 +128,11 @@ they will be spoken aloud. Avoid special characters, emojis, or bullet points."" ) await task.queue_frames([LLMRunFrame()]) - # Run greeting and pipeline concurrently - await asyncio.gather( - runner.run(task), - start_greeting(), - ) + # Run the pipeline + runner = PipelineRunner() + logger.info("Starting Camb.ai TTS bot with local audio...") + logger.info("Speak into your microphone to interact with the bot.") + await runner.run(task) if __name__ == "__main__": @@ -145,8 +140,8 @@ if __name__ == "__main__": parser.add_argument( "--voice-id", type=int, - default=2681, - help="Camb.ai voice ID to use (default: 2681 - Attic voice)", + default=147320, + help="Camb.ai voice ID to use (default: 147320)", ) args = parser.parse_args() asyncio.run(main(args.voice_id)) diff --git a/src/pipecat/services/camb/tts.py b/src/pipecat/services/camb/tts.py index 7e221605f..f2517a362 100644 --- a/src/pipecat/services/camb/tts.py +++ b/src/pipecat/services/camb/tts.py @@ -38,7 +38,7 @@ from pipecat.utils.tracing.service_decorators import traced_tts # Default configuration -DEFAULT_VOICE_ID = 2681 # Attic voice (publicly available) +DEFAULT_VOICE_ID = 147320 DEFAULT_LANGUAGE = "en-us" DEFAULT_MODEL = "mars-flash" # Faster inference DEFAULT_BASE_URL = "https://client.camb.ai/apis" @@ -135,7 +135,7 @@ class CambTTSService(TTSService): tts = CambTTSService( api_key="your-api-key", - voice_id=2681, + voice_id=147320, model="mars-flash", aiohttp_session=session, params=CambTTSService.InputParams( @@ -146,7 +146,7 @@ class CambTTSService(TTSService): # For mars-instruct with custom instructions: tts_instruct = CambTTSService( api_key="your-api-key", - voice_id=2681, + voice_id=147320, model="mars-instruct", aiohttp_session=session, params=CambTTSService.InputParams( @@ -190,7 +190,7 @@ class CambTTSService(TTSService): Args: api_key: Camb.ai API key for authentication. aiohttp_session: Shared aiohttp session for making HTTP requests. - voice_id: Voice ID to use (e.g., 2681 for Attic). Defaults to 2681. + voice_id: Voice ID to use. Defaults to 147320. model: TTS model to use. Options: "mars-flash", "mars-pro", "mars-instruct". Defaults to "mars-flash" (fastest). base_url: Camb.ai API base URL. Defaults to production URL. @@ -338,10 +338,8 @@ class CambTTSService(TTSService): await self.start_tts_usage_metrics(text) yield TTSStartedFrame() - CHUNK_SIZE = self.chunk_size - async for frame in self._stream_audio_frames_from_iterator( - response.content.iter_chunked(CHUNK_SIZE), strip_wav_header=False + response.content.iter_chunked(self.chunk_size), strip_wav_header=False ): await self.stop_ttfb_metrics() yield frame diff --git a/tests/test_camb_tts.py b/tests/test_camb_tts.py index ecd6f45fb..03b4bee1f 100644 --- a/tests/test_camb_tts.py +++ b/tests/test_camb_tts.py @@ -363,7 +363,7 @@ async def test_language_mapping(): @pytest.mark.asyncio -async def test_mars8_instruct_model(aiohttp_client): +async def test_mars_instruct_model(aiohttp_client): """Test that user_instructions are included for mars-instruct model.""" received_payload = {}