Skip to content

feat(voice): audio-reactive waveform while recording (no live transcript)#634

Merged
Gagancreates merged 2 commits into
devfrom
feat/voice-reactive-waveform
Jun 22, 2026
Merged

feat(voice): audio-reactive waveform while recording (no live transcript)#634
Gagancreates merged 2 commits into
devfrom
feat/voice-reactive-waveform

Conversation

@Gagancreates

Copy link
Copy Markdown
Collaborator

What

When the mic is active in the chat input, show only a live audio-reactive waveform instead of the transcribed words. The transcript is still captured and submitted on send — it's just not displayed while recording.

Behavior

  • Waveform grows from the left to full width as recording continues, then scrolls (oldest bars drop off the left).
  • Bar heights track real mic amplitude via an auto-gain (running peak: instant attack, slow release) computed at capture time, so the waveform accurately reflects how loud/soft the voice is — independent of mic/OS input gain.
  • Smooth + responsive: ~16 amplitude updates/sec (1024-sample frames), new bars animate in (grow + fade), and existing bars flow via height transitions.

Implementation

  • useVoiceMode.ts — compute per-frame RMS in the existing audio-process callback, normalize against a running peak, and expose a capped rolling history via audioLevelsRef.
  • chat-input-with-mentions.tsx — rewrote VoiceWaveform to render the live, growing, audio-reactive bars; removed the transcribed-words span from the recording bar.
  • Threaded audioLevelsRef through AppChatSidebarChatInputWithMentionsVoiceWaveform.

Tuning knobs

  • PEAK_DECAY / MIN_PEAK (hook) — release speed and silence floor for the auto-gain.
  • WAVE_CURVE, WAVE_BAR_* (component) — height curve and bar sizing.

Notes

Transcription pipeline (Deepgram streaming, submit/cancel) is unchanged.

When recording, the chat input now displays only a live waveform that
accumulates from the left and grows to full width, with bar heights
driven by real mic amplitude. The transcribed words are still captured
and submitted, just not shown while recording. New bars animate in and
flow smoothly at ~16 updates/sec.
Normalize each frame's amplitude against a running peak (instant attack,
slow release) at capture time and map it with a near-linear curve, so bar
heights accurately reflect how loud/soft the voice is regardless of mic
gain — replacing the old fixed-gain sqrt curve that saturated near max.
@Gagancreates Gagancreates changed the base branch from main to dev June 22, 2026 21:10
@Gagancreates Gagancreates merged commit a12bf48 into dev Jun 22, 2026
2 checks passed
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.

1 participant