Skip to documentation content

Audio Orb

A glassy orb for voice agents that breathes at rest, follows the person's voice, swirls while thinking, and pulses with the reply.

audio-orb-demo

Overview

Audio Orb gives a voice conversation something to look at while nobody is reading. It is a shaded sphere drawn with WebGL, with a slow flow inside it and a soft halo around it. Each state moves it differently:

StateWhat the orb does
idleBreathes slowly.
listeningIts surface swells and ripples with inputLevel, the person's loudness.
thinkingThe flow inside it curls and turns, and a glint travels around the rim.
speakingIts core brightens and its outline pulses with outputLevel, the agent's loudness.

The orb shows state; it does not decide it. state comes from your voice pipeline, and the levels come from audio you already have. It never asks for the microphone itself.

Audio Orb takes the same state, inputLevel, and outputLevel as the Voice Orb component in Honest AI, so you can swap one for the other. Voice Orb is a monochrome canvas mark that fits small spaces; Audio Orb is the richer, colored version for a voice agent's main screen.

Installation

npm install honestui

Usage

import { AudioOrb } from "honestui/shaders"

<div className="size-64">
  <AudioOrb state={state} inputLevel={micLevel} outputLevel={() => player.level()} />
</div>

A level is a number from 0 to 1, or a function the orb calls once per frame. A function avoids a React render per audio frame, so prefer it for live audio.

Analysing a stream

Pass a MediaStream and the orb opens its own analyser, reads the loudness and three frequency bands, and closes the analyser when the stream changes or the orb unmounts. Low frequencies swell the orb in broad lobes, the middle adds folds, and highs add a fine ripple. Pass an AnalyserNode you own instead, for example one connected to the agent's audio output, and the orb reads it without closing it.

The stream or analyser drives whichever level you leave out. Set inputLevel or outputLevel yourself to override it.

Examples

Microphone

The microphone opens only when the button is pressed, and the orb follows it while listening.

audio-orb-microphone

Sizing and color

Leave size unset and the orb fills its container, centered, with room around the body for the halo. Set size for a fixed square in pixels. The background is transparent, so the orb sits on your own surface in light and dark themes.

colors takes three hex colors: the highlight, the body, and the deep shade. Keep enough difference between the body and the deep shade for the sphere to read as round.

Accessibility

The canvas is hidden from assistive technology. By default the orb also renders its state, such as "Listening", in a polite status region, so a screen reader hears the change. Set announce={false} when your own text already says it, and change the words with labels.

When the user prefers reduced motion, the orb renders one still frame and adds a small mark for each state: a dot at rest, a microphone while listening, three dots while thinking, and bars while speaking, so the state is not shown by motion alone. The orb also stops drawing while it is offscreen or the tab is hidden. Without WebGL2 the container shows only its background, and the status text still updates.

API Reference

PropTypeDefaultDescription
stateidle|listening|thinking|speaking"idle"What the voice agent is doing.
inputLevelnumber | () => number–The person's loudness, from 0 to 1. Moves the surface while listening.
outputLevelnumber | () => number–The agent's loudness, from 0 to 1. Pulses the orb while speaking.
streamMediaStream | null–A stream the orb analyses for any level you leave out. Its analyser closes with the stream.
analyserAnalyserNode | null–An analyser you own. It takes precedence over stream and is never closed by the orb.
colorsstring[]["#f3f1ff", "#8a94ff", "#272a63"]Three hex colors: highlight, body, and deep shade.
sizenumber–Diameter in CSS pixels. Unset fills the container.
speednumber1Animation speed multiplier.
grainnumber0.5Film grain on the surface, from 0 to 1.
pausedbooleanfalseRenders a still frame instead of animating.
announcebooleantrueRenders the state in a status region. Set false when your own text says it.
labelsPartial<Record<AudioOrbState, string>>–Words for each state in the status region.
classNamestring–Class for sizing and positioning the container.
styleCSSProperties–Inline styles for the container.