Skip to content

Update SpeechRecognitionResult with audio timing attributes#192

Open
alan33d wants to merge 1 commit into
WebAudio:mainfrom
alan33d:patch-1
Open

Update SpeechRecognitionResult with audio timing attributes#192
alan33d wants to merge 1 commit into
WebAudio:mainfrom
alan33d:patch-1

Conversation

@alan33d

@alan33d alan33d commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Added audioStartTime and audioEndTime attributes to SpeechRecognitionResult interface with explanations as proposed in #191.

Fixes: #191


Preview | Diff

Added audioStartTime and audioEndTime attributes to SpeechRecognitionResult interface with explanations as proposed in WebAudio#191
@alan33d alan33d marked this pull request as ready for review July 14, 2026 04:14
@alan33d alan33d marked this pull request as draft July 14, 2026 04:15
@alan33d alan33d marked this pull request as ready for review July 14, 2026 04:15
@alan33d alan33d marked this pull request as draft July 14, 2026 05:28
@alan33d alan33d marked this pull request as ready for review July 14, 2026 05:32
Comment thread index.bs
Comment thread index.bs

<dl>
<dt><dfn attribute for=SpeechRecognitionResult>audioStartTime</dfn> attribute</dt>
<dd>A nullable {{DOMHighResTimeStamp}} representing the start of the audio segment corresponding to this recognition result, in milliseconds relative to the time origin. Returns null if the underlying recognition engine does not support audio segment start timestamps.</dd>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC SpeechSynthesisEvent uses elapsedTime, which is float.

Is there a specific design reason for using DOMHighResTimeStamp here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No specific reason, I started with double? but it was suggested by @evanbliu to use DOMHighResTimeStamp? to mirror event.timeStamp property. I don't have a strong preference on this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIUC, DOMHighResTimeStamp is just a typedef for a double but it makes it clear that the units are in milliseconds.

I assume SpeechSynthesisEvent uses float because DOMHighResTimeStamp didn't exist (or at least wasn't widely adopted) back in 2012.

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.

Add SpeechRecognitionResult Timestamps

3 participants