Voice Chat
UseBelha supports real-time voice conversations through a secure WebSocket proxy (/api/live). Users can speak naturally and hear responses instantly.
Emotion-Aware Voice
Voice templates can enable emotion-aware responses for more natural conversations.
Voice Templates
Voice Assistant
tpl_voiceFriendly voice assistant for general conversations. Uses Puck voice.
Voice Support Agent
tpl_voice_supportEmpathetic customer support via voice. Uses Kore voice.
Available Voices
| Voice | Description | Style |
|---|---|---|
Puck | Friendly and casual | Neutral |
Charon | Professional and calm | Male |
Kore | Warm and empathetic | Female |
Fenrir | Confident and energetic | Male |
Aoede | Clear and articulate | Female |
Voice Configuration
Add voice support to any agent:
json
{
"name": "My Voice Agent",
"systemPrompt": "You are a helpful voice assistant...",
"voice": {
"enabled": true,
"voiceName": "Kore",
"affectiveDialog": true
}
}How It Works
- Connection - Browser connects to
/api/liveWebSocket proxy - Audio Capture - Microphone captures 16-bit PCM at 16kHz
- Streaming - Audio streams through the backend proxy to the voice service
- Response - AI generates audio response in real-time
- Playback - Response plays through speakers at 24kHz
Using the useLiveChat Hook
typescript
import { useLiveChat } from '@/lib/useLiveChat';
const {
isConnected, // WebSocket connected
isConnecting, // Connection in progress
isListening, // Microphone active
isSpeaking, // AI generating audio
messages, // Chat history with transcriptions
connect, // Start connection
disconnect, // Close connection
startListening, // Begin voice capture
stopListening, // Stop voice capture
sendText, // Send text message
interrupt, // Stop current playback
} = useLiveChat({
systemPrompt: 'You are a helpful assistant.',
voiceName: 'Kore',
affectiveDialog: true,
});Audio Requirements
| Direction | Format | Sample Rate |
|---|---|---|
| Input (microphone) | 16-bit PCM, little-endian | 16kHz |
| Output (speakers) | 16-bit PCM, little-endian | 24kHz |
Testing Voice
- Open the Dashboard
- Select a voice template (tpl_voice or tpl_voice_support)
- Click Quick Test
- Allow microphone access when prompted
- Click the microphone button to start speaking
Browser Support
Voice requires a modern browser with WebSocket, AudioWorklet, and microphone permissions. Chrome, Edge, and Firefox are recommended.