Voice ModePRO
A full-screen voice conversation: a reactive orb, live word-by-word captions and call controls.
Code
11 files · 1,900 lines of TypeScriptPRO
Voice Mode is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- One orb carries the whole conversation: it listens, thinks and speaks through the orb's own states, swells slightly while the assistant talks and draws in while it thinks. Pick the orb with `orb`; feed `level` from your audio graph to make it follow the real voice.
- Captions reveal word by word even when the transcript arrives in chunks, catching up to whatever text has come in. Only three lines stay: the newest at full size, older ones step down, dim and drift up before they leave.
- Controls are labelled under each button like a call screen. Space mutes, Esc interrupts while the assistant is thinking or speaking, C toggles captions; hotkeys ignore text fields and inert previews.
- The state label and its hint swap with a short vertical slide so a change of turn is noticed without looking at the orb. With reduced motion, the orbs hold still frames and captions appear whole.
Usage
Example
<div className="h-dvh">
<VoiceMode
state={state} // from your realtime session
level={level} // AnalyserNode RMS, 0–1
captions={transcript} // [{ role: "user", text }, { role: "assistant", text }]
muted={muted}
onMuteChange={setMuted}
onInterrupt={() => session.cancelResponse()}
onEnd={() => session.close()}
/>
</div>
// Without a speech-to-speech API, wire it to the same /api/chat route as
// Chat App: transcribe the mic, send() the text with useChat, set state to
// "thinking" while status is "submitted", stream the reply's text into an
// assistant caption, and speak it with your TTS of choice ("speaking").Props
| Prop | Type | Default | Description |
|---|---|---|---|
| state | "idle" | "listening" | "thinking" | "speaking" | — | Whose turn it is. |
| level | number | — | Live audio level 0–1: the mic while listening, playback while speaking. Omit to simulate. |
| captions | { id?, role: "user" | "assistant", text }[] | [] | The transcript. Grow the last item's text as it streams. |
| orb | "particles" | "voice" | "glass" | "halo" | "blob" | "particles" | Which orb sits in the middle. |
| orbSize | number | 280 | Orb size in px. |
| muted / defaultMuted / onMuteChange | boolean / boolean / (muted) => void | — | Microphone mute, controlled or not. |
| onInterrupt | () => void | — | Cut the assistant off. Enabled while thinking or speaking. |
| onEnd | () => void | — | End the call. |
| showCaptions / defaultShowCaptions / onShowCaptionsChange | boolean / boolean / (show) => void | — / true / — | Captions visibility. |
| startedAt | number | — | Call start (ms since epoch). Without it the timer counts from mount. |
| wordMs | number | 90 | Milliseconds between revealed caption words. |
| hotkeys | boolean | true | Space, Esc and C shortcuts. |
| title | ReactNode | "Voice" | Shown top left. |
| className | string | — | Classes for the root. Give it a height. |