Skip to content

Speech to speech: mute/unmute independent from voice state#5794

Open
pranavjoshi001 wants to merge 1 commit intomicrosoft:mainfrom
pranavjoshi001:mute-enhancement
Open

Speech to speech: mute/unmute independent from voice state#5794
pranavjoshi001 wants to merge 1 commit intomicrosoft:mainfrom
pranavjoshi001:mute-enhancement

Conversation

@pranavjoshi001
Copy link
Copy Markdown
Contributor

@pranavjoshi001 pranavjoshi001 commented Apr 1, 2026

Description

This PR enhances the mute/unmute functionality for Speech-to-Speech (S2S) by separating microphoneMuted, making mute a client-side control independent of the agent state machine.

Problem
Previously, muted was part of the voiceState enum (idle' | 'listening' | 'muted' | ...), which caused issues:

  • Muting changed the voice state, conflating client control with agent state
  • Could only mute from listening state but in that is not always desired

Detach it from voice state machine would fix all above.

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

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 refactors Speech-to-Speech (S2S) mute handling by decoupling “muted” from the voiceState state machine and tracking it as a separate client-controlled flag.

Changes:

  • Add microphoneMuted to the core voice reducer state and remove 'muted' from the VoiceState union.
  • Update S2S recording bridge and hook (useVoiceRecordingMuted) to use microphoneMuted instead of deriving mute from voiceState.
  • Update the HTML2 S2S mute/unmute integration test to validate the new behavior and reset-on-stop semantics.

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
packages/core/src/reducers/voiceActivity.ts Introduces microphoneMuted state and updates mute/unmute/stop transitions.
packages/core/src/actions/setVoiceState.ts Removes 'muted' from the VoiceState type.
packages/api/src/providers/SpeechToSpeech/private/VoiceRecorderBridge.tsx Switches mute source to useVoiceRecordingMuted and reorders effects.
packages/api/src/hooks/useVoiceRecordingMuted.ts Uses voice.microphoneMuted selector and documents new semantics.
tests/html2/speechToSpeech/mute.unmute.html Updates integration assertions to track microphoneMuted separately from voiceState.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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