Update speech recognition result timestamps explainer - #206
Merged
Conversation
WebAudio#203) * Update audioStartTime and audioEndTime to be relative to start of audio stream We want to switch to stream-Relative (0-based) impl. since: - In Web Audio and Media APIs (HTMLMediaElement.currentTime, AudioContext.currentTime, WebCodecs VideoFrame.timestamp), media timelines are always 0-based offsets relative to stream start, not the time origin. - Immune to inter-process jitter since SODA and audio capture run in a separate utility/browser process. Translating stream offsets to the renderer's timeOrigin relies on estimating when IPC AudioStarted() arrived, which introduces IPC latency jitter. Stream-relative offsets are not prune to this and aligns with the raw audio frames. - If SpeechRecognition is used with a pre-recorded MediaStreamTrack, a 0-based stream offset reflects the actual position in the audio track regardless of when the webpage was loaded. - Being relative to performance.timeOrigin doesn't make sense in general for the Web Speech API because it assumes that the audio source is live. Since a SpeechRecognizer can also be created for a prerecorded media stream I think the timestamps on the speech recognition events should be relative to the position in that media stream. See https://crbug.com/542330168 for more details. * Update speech recognition explainer with timestamp conversion Added a section on converting stream timestamps to document time origin and provided a live translation latency example with code. * Minor update to close live transcription latency measurement example Added separator before security section and closed example section for live transcription measurements. * respond to review comment
…atives and refactor Timestamps to use Seconds (WebAudio#205) * Expand on limitations of existing speech recognition events Added detailed explanations regarding the limitations of existing API surfaces for tracking latency in speech recognition in the Alternatives Considered section, including issues with `speechstart` and `speechend` events and the implications of modifying `event.timeStamp`. * Refactor speech recognition timestamps to use seconds Updated the speech recognition result timestamps to use seconds instead of milliseconds, improving consistency with other Web APIs. Added detailed explanations for the choice of time representation, proposed behavior, and security considerations. Based off of comments from WebAudio#205
Merge changes from original repo
Removed sections discussing the limitations of `speechend` and the overloading of `SpeechRecognitionEvent.timeStamp`. Added a note about attaching `speechStartTime` and `speechEndTime` to `SpeechRecognitionResult` for better timeline association.
Updated the discussion on using existing event timestamps for speech recognition results, highlighting their limitations and the benefits of attaching timestamps directly to SpeechRecognitionResult.
Removed redundant points about interim results and trailing silence skew from the explanation of existing VAD and result event timestamps.
Updated the explanation of timestamp limitations in the Web Speech API and provided a clearer example of synchronizing captions with live video frames, including a playout buffer delay for ASR processing.
Added a link to an interactive demo for synchronizing captions with live WebRTC video frames.
alan33d
commented
Sep 1, 2026
alan33d
marked this pull request as ready for review
September 1, 2026 05:02
evanbliu
approved these changes
Sep 1, 2026
Updated example to clarify live video conferencing with accurate caption synchronization and added details on handling captions during live calls and post-meeting replay.
reillyeon
approved these changes
Sep 2, 2026
alan33d
added a commit
that referenced
this pull request
Sep 4, 2026
* Update audioStartTime and audioEndTime to be relative to start of audio stream We want to switch to stream-Relative (0-based) impl. since: - In Web Audio and Media APIs (HTMLMediaElement.currentTime, AudioContext.currentTime, WebCodecs VideoFrame.timestamp), media timelines are always 0-based offsets relative to stream start, not the time origin. - Immune to inter-process jitter since SODA and audio capture run in a separate utility/browser process. Translating stream offsets to the renderer's timeOrigin relies on estimating when IPC AudioStarted() arrived, which introduces IPC latency jitter. Stream-relative offsets are not prune to this and aligns with the raw audio frames. - If SpeechRecognition is used with a pre-recorded MediaStreamTrack, a 0-based stream offset reflects the actual position in the audio track regardless of when the webpage was loaded. - Being relative to performance.timeOrigin doesn't make sense in general for the Web Speech API because it assumes that the audio source is live. Since a SpeechRecognizer can also be created for a prerecorded media stream I think the timestamps on the speech recognition events should be relative to the position in that media stream. See https://crbug.com/542330168 for more details. * Update speech recognition explainer with timestamp conversion Added a section on converting stream timestamps to document time origin and provided a live translation latency example with code. * Minor update to close live transcription latency measurement example Added separator before security section and closed example section for live transcription measurements. * respond to review comment * Update speech recognition result timestamps explainer (#206) Revised explainer to focus on timeline association use cases with the new SpeechRecognitionResult timestamps. Provided 2 examples and interactive demo. * change click-to-seek granularity from word to phrase
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
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.
Remove latency tracking uses cases since SpeechRecognitionEvent timestamps can be used for that purpose. Instead focus on developer need for timeline association use cases in the updated explainer and alternatives considered.