Skip to content

feat: drive the widget orb from mic and agent audio - #225

Merged
renal128 merged 2 commits into
nextfrom
widget-orb
Aug 15, 2026
Merged

feat: drive the widget orb from mic and agent audio#225
renal128 merged 2 commits into
nextfrom
widget-orb

Conversation

@renal128

@renal128 renal128 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the placeholder orb with the Metal orb from components-swift (Apache-2.0), reacting to live audio.

  • Rendering/Orb.swift, Rendering/VisualizerAgentState.swift, Resources/OrbShader.metal: ported and trimmed to what the widget needs. The LiveKit dependency is gone, so the orb runs on plain audio levels.
  • ConversationAudioLevelMonitor: a ConversationAudioObserver (from feat: add ConversationAudioObserver for mic and agent audio #215) that keeps a normalized loudness level with fast attack and slow release, computed on the audio thread for both float32 and int16 buffers.
  • OrbAudioLevels: samples the mic and agent monitors on a timer and publishes the two levels the orb renders from.
  • The three orb sites — launcher, drawer header, and the large idle orb — all run the real thing now, and the mic button shows a live input level.

Test plan

  • swift build, swift test (new ConversationAudioLevelMonitorTests), swiftformat . --strict
  • xcodebuild of Examples/DemoApp for the iOS simulator
  • Manual: orb reacts while the agent speaks and while talking into the mic; goes still when the call ends
orb-demo.mov

Stacked on #224.

Comment thread Sources/ElevenLabsWidget/Audio/ConversationAudioLevelMonitor.swift Outdated
Comment thread Sources/ElevenLabsWidget/Audio/OrbAudioLevels.swift
@renal128
renal128 force-pushed the widget-orb branch 2 times, most recently from 3abcb03 to cc508d0 Compare July 26, 2026 13:59
Comment thread Sources/ElevenLabsWidget/Rendering/Orb.swift
Comment thread Sources/ElevenLabsWidget/Audio/ConversationAudioLevelMonitor.swift Outdated
Comment thread Sources/ElevenLabsWidget/Audio/OrbAudioLevels.swift
Comment thread Sources/ElevenLabsWidget/Rendering/Orb.swift
Comment thread Sources/ElevenLabsWidget/Views/ChatOrbView.swift
@renal128
renal128 force-pushed the widget-orb branch 2 times, most recently from 97750a6 to a727cf1 Compare July 26, 2026 16:53
Comment thread Sources/ElevenLabsWidget/Rendering/Orb.swift
Comment thread Sources/ElevenLabsWidget/Rendering/Orb.swift

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b8a6979. Configure here.

Comment thread Sources/ElevenLabsWidget/Audio/OrbAudioLevels.swift
@jacksonh

jacksonh commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Only thing I'd say on this one is I'd add a demo video to the PR

Port the procedural Metal orb from ElevenLabs components-swift (Apache-2.0),
trimmed to the volume-driven view, and drive it from the SDK's mic and agent
audio observers: a lock-protected RMS monitor per stream, sampled at 30 Hz so
PCM-rate audio never re-renders SwiftUI. The mic button reuses the same level.

Co-authored-by: Cursor <cursoragent@cursor.com>
Make mic input drive angular motion and agent output drive shape changes while hardening shader edges and Int16 sampling.

Co-authored-by: Cursor <cursoragent@cursor.com>
@renal128
renal128 merged commit 8dadd6a into next Aug 15, 2026
2 checks passed
@renal128
renal128 deleted the widget-orb branch August 15, 2026 17:02
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