Having issue with thinking sounds and preroll audio. I would like a preroll audio file to play while my LLM creates a custom greeting for the caller.
The problem is that I get the thinking sounds playing on top of the preroll audio at the start of the call.
Is there a solution for this?
# Add pre-roll audio playback
player = BackgroundAudioPlayer(stream_timeout_ms=1000,thinking_sound=AudioConfig(
BuiltinAudioClip.KEYBOARD_TYPING,
volume=0.6, # Adjust between 0.0-1.0 to avoid overpowering TTS
probability=1.0 # Set to <1.0 if you add multiple sounds for variety
))
await player.start(room=ctx.room, agent_session=session)
file_path = "intro.wav"
player.play(file_path) # Plays asynchronously
if should_use_dynamic_greeting(session.userdata):
logger.info("Using dynamic greeting")
await session.generate_reply(instructions=f"Say Hello to caller using their first name", allow_interruptions=False)
else:
logger.info("Using static greeting")
greeting = load_static_greeting(session.userdata)
await session.say(greeting, allow_interruptions=False, add_to_chat_ctx=True)