-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Core speech to speech implementation #5654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pranavjoshi001
wants to merge
17
commits into
microsoft:main
Choose a base branch
from
pranavjoshi001:feature/core-s2s-composer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Core speech to speech implementation #5654
pranavjoshi001
wants to merge
17
commits into
microsoft:main
from
pranavjoshi001:feature/core-s2s-composer
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…joshi001/BotFramework-WebChat into feature/core-s2s-composer
OEvgeny
reviewed
Jan 13, 2026
compulim
reviewed
Jan 13, 2026
compulim
reviewed
Jan 13, 2026
…joshi001/BotFramework-WebChat into feature/core-s2s-composer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Entry
TBD
Description
This PR introduces Speech-to-Speech (S2S) functionality in Web Chat, enabling real-time voice conversations with bots. The implementation includes audio recording via AudioWorklet, audio playback with buffer queueing, and speech state management. This foundation supports upcoming MMRT (Multi-Modal Real-Time), ABS (Azure Bot Service), and CCV2 integration changes.
Activity structure - microsoft/Agents#377
Note - Utilizing
valueinstead ofpayloaduntil we have proposal merged in.Design
The Speech-to-Speech feature is built on three main components:
useVoiceActivities.ts) - Filters and provides voice-specific activities from the Redux store'svoiceActivitiessliceSpeechToSpeechComposer.tsx) - A React context provider that manages:useRecorder.tshook using Web Audio API with AudioWorklet (CSP compliant)useAudioPlayer.tshook with proper queueing and timingidle,listening,user_speaking,processing,bot_speaking)recording,setRecording, andspeechStatefor consumer UI componentsSpeech State Flow
idle → listening → user_speaking → processing → bot_speaking → listening
The provider is designed to work with the existing Web Chat architecture, consuming voice activities from the Redux store and posting audio data through the
postActivityhook.Performance Optimization
A new
voiceActivitiesslice has been introduced in the Redux store to optimize voice activity handling:activitiesarrayvoice chunk delta,bot states, etc. bypass expensive sorting and grouping operationsSpecific Changes
New Files Added:
Core Utilities (packages/core)
isVoiceActivity.ts- Type guard for voice/DTMF activitiesisVoiceTranscriptActivity.ts- Type guard for transcript activities (voice.transcript)getVoiceTranscriptRole.ts- Extract role (user/bot) from voice transcriptgetVoiceTranscriptText.ts- Extract transcription text from voice activityProvider & Hooks (packages/api)
SpeechToSpeechComposer.tsx- Main S2S provider component (integrated into Composer)useSpeechToSpeech.ts- Public hook to consume S2S contextuseVoiceActivities.ts- Hook to select voice activities from storeuseAudioPlayer.ts- Audio playback with buffer queueing (Base64 → Int16 → Float32)useRecorder.ts- AudioWorklet-based recording (Float32 → Int16 → Base64)SpeechState.ts- Speech state type definitionRedux Store (packages/core)
voiceActivitiesslice for storing non-transcript voice eventsTest Coverage Added:
Next Steps:
CHANGELOG.mdReview Checklist
z-index)package.jsonandpackage-lock.jsonreviewed