Clear Conversations, No Echo
Echo-ul degradează conversația și poate confuza STT-ul. AEC (Acoustic Echo Cancellation) elimină feedback-ul audio.
Types of Echo
Acoustic Echo
Sound from speaker picked up by microphone in same room.
Speaker output → Room acoustics → Microphone input
Common with speakerphones, laptops, smart speakers
Line (Hybrid) Echo
Signal reflection at 2-wire/4-wire conversion points in PSTN.
Impedance mismatch causes signal reflection
Common in PSTN gateways, international calls
How AEC Works
Reference Signal Capture
AEC captures the audio being sent to the speaker (far-end signal).
Estimate Echo Path
Adaptive filter learns how far-end signal appears in microphone input (room acoustics, delays, frequency response).
Generate Anti-Echo
Create inverted estimate of echo component.
Subtract from Microphone
Remove echo while preserving near-end speaker's voice.
AEC Signal Flow
Far-end audio (from caller)
│
▼
┌───────┐
│Speaker│ ──────────────────────────┐
└───────┘ │ (acoustic path)
▼
┌───────┐ ┌─────────┐ ┌──────────┐
│ Mic │ ──► │ AEC │ ──► │ Clean │ ──► To STT/Recording
└───────┘ │ Filter │ │ Output │
▲ └────┬────┘ └──────────┘
│ │
│ Reference signal (speaker output)
│
Near-end speaker (local user)AEC Parameters
How far back to look for echo
Aggressiveness of echo removal
How fast filter adapts
Echo Return Loss Enhancement
Echo Metrics
Double-Talk Detection
When both parties speak simultaneously, AEC must not remove the near-end voice:
Far-End Only
Only caller speaking. AEC adapts and subtracts echo.
Normal operationNear-End Only
Only local user speaking. AEC passes through.
Pass-through modeDouble-Talk
Both speaking. AEC freezes adaptation to protect near-end.
Freeze & protectVoice AI Considerations
Why Echo Matters for Voice AI
- • STT hears AI's own speech → transcription errors
- • Barge-in detection fails
- • User frustration from hearing themselves
- • Call quality scores drop
Best Practices
- ✓ Apply AEC before STT input
- ✓ Use reference signal from TTS output
- ✓ Monitor ERLE in production
- ✓ Test with various device types
WebRTC AEC
// Enable WebRTC echo cancellation
const constraints = {
audio: {
echoCancellation: true,
echoCancellationType: 'system', // or 'browser'
autoGainControl: true,
noiseSuppression: true,
}
};
const stream = await navigator.mediaDevices
.getUserMedia(constraints);
// Check if AEC is actually enabled
const track = stream.getAudioTracks()[0];
const settings = track.getSettings();
console.log('Echo cancellation:', settings.echoCancellation);