Skip to content

Add opt-in acoustic echo cancellation to Swift WakeWordListener#84

Closed
rajan9519 wants to merge 1 commit into
livekit:mainfrom
rajan9519:swift-optional-echo-cancellation
Closed

Add opt-in acoustic echo cancellation to Swift WakeWordListener#84
rajan9519 wants to merge 1 commit into
livekit:mainfrom
rajan9519:swift-optional-echo-cancellation

Conversation

@rajan9519

Copy link
Copy Markdown

What

Adds an opt-in echoCancellation flag to the Swift WakeWordListener.

Why

WakeWordListener captures raw microphone audio, so anything the device is
playing out — e.g. an assistant's own TTS — bleeds into the detection window
and can trigger false positives.

How

  • New echoCancellation: Bool = false init parameter. When true, the mic is
    routed through the platform's voice-processing I/O unit
    (setVoiceProcessingEnabled(true)), which references the device output and
    subtracts it from the captured signal.
  • Enabled before reading the input format, since toggling voice processing
    changes the node's format.
  • On iOS the session mode switches from .measurement to .voiceChat, because
    .measurement disables system signal processing including AEC.
  • If the platform can't enable it, start() throws the new
    WakeWordError.echoCancellationUnavailable rather than silently capturing raw
    audio, so callers that opted in aren't misled.
  • README documents the flag.

Compatibility

Default is false, so existing callers are unchanged. No public API removed.

Testing

swift build and swift test pass (7 tests, 3 pre-existing skips). The
Python-only CI is unaffected.

@CLAassistant

CLAassistant commented Jun 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rajan9519 rajan9519 closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants