3.6 KiB
TEN VAD Integration Guide
This guide explains how to integrate and use TEN VAD (Voice Activity Detection) in the XiaoZhi ESP32 Server.
Overview
TEN VAD is a high-performance voice activity detection system that can be used as an alternative to Silero VAD. It provides accurate voice detection with configurable thresholds and parameters.
Installation
Method 1: Automatic Installation (Recommended)
Run the installation script:
cd main/xiaozhi-server
python scripts/install_ten_vad.py
Method 2: Manual Installation
- Install the TEN VAD package:
pip install ten-vad
- Create the model directory:
mkdir -p models/ten-vad
- The model files will be downloaded automatically on first use.
Configuration
The TEN VAD configuration is already added to your .config.yaml file:
VAD:
TenVAD:
type: ten_vad
model_path: models/ten-vad
sample_rate: 16000
frame_size: 512
threshold: 0.5
threshold_low: 0.2
min_silence_duration_ms: 1000
frame_window_threshold: 3
Configuration Parameters
model_path: Path to the TEN VAD model filessample_rate: Audio sample rate (default: 16000 Hz)frame_size: Audio frame size for processing (default: 512 samples)threshold: High threshold for voice detection (0.0-1.0)threshold_low: Low threshold for voice detection (0.0-1.0)min_silence_duration_ms: Minimum silence duration to consider speech endedframe_window_threshold: Number of positive frames needed to detect voice
Usage
To use TEN VAD, update your configuration:
selected_module:
VAD: TenVAD # Change from SileroVAD to TenVAD
Performance Tuning
Sensitivity Adjustment
- More Sensitive: Lower
thresholdandthreshold_lowvalues - Less Sensitive: Higher
thresholdandthreshold_lowvalues
Responsiveness
- Faster Response: Lower
frame_window_thresholdvalue - More Stable: Higher
frame_window_thresholdvalue
End-of-Speech Detection
- Quicker Cutoff: Lower
min_silence_duration_ms - More Patient: Higher
min_silence_duration_ms
Troubleshooting
Common Issues
-
Import Error: Make sure
ten-vadpackage is installedpip install ten-vad -
Model Loading Error: Ensure the model path exists and is accessible
ls -la models/ten-vad/ -
Performance Issues: Try adjusting
frame_sizeorsample_rate
Debug Logging
Enable debug logging to see TEN VAD detection results:
log:
log_level: DEBUG
This will show periodic VAD detection results in the logs.
Comparison with Other VAD Systems
| Feature | TEN VAD | Silero VAD |
|---|---|---|
| Accuracy | High | High |
| Speed | Fast | Fast |
| Memory Usage | Medium | Low |
| Model Size | Medium | Small |
| Language Support | Multi | Multi |
Advanced Configuration
Custom Model Path
If you have a custom TEN VAD model:
VAD:
TenVAD:
model_path: /path/to/your/custom/model
Multiple Configurations
You can define multiple TEN VAD configurations:
VAD:
TenVAD_Sensitive:
type: ten_vad
threshold: 0.3
threshold_low: 0.1
TenVAD_Conservative:
type: ten_vad
threshold: 0.7
threshold_low: 0.4
Support
For issues specific to TEN VAD integration:
- Check the logs for error messages
- Verify the installation using the installation script
- Test with different threshold values
- Refer to the TEN VAD documentation: https://github.com/ten-framework/ten-vad
For general XiaoZhi ESP32 Server issues, refer to the main documentation.