Initialize hook
The useVoiceChatState
hook is designed for voice-based interaction with agents in your React application.
Arguments
Your Scoopika client, initialized using @scoopika/client.
Your Scoopika agent, initialized using @scoopika/client.
Configuration options for the state, this can include all the options available to useChatState, plus:
- auto_play_audio: Automatically play the agent’s audio response in real-time (defaults to
true
). - agent_voice: An object defining the settings for the agent voice player. See agent voice options for more information.
Agent voice options
These options are passed to the state options under agent_voice
.
If not provided, the agent’s voice will not be played.
The audio element that the agent voice player will use to play the audio response.
You can provide the element itself or its ID.
Typically, you’ll create an audio
element specifically for the agent voice player and pass its ID.
An HTML canvas element or its ID. If provided, the agent’s voice will be visualized in real-time.
The visualized voice will be drawn on the canvas. The visualizer is similar to the one shown in the GPT4-o promotion videos and is the same one used in the Scoopika playground:
The color of the visualizer wave. If not provided, it defaults to black.
Was this page helpful?