Skip to content

Conversation

pblazej
Copy link
Contributor

@pblazej pblazej commented Mar 5, 2025

  • Adds AgentBarAudioVisualizer
    • it performs sequence-based animations for different agent states
    • it does not use PhaseAnimator that would need a "step" animation curve to achieve the desired effects without .delay, also we cannot simply reset the animation
    • it's not a simple wrapper around BarAudioVisualizer anymore, as we need item-based opacity
    • there's some duplication, but I'm open for suggestions here
  • Splits AudioProcessor into a separate file

Considerations

  • We need some form of .id(track) or explicit if around empty track state to reinstantiate @StateObject of audio processor (and make it update the waveform) which is sort of a leaky abstraction - a separate initializer with non-optional track would be probably better

@pblazej
Copy link
Contributor Author

pblazej commented Mar 5, 2025

Use for testing livekit-examples/agent-starter-swift#4

@CLAassistant
Copy link

CLAassistant commented Mar 5, 2025

CLA assistant check
All committers have signed the CLA.

@pblazej pblazej requested review from bcherry and hiroshihorie March 5, 2025 12:31
Copy link
Contributor

@bcherry bcherry left a comment

Choose a reason for hiding this comment

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

This makes sense to me and seems ok to duplicate the bar although you might consider unifying their options in a separate struct that they both consume to reduce documentation duplication

as to the thought about forcing re-renders: I agree with that and open to ideas that make it easier to use.

@pblazej
Copy link
Contributor Author

pblazej commented Mar 6, 2025

unifying their options in a separate struct that they both consume to reduce documentation duplication

Yes, we should agree on a convention here, e.g. ComponentNameStyle struct and apply everywhere. I think this is the 1st component with "many props" so I'm happy to apply it here as well.

forcing re-renders

I think the cleanest approach would be to create a PlaceholderBarVisualizer without track param that just wraps the full one (having non-optional track). It makes the intention clear at least that this is a skeleton that won't initialize any audio processing.

@pblazej
Copy link
Contributor Author

pblazej commented Mar 6, 2025

Maybe this is less ugly without altering Track hashability etc. livekit-examples/voice-assistant-swift@7883e4d (#4)

@hiroshihorie
Copy link
Member

hiroshihorie commented Mar 6, 2025

Pretty cool!
Is it possible to fade the transitions between agent Listening vs Speaking ?
Feels a bit glitchy IMO.

agent-vis.mov

@pblazej
Copy link
Contributor Author

pblazej commented Mar 6, 2025

Pretty cool! Is it possible to fade the transitions between agent Listening vs Speaking ? Feels a bit glitchy IMO.

We need to do that manually unfortunately playing with phases, but let's see 🤞

@pblazej
Copy link
Contributor Author

pblazej commented Mar 6, 2025

@hiroshihorie 371c55b should do the trick, feel free to adjust the timing/curve.

Copy link
Member

@hiroshihorie hiroshihorie left a comment

Choose a reason for hiding this comment

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

Looks perfect ✅

@pblazej pblazej merged commit a38f959 into main Mar 7, 2025
15 checks passed
@pblazej pblazej deleted the blaze/clt-1087-add-agent-state-transitions-to-audio-visualizer-component branch March 7, 2025 10:45
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.

4 participants