This problem appears in institutional bedside device fleets, not in a one-off consumer video call. The devices need to stay online for long periods, support hands-free calling, pick up speech from a practical distance, and keep speech intelligible while the room is noisy.

After the speaker and microphone were placed inside a compact plastic enclosure, the device needed more usable loudness, more stable pickup, and better echo behavior at the same time. The acoustic structure, capture path, playback path, sample-rate adaptation, and AEC delay setting all interact with WebRTC audio processing.

Problem Context

The device worked as a calling terminal, but the audio quality was not stable enough for a real bedside environment. A speaker placed behind the shell can lose volume because the output path is blocked or reflected inside the housing. A nearby microphone can also pick up structural leakage and speaker energy before the echo canceller receives a manageable input.

The goal was practical: make speech louder, reduce obvious echo, and keep the pickup usable without turning the device into a complex external audio setup.

Acoustic Structure Changes

The first change was mechanical. Part of the shell around the speaker output path was removed, so the sound path became less blocked. The result was straightforward: the output sounded louder, and less energy stayed trapped inside the small cavity.

Acoustic structure before and after

The useful lesson is that echo is not always solved by software first. If the enclosure keeps reflecting speaker energy back into the microphone side, the AEC has to solve a harder problem than necessary.

Microphone Seal Path

The second hardware change was around the microphone opening. A small sealing pad was added around the microphone path. The purpose was not decoration; it reduced leakage between the shell surface and the microphone path, so the microphone received less unwanted speaker energy through the structure.

Microphone seal path

After this change, the pickup path became more predictable. That made later WebRTC tuning more meaningful, because the input signal was closer to the real acoustic path instead of a mix of speech, leakage, and enclosure reflection.

WebRTC Source Adaptation

The software side also needed changes. The WebRTC source was adapted to handle the device’s sampling behavior more carefully. The audio capture and playback path must agree on the effective sample rate and channel assumptions before AEC tuning can be trusted.

The AEC delay parameter was also adjusted for the device. In a compact embedded terminal, the real delay includes capture buffering, playback buffering, resampling, device scheduling, and the physical speaker-to-microphone path, not only the value configured in the algorithm.

Validation Method

The validation path should keep variables stable:

  • same device placement.
  • same speaker volume.
  • same speaking distance.
  • same background-noise condition.
  • same test phrase or playback source.
  • same recording and comparison method.

AEC delay validation flow

The validation target is to confirm that loudness improved, residual echo became lower, speech remained understandable, and the AEC no longer fought a mismatched sample-rate or delay assumption.

Takeaway

For bedside WebRTC devices, echo and noise optimization is a joint hardware and software problem. Removing part of the speaker-side obstruction improved loudness. Sealing the microphone path reduced leakage and echo pickup. WebRTC source changes, sample-rate adaptation, and AEC delay tuning then became more effective because the acoustic input was cleaner.

The reusable lesson is simple: tune the physical acoustic path first, then tune the AEC parameters against that real path.