when background audio is on throughout the calling...
# ask-ai
d
when background audio is on throughout the calling session in livekit room is that voice detected by VAD?
t
Thanks for reaching out, Giriraj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick heads-up about LiveKit's Voice Activity Detection (VAD) — it’s really tuned to pick up human speech, not just any background noise. That said, sometimes sounds like voices from a TV or songs with vocals might sneak in and get mistaken for speech. On the bright side, everyday background noises like fans or general ambient sounds usually don’t set it off, especially if you’re using noise suppression. If you want to get even better results, LiveKit works great with noise suppression tools like Krisp, which help filter out those non-speech sounds. Plus, you can tweak the VAD’s sensitivity and timing to fit your unique audio setup perfectly. We’re here to help you get the best experience possible! Sources: livekit-agents/livekit/agents/voice/audio_recognition.py | plugins/silero/src/vad.ts | AI voice agents | LiveKit Docs
d
Copy code
background_audio.play([
    AudioConfig(BuiltinAudioClip.KEYBOARD_TYPING, volume=0.8, probability=0.8),
    AudioConfig(BuiltinAudioClip.KEYBOARD_TYPING2, volume=0.7, probability=0.2),
])
is this track considered by vad or EOU?
t
Just so you know, LiveKit's VAD and End of Utterance (EOU) detection are built to pick up on actual human speech. They don’t treat background sounds—like keyboard typing noises from `BuiltinAudioClip.KEYBOARD_TYPING`—as speech input. Those background sounds are there to simulate agent activity, but they won’t affect how VAD or EOU work. Sources: External data and RAG | LiveKit Docs | AI Agents Framework | livekit/livekit_composite | DeepWiki | Voice Assistants | livekit/livekit_composite | DeepWiki | Agent speech and audio | LiveKit Docs | examples/voice_agents/background_audio.py
d
give me a sample how to have this with agentsession
t
Hey there! If you want to add some background audio like keyboard typing with
AgentSession
in LiveKit, here’s a simple way to do it: 1. First, import the classes you’ll need:
Copy code
from livekit.agents import BackgroundAudioPlayer, AudioConfig, BuiltinAudioClip
1. Next, create a
BackgroundAudioPlayer
instance and set it up with typing sounds you like:
Copy code
background_audio = BackgroundAudioPlayer(
    thinking_sound=[
        AudioConfig(BuiltinAudioClip.KEYBOARD_TYPING, volume=0.8, probability=0.7),
        AudioConfig(BuiltinAudioClip.KEYBOARD_TYPING2, volume=0.7, probability=0.3),
    ]
)
1. Then, start your agent session and the background audio player:
Copy code
await session.start(agent=MyAgent(), room=ctx.room)
await background_audio.start(room=ctx.room, agent_session=session)
1. If you want, you can also play custom audio whenever you like:
Copy code
background_audio.play("custom_effect.ogg", loop=False)
Want to see it all in action? Check out the official background audio example for a full walkthrough. Sources: Agent speech and audio | LiveKit Docs | Agent speech and audio | LiveKit Docs | livekit-agents/livekit/agents/voice/chat_cli.py