Skip to content

Add second audio channel for voice#169875

Draft
synesthesiam wants to merge 2 commits intodevfrom
synesthesiam-20260505-voice-2-channels
Draft

Add second audio channel for voice#169875
synesthesiam wants to merge 2 commits intodevfrom
synesthesiam-20260505-voice-2-channels

Conversation

@synesthesiam
Copy link
Copy Markdown
Contributor

@synesthesiam synesthesiam commented May 5, 2026

Breaking change

Proposed change

NOTE: Requires an updated aioesphomeapi that hasn't been released yet

Adds a second audio channel to voice API audio. This allows for providing the best audio for different parts of the voice pipeline: home-assistant/architecture#1364

This code assumes that channel 0 (the default) contains "enhanced" audio with automatic gain control, noise suppression, etc. and that channel 1 (new) contains "unenhanced" audio.

When the voice assistant has the MULTI_CHANNEL_AUDIO feature flag, a second "unenhanced" audio channel may be preset as data2 in the handle_audio method of the ESPHome Assist Satellite entity. The STT_START voice event is checked for the audio preferences of the pipeline's speech-to-text entity. If the stt entity prefers not to have automatic gain control and noise suppression, then channel 1 is selected for the pipeline run.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings May 5, 2026 21:58
@home-assistant home-assistant Bot added cla-signed has-tests integration: assist_pipeline integration: esphome new-feature Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage labels May 5, 2026
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 5, 2026

Hey there @arturpragacz, mind taking a look at this pull request as it has been labeled with an integration (assist_pipeline) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of assist_pipeline can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign assist_pipeline Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 5, 2026

Hey there @jesserockz, @kbx81, @bdraco, mind taking a look at this pull request as it has been labeled with an integration (esphome) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of esphome can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign esphome Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@synesthesiam synesthesiam changed the title Synesthesiam 20260505 voice 2 channels Add second audio channel for voice May 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds multi-channel audio support for ESPHome Assist Satellites by exposing STT audio-processing preferences via the Assist pipeline STT_START event and selecting an “unenhanced” audio channel when the STT provider indicates it prefers no AGC/noise reduction.

Changes:

  • Include audio_processing (from the selected STT provider) in the Assist pipeline STT_START event payload.
  • Track multi-channel audio capability in the ESPHome assist satellite and optionally switch to channel 1 based on STT_START preferences.
  • Add/adjust tests and snapshots to validate the new event payload and channel-selection behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
homeassistant/components/esphome/assist_satellite.py Adds multi-channel capability tracking and audio-channel selection based on STT_START audio processing preferences.
homeassistant/components/assist_pipeline/pipeline.py Emits audio_processing preferences in the STT_START pipeline event.
tests/components/esphome/test_assist_satellite.py Adds coverage for multi-channel selection and channel-0 fallback behavior.
tests/components/assist_pipeline/snapshots/test_websocket.ambr Updates websocket snapshots to include audio_processing in STT_START data.
tests/components/assist_pipeline/snapshots/test_init.ambr Updates init snapshots to include audio_processing in STT_START data.

Comment on lines +581 to 593
# Default to enhanced audio (channel 0)
active_data = data

if (
self._has_multi_channel_audio
and (data2 is not None)
and (self._active_audio_channel == 1)
):
# Non-enhanced audio (channel 1)
active_data = data2

self._audio_queue.put_nowait(active_data)

Comment on lines +2351 to +2359
async with asyncio.timeout(1):
await satellite.handle_pipeline_start(
conversation_id="",
flags=VoiceAssistantCommandFlag(0), # stt
audio_settings=VoiceAssistantAudioSettings(),
wake_word_phrase=None,
)
await satellite.handle_audio(b"channel 0", b"channel 1")
await satellite.handle_pipeline_stop(abort=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

by-code-owner cla-signed has-tests integration: assist_pipeline integration: esphome new-feature Quality Scale: internal Quality Scale: platinum Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants