Repository navigation
Add features for caption exports, speaker segments, and session telemetry - #23
Merged
Merged
Conversation
### Added
- **Caption export helpers.** New `toSRT()` and `toWebVTT()` exports that
convert a Deepgram pre-recorded transcription response (word timings, or
utterances when `utterances=true`) into SubRip / WebVTT subtitle text.
Cue segmentation is tunable via `CaptionOptions` (`lineLength`, `lineCount`,
`speakerLabels` for diarized `Speaker N:` prefixes). Pure functions — no
network or native calls.
- **Speaker-attributed transcripts.** New `toSpeakerSegments()` export that
folds a diarized (`diarize=true`) response into ordered
`SpeakerSegment { speaker, text, start, end, confidence }` chunks, merging
consecutive words from the same speaker. Returns `[]` for non-diarized
responses instead of throwing.
- **Session telemetry.** `useDeepgramSpeechToText` and `useDeepgramVoiceAgent`
now expose a `getStats()` method returning a `SessionStats` snapshot
(`bytesSent`, `bytesReceived`, `framesDropped`, `reconnects`,
`connectedAtMs`, `firstResultMs`). An opt-in `trackStats` prop additionally
enables a reactive `stats` return value, throttled to at most one update per
second so it never floods renders.
- **Voice Agent barge-in.** Opt-in `bargeIn` prop on `useDeepgramVoiceAgent`
flushes the native playback queue when the server reports
`UserStartedSpeaking` while agent audio is playing, so the agent audibly
stops when the user talks over it. Fires the new `onBargeIn` callback only
when a flush actually happened; never flushes while muted, and the streaming
player resumes seamlessly on the agent's next turn. Reliable barge-in
depends on hardware echo cancellation — test on a physical device.
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.
Introduce new caption export helpers for converting transcription responses into SubRip and WebVTT formats. Add functionality for creating speaker-attributed transcripts from diarized responses. Implement session telemetry with an opt-in tracking feature for real-time statistics. Enhance voice agent capabilities with a barge-in feature for improved user interaction. All additions maintain backward compatibility.