Skip to main content
Speak and see your avatar respond instantly.

Quick Start

1

Install

pip install bithuman --upgrade livekit-rtc livekit-agents
2

Set environment

export BITHUMAN_API_SECRET="your_secret"
export BITHUMAN_MODEL_PATH="/path/to/model.imx"
3

Run

python examples/avatar-with-microphone.py
View source code on GitHub
4

Usage

  • Speak into microphone — Avatar animates in real-time
  • Stay quiet — Avatar stops after silence timeout (3 seconds)
  • Press q — Quit application

What It Does

  1. Captures audio from your default microphone
  2. Creates real-time avatar animation as you speak
  3. Shows live video using LocalVideoPlayer
  4. Automatically detects voice activity and silence
Key features:
  • Real-time audio processing at 24kHz
  • Voice activity detection with configurable threshold (-40dB)
  • Automatic silence detection (3-second timeout)
  • Local audio/video processing (no web interface)

Command Line Options

# Adjust volume and silence detection
python examples/avatar-with-microphone.py \
  --volume 1.5 \
  --silent-threshold-db -35

# Enable audio echo for testing
python examples/avatar-with-microphone.py --echo
OptionDefaultDescription
--modelenvPath to .imx model file
--api-secretenvYour bitHuman API secret
--volume1.0Audio volume multiplier
--silent-threshold-db-40Silence threshold in dB
--echooffEnable audio echo for testing

Advanced Usage

# More sensitive (picks up quieter voices)
python examples/avatar-with-microphone.py --silent-threshold-db -50

# Less sensitive (only loud voices)
python examples/avatar-with-microphone.py --silent-threshold-db -30

# Boost quiet microphones
python examples/avatar-with-microphone.py --volume 2.0

Common Issues

ProblemSolution
No microphone inputCheck microphone permissions in system settings
Avatar not respondingSpeak louder or adjust --silent-threshold-db to lower value
Performance lagClose other audio applications, use wired microphone
Audio echo/feedbackDon’t use --echo flag, use headphones

Technical Details

ComponentSpecification
Audio sample rate24kHz
InputMono microphone
Buffer240 samples per chunk (10ms)
Silence detection-40dB threshold, 3s timeout

Next Steps