Skip to content

docs: silenceTimeout documented as anchored on 'last recognized result' but the timer is armed on speechend #249

Description

@untemps

Summary

The silenceTimeout row in the Vocal component API table (README.md:277) states the session stops "after this many ms of inactivity following the last recognized result." The implementation arms the silence timer on the speechend event, not on a recognition result.

Current state

The silence timer is started in _onSpeechEnd (src/components/Vocal.tsx:239: if (continuousRef.current && (silenceTimeoutRef.current ?? 0) > 0) startSilenceTimer()), cancelled on speechstart, on session start, and on end. _onResult never arms it. The adjacent comment (Vocal.tsx:236-238) explains why: in continuous mode @untemps/vocal intercepts intermediate result events and _onResult only runs once on the aggregated end-of-session event. Because result effectively fires only once at session end, describing the anchor as "following the last recognized result" misrepresents the mechanism — a reader could expect the timer to reset on per-segment results.

Proposed improvement

Reword the silenceTimeout description to reflect the speechend anchor, e.g.: "automatically stop the session after this many ms of silence following the last detected speech (the speechend event)."

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions