feat(voice): randomly pick thinking sound from all 7 built-in clips per session
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
38bea33074
commit
afc1ae6fbe
|
|
@ -387,16 +387,21 @@ async def entrypoint(ctx: JobContext) -> None:
|
||||||
_cleanup_ref.append(_on_room_disconnect)
|
_cleanup_ref.append(_on_room_disconnect)
|
||||||
|
|
||||||
# --- Thinking state audio feedback ---
|
# --- Thinking state audio feedback ---
|
||||||
# BackgroundAudioPlayer listens for AgentStateChangedEvent from the
|
# Randomly pick one of all available built-in clips each session.
|
||||||
# session. When state transitions to "thinking" (STT done, waiting for
|
_all_clips = [
|
||||||
# LLM response), it plays the built-in keyboard typing sound through
|
BuiltinAudioClip.KEYBOARD_TYPING,
|
||||||
# the LiveKit audio track. The sound stops automatically when the agent
|
BuiltinAudioClip.KEYBOARD_TYPING2,
|
||||||
# enters "speaking" state (TTS begins). This gives the user audible
|
BuiltinAudioClip.OFFICE_AMBIENCE,
|
||||||
# feedback that the AI is processing their request.
|
BuiltinAudioClip.CITY_AMBIENCE,
|
||||||
# Available built-in clips: KEYBOARD_TYPING, KEYBOARD_TYPING2,
|
BuiltinAudioClip.FOREST_AMBIENCE,
|
||||||
# OFFICE_AMBIENCE, CITY_AMBIENCE, FOREST_AMBIENCE, CROWDED_ROOM, HOLD_MUSIC
|
BuiltinAudioClip.CROWDED_ROOM,
|
||||||
|
BuiltinAudioClip.HOLD_MUSIC,
|
||||||
|
]
|
||||||
|
import random as _random
|
||||||
|
_chosen_clip = _random.choice(_all_clips)
|
||||||
|
logger.info("Thinking sound this session: %s", _chosen_clip)
|
||||||
bg_audio = BackgroundAudioPlayer(
|
bg_audio = BackgroundAudioPlayer(
|
||||||
thinking_sound=BuiltinAudioClip.KEYBOARD_TYPING,
|
thinking_sound=_chosen_clip,
|
||||||
)
|
)
|
||||||
await bg_audio.start(room=ctx.room, agent_session=session)
|
await bg_audio.start(room=ctx.room, agent_session=session)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue