Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 3, 2025

Generated with mux

Replaces the static animated bars with a custom sliding window waveform that shows the last 10 seconds of audio amplitude - similar to ChatGPT's recording UI.

Features

  • 10-second sliding window: Shows audio history with new samples appearing on the right and sliding left
  • Mode-colored: Visualization uses plan (blue) or exec (purple) based on current mode
  • Full-width responsive: Bars dynamically fill the container at any viewport size
  • Smooth visualization: RMS amplitude calculation with 50ms sampling interval

Technical

  • Custom SlidingWaveform component using canvas and Web Audio API
  • AnalyserNode for real-time audio amplitude sampling
  • ResizeObserver for responsive container measurement
  • Exposed MediaRecorder from useVoiceInput hook

@ammar-agent ammar-agent force-pushed the waveform-mode-color-matching branch from f51f379 to 6061497 Compare December 3, 2025 04:55
@ammar-agent ammar-agent changed the title 🤖 fix: match waveform recording color to current mode 🤖 feat: sliding window audio waveform for voice recording Dec 3, 2025
@ammar-agent ammar-agent force-pushed the waveform-mode-color-matching branch from 6061497 to ae64c50 Compare December 3, 2025 04:57
- Recording overlay border/background uses mode color (plan=blue, exec=purple)
- WaveformBars use bg-plan-mode or bg-exec-mode based on mode
- Recording text uses mode-light variant for better contrast
- VoiceInputButton receives mode prop for consistent styling
- Transcribing state remains amber (processing indicator)
- Add react-audio-visualize for real-time audio visualization
- Expose MediaRecorder from useVoiceInput hook for visualization
- Create dedicated RecordingOverlay component with cleaner design
- LiveAudioVisualizer shows dynamic bars responding to actual audio
- Mode-colored visualization (plan=blue, exec=purple)
- Simplified keyboard hint display with better formatting
- Remove old static WaveformBars component
…smoother animation

- Use ResizeObserver for reliable container width measurement
- Calculate barWidth and gap dynamically based on container width
- Increase smoothingTimeConstant to 0.8 for less jittery animation
- Adjust decibel range for better sensitivity
Replace react-audio-visualize with custom SlidingWaveform component:
- Shows amplitude history over the last 10 seconds
- Samples audio every 50ms (200 samples total)
- New samples appear on right, slide left over time
- Uses RMS amplitude calculation for smooth visualization
- Bars scale dynamically to fill container width
- Remove react-audio-visualize dependency
- Deduplicate mode-based styling with lookup tables
- Extract RecordingHints component for keyboard shortcuts
- Simplify VoiceInputButton color logic
- Add roundRect fallback for older browser compatibility
- Improve code organization and comments
@ammar-agent ammar-agent force-pushed the waveform-mode-color-matching branch from 1285836 to 057aff5 Compare December 3, 2025 15:55
@ammario ammario merged commit cdeffed into main Dec 3, 2025
15 checks passed
@ammario ammario deleted the waveform-mode-color-matching branch December 3, 2025 16:06
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.

2 participants