is there a way to set input gaing for users?
# ask-ai
w
is there a way to set input gaing for users?
t
Thanks for reaching out, Marius. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m responding about whether you can set input gain for users (adjust their microphone/input level). Quick question to narrow this down: • Which SDK and platform are you using? (Web, iOS, Android, or server-side) • Do you want to control gain on the client device before sending audio, or adjust another participant’s incoming audio on the listener side? With that I can tell you the exact options and sample code.
w
it is a telpehony application running in python
t
Thanks — you're building a telephony app in Python and want to set input gain for users. Two quick clarifying questions so I can give the right guidance: 1. Are you using LiveKit’s Python server SDK only, or a client SDK in Python (or another audio library) to capture/send audio? 2. Do you need to change the microphone gain before sending (client-side) or adjust gain for incoming streams on the receiver side (mix/relay)? What I can say now: • The LiveKit server SDKs do not provide remote control of a participant’s microphone hardware gain. Client-side audio must be adjusted where the audio is captured or before it’s encoded and sent. • For a Python telephony app you can implement gain control by processing audio frames locally (before sending) or on received frames (before playback). Typical approaches: ◦ Capture raw PCM, multiply samples by a gain factor, clamp to avoid clipping, then encode/send. ◦ Apply a simple AGC (automatic gain control) algorithm or use an audio library that offers AGC or gain control. ◦ If you use a telephony/media framework (e.g., pjsip/pjmedia, Asterisk, FreeSWITCH, or a WebRTC stack), check whether that framework exposes input gain/AGC settings; otherwise insert a processing hook to adjust samples. If you tell me which Python audio/telephony library or client stack you use, I’ll give a short code example for applying a gain multiplier to PCM frames or point to the exact setting to change.
w
1. using LiveKit's Python server SDK (specifically the Agents framework). 2. the issue is that the volume in loudness is to low for our agent to be able to hear what the user is saying
t
Thanks — I’m responding about raising input loudness for users in your Python Agents-based telephony app. Short answer: LiveKit’s Python server SDK (Agents framework) cannot remotely change a participant’s microphone hardware/input gain. Gain must be applied where audio is captured or before playback. Practical options you can use now: • Client-side (best if you control the client): apply gain or AGC before sending audio. Multiply PCM samples by a gain factor and clamp to avoid clipping, or enable the client-side AGC if your capture stack provides one. • Server-side processing (useful if you can’t change the client): intercept audio frames in your Agents flow and amplify them before forwarding to the agent. This keeps control centralized and works for PSTN/softphone callers. • Per-receiver gain: amplify incoming frames only for the agent’s playback path so other consumers aren’t affected. If you want a quick Python example to amplify raw PCM frames on the server (before forwarding/playback), tell me: • the audio sample format (e.g., 16-bit signed PCM) and sample rate, and I’ll provide a short code snippet showing safe amplification (gain multiply + clipping) you can drop into your Agents pipeline.