orb-ui 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +81 -25
  2. package/dist/adapters/audio-level.d.ts +57 -20
  3. package/dist/adapters/elevenlabs/index.d.ts +13 -2
  4. package/dist/adapters/gemini-live/index.d.ts +9 -5
  5. package/dist/adapters/index.d.ts +3 -2
  6. package/dist/adapters/livekit/browser.d.ts +9 -5
  7. package/dist/adapters/livekit/index.d.ts +9 -5
  8. package/dist/adapters/openai-realtime/index.d.ts +9 -5
  9. package/dist/adapters/pipecat/index.d.ts +9 -5
  10. package/dist/adapters/types.d.ts +0 -5
  11. package/dist/adapters/vapi/index.d.ts +29 -3
  12. package/dist/adapters/volume-presets.d.ts +35 -0
  13. package/dist/adapters.cjs +1 -1
  14. package/dist/adapters.js +405 -457
  15. package/dist/components/Orb/Orb.d.ts +1 -1
  16. package/dist/components/Orb/Orb.types.d.ts +87 -14
  17. package/dist/components/Orb/OrbThemeProvider.d.ts +16 -0
  18. package/dist/components/Orb/index.d.ts +6 -1
  19. package/dist/components/Orb/signals.d.ts +1 -1
  20. package/dist/index.d.ts +2 -2
  21. package/dist/livekit-7Re8E7By.js +394 -0
  22. package/dist/livekit-C36Kmz6s.cjs +1 -0
  23. package/dist/livekit-adapter.cjs +1 -1
  24. package/dist/livekit-adapter.js +6 -4
  25. package/dist/orb-ui.cjs +7 -7
  26. package/dist/orb-ui.js +1343 -512
  27. package/dist/themes/bars/BarsTheme.d.ts +8 -4
  28. package/dist/themes/circle/CircleTheme.d.ts +8 -4
  29. package/dist/themes/cloud/CloudTheme.d.ts +8 -4
  30. package/dist/themes/config.d.ts +151 -0
  31. package/dist/themes/css-variables.d.ts +5 -0
  32. package/dist/themes/debug/DebugTheme.d.ts +11 -6
  33. package/dist/themes/radial/RadialTheme.d.ts +8 -2
  34. package/dist/themes/slots.d.ts +4 -0
  35. package/package.json +4 -3
  36. package/dist/livekit-CukEeYFK.js +0 -316
  37. package/dist/livekit-Dt-QZ6Gs.cjs +0 -1
package/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # orb-ui
2
2
 
3
- React voice agent UI components for Vapi, ElevenLabs, LiveKit, Pipecat, OpenAI Realtime, Gemini Live, and custom realtime voice AI apps. orb-ui gives you animated voice orbs, audio-reactive themes, accessible clickable controls, and provider adapters for building polished voice agent interfaces in React.
3
+ [![npm version](https://img.shields.io/npm/v/orb-ui.svg)](https://www.npmjs.com/package/orb-ui)
4
+
5
+ **Voice agent UI that feels alive.**
6
+
7
+ Expressive, accessible React components for realtime voice agents. Connect Vapi, ElevenLabs, LiveKit, Pipecat, OpenAI Realtime, Gemini Live, or your own voice stack through one consistent UI layer.
4
8
 
5
9
  <p align="center">
6
10
  <a href="https://orb-ui.com">
7
- <img src="assets/demo-screenshot.jpg" alt="orb-ui demo" width="600" />
11
+ <img src="demo/public/og-image-v2.jpg" alt="orb-ui — Voice agent UI that feels alive" width="900" />
8
12
  </a>
9
13
  </p>
10
14
 
11
15
  <p align="center">
12
- <a href="https://orb-ui.com">Live Demo</a> · <a href="https://orb-ui.com/docs/adapters/overview">Adapter Guide</a> · <a href="https://orb-ui.com/docs/guides/signal-based-voice-agent-ui">Signal Architecture</a> · <a href="https://www.npmjs.com/package/orb-ui">npm</a> · <a href="https://github.com/alexanderqchen/orb-ui">GitHub</a>
16
+ <a href="https://orb-ui.com">Live demo</a> · <a href="https://orb-ui.com/docs">Documentation</a> · <a href="https://orb-ui.com/playground">Playground</a> · <a href="https://www.npmjs.com/package/orb-ui">npm</a> · <a href="https://github.com/exprmntl/orb-ui">Star on GitHub</a>
13
17
  </p>
14
18
 
15
19
  ```jsx
@@ -25,9 +29,12 @@ export function VoiceOrb() {
25
29
  }
26
30
  ```
27
31
 
32
+ Vapi uses its existing microphone track for listening motion and its assistant audio events for
33
+ speaking motion. The adapter keeps microphone and output calibration separate.
34
+
28
35
  ## Install
29
36
 
30
- Install the component package:
37
+ Install the [orb-ui package from npm](https://www.npmjs.com/package/orb-ui):
31
38
 
32
39
  ```bash
33
40
  npm install orb-ui
@@ -67,20 +74,23 @@ Every provider ends at the same React API:
67
74
 
68
75
  The only difference is how the adapter obtains a provider session:
69
76
 
70
- | Provider | Required browser setup |
71
- | --------------- | ------------------------------------------------------------------------ |
72
- | Vapi | Pass a configured Vapi client plus `assistantId` |
73
- | ElevenLabs | Pass `Conversation` plus an `agentId`, signed URL, or conversation token |
74
- | LiveKit | Provide a token endpoint and optional agent name |
75
- | Pipecat | Pass a configured `PipecatClient` plus its connect callback |
76
- | OpenAI Realtime | Return a fresh short-lived client secret from `getClientSecret` |
77
- | Gemini Live | Open the official Google Live session in `connect` |
77
+ | Provider | Required browser setup |
78
+ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
79
+ | [Vapi guide](https://orb-ui.com/docs/adapters/vapi) | Pass a configured Vapi client plus `assistantId` |
80
+ | [ElevenLabs guide](https://orb-ui.com/docs/adapters/elevenlabs) | Pass `Conversation` plus an `agentId`, signed URL, or conversation token |
81
+ | [LiveKit guide](https://orb-ui.com/docs/adapters/livekit) | Provide a token endpoint and optional agent name |
82
+ | [Pipecat guide](https://orb-ui.com/docs/adapters/pipecat) | Pass a configured `PipecatClient` plus its connect callback |
83
+ | [OpenAI Realtime guide](https://orb-ui.com/docs/adapters/openai-realtime) | Return a fresh short-lived client secret from `getClientSecret` |
84
+ | [Gemini Live guide](https://orb-ui.com/docs/adapters/gemini-live) | Open the official Google Live session in `connect` |
78
85
 
79
86
  The adapter owns provider event mapping and emits one consistent `OrbSignal`. OpenAI and Gemini
80
87
  standard API keys, and LiveKit participant-token signing, stay on your server. See the
81
88
  [adapter overview](https://orb-ui.com/docs/adapters/overview) for the responsibility boundary and
82
89
  advanced setup shapes.
83
90
 
91
+ For an app-owned WebRTC, WebSocket, telephony, or speech runtime, follow the
92
+ [custom integration guide](https://orb-ui.com/docs/adapters/custom).
93
+
84
94
  ## Quick Start
85
95
 
86
96
  Use orb-ui as a React voice AI component when you need a first-party provider voice UI or a custom animated voice orb for another realtime voice agent stack.
@@ -212,7 +222,16 @@ function App() {
212
222
  const [state, setState] = useState('idle')
213
223
  const [volume, setVolume] = useState(0)
214
224
 
215
- return <Orb state={state} volume={volume} theme="circle" />
225
+ return (
226
+ <Orb
227
+ signal={{
228
+ state,
229
+ inputVolume: state === 'listening' ? volume : 0,
230
+ outputVolume: state === 'speaking' ? volume : 0,
231
+ }}
232
+ theme="circle"
233
+ />
234
+ )
216
235
  }
217
236
  ```
218
237
 
@@ -226,6 +245,44 @@ function App() {
226
245
  }
227
246
  ```
228
247
 
248
+ ### Theme presets and overrides
249
+
250
+ Theme strings keep the current balanced behavior. Choose `calm` or `expressive`, then override only
251
+ the theme-specific values your product needs:
252
+
253
+ ```jsx
254
+ <Orb
255
+ signal={signal}
256
+ theme={{
257
+ name: 'circle',
258
+ preset: 'calm',
259
+ appearance: { colors: { listening: '#8b9cff', speaking: '#f4f7ff' } },
260
+ motion: { responseExponent: 0.9, activityRiseMs: 80, activityFallMs: 180 },
261
+ }}
262
+ />
263
+ ```
264
+
265
+ See the [theme customization guide](https://orb-ui.com/docs/themes/customization) for every
266
+ theme-specific appearance, geometry, and motion field.
267
+
268
+ For application-wide defaults, stable internal slots, responsive CSS variables, or completely
269
+ custom artwork, use the advanced customization layer:
270
+
271
+ ```tsx
272
+ import { Orb, OrbThemeProvider } from 'orb-ui'
273
+ ;<OrbThemeProvider theme={{ name: 'circle', preset: 'calm' }}>
274
+ <Orb
275
+ adapter={adapter}
276
+ style={{ '--orb-ui-size': 'clamp(180px, 32vw, 320px)' }}
277
+ slotProps={{ surface: { className: 'brand-orb__surface' } }}
278
+ />
279
+ </OrbThemeProvider>
280
+ ```
281
+
282
+ Pass `renderTheme` when your product needs entirely custom DOM, SVG, canvas, or WebGL artwork. Its
283
+ renderer receives normalized input/output activity plus accessible root/control props, while Orb
284
+ continues to manage provider subscription and session start/stop behavior.
285
+
229
286
  ### External session controls
230
287
 
231
288
  Keep the orb as a passive visual when start and stop controls belong elsewhere in your layout.
@@ -267,9 +324,8 @@ the orb with the typed style variable:
267
324
  | Prop | Type | Default | Description |
268
325
  | ------------- | ------------------------------------------------------ | --------- | ------------------------------------------------------- |
269
326
  | `theme` | `'debug' \| 'circle' \| 'bars' \| 'cloud' \| 'radial'` | `'debug'` | Visual theme |
270
- | `signal` | `OrbSignal` | — | Rich controlled signal with state/input/output volume |
327
+ | `signal` | `OrbSignal` | — | Controlled signal with state and directional volumes |
271
328
  | `state` | `OrbState` | `'idle'` | Conversation state (controlled mode) |
272
- | `volume` | `number` | `0` | Audio volume, 0–1. Overrides signal/adapter volume. |
273
329
  | `adapter` | `OrbAdapter` | — | Provider adapter (manages signal updates automatically) |
274
330
  | `size` | `number` | `200` | Size in pixels |
275
331
  | `className` | `string` | — | Optional class name for the rendered theme |
@@ -286,20 +342,20 @@ the orb with the typed style variable:
286
342
 
287
343
  ## Supported Providers
288
344
 
289
- | Provider | Adapter |
290
- | ------------------------------------------------------------------------- | --------------------------------------------------------------------- |
291
- | [Vapi](https://vapi.ai) | `createVapiAdapter` from `orb-ui/adapters` |
292
- | [ElevenLabs](https://elevenlabs.io/conversational-ai) | `createElevenLabsAdapter` from `orb-ui/adapters` |
293
- | [LiveKit](https://livekit.io) | `createLiveKitAdapter` from `orb-ui/adapters` |
294
- | [Pipecat](https://pipecat.ai) | `createPipecatAdapter` from `orb-ui/adapters` |
295
- | [OpenAI Realtime](https://developers.openai.com/api/docs/guides/realtime) | `createOpenAIRealtimeAdapter` from `orb-ui/adapters` |
296
- | [Gemini Live](https://ai.google.dev/gemini-api/docs/live-api) | `createGeminiLiveAdapter` from `orb-ui/adapters` |
297
- | Custom | Use controlled mode — pass `signal`, or `state` and `volume` directly |
345
+ | Provider | Adapter |
346
+ | ------------------------------------------------------------------------- | ------------------------------------------------------------------- |
347
+ | [Vapi](https://vapi.ai) | `createVapiAdapter` from `orb-ui/adapters` |
348
+ | [ElevenLabs](https://elevenlabs.io/conversational-ai) | `createElevenLabsAdapter` from `orb-ui/adapters` |
349
+ | [LiveKit](https://livekit.io) | `createLiveKitAdapter` from `orb-ui/adapters` |
350
+ | [Pipecat](https://pipecat.ai) | `createPipecatAdapter` from `orb-ui/adapters` |
351
+ | [OpenAI Realtime](https://developers.openai.com/api/docs/guides/realtime) | `createOpenAIRealtimeAdapter` from `orb-ui/adapters` |
352
+ | [Gemini Live](https://ai.google.dev/gemini-api/docs/live-api) | `createGeminiLiveAdapter` from `orb-ui/adapters` |
353
+ | Custom | Use controlled mode with a directional `signal` or build an adapter |
298
354
 
299
355
  ## Development
300
356
 
301
357
  ```bash
302
- git clone https://github.com/alexanderqchen/orb-ui.git
358
+ git clone https://github.com/exprmntl/orb-ui.git
303
359
  cd orb-ui
304
360
  pnpm install
305
361
 
@@ -1,28 +1,65 @@
1
- export interface OutputVolumeCalibration {
2
- /** Raw RMS values at or below this level are treated as silence. */
3
- noiseFloor: number;
4
- /** Multiplier applied after the noise floor. */
5
- gain: number;
6
- /** Power curve applied after gain. Values below 1 lift quieter speech. */
7
- exponent: number;
8
- /** EMA rate used while the volume is rising. */
9
- attack: number;
10
- /** EMA rate used while the volume is falling. */
11
- release: number;
12
- }
13
- export type OutputVolumeCalibrationSource = Partial<OutputVolumeCalibration> | (() => Partial<OutputVolumeCalibration>);
14
- export interface OutputVolumeSample {
15
- /** Unmodified RMS value measured from the provider audio stream. */
1
+ export interface VolumeAmplitudeCalibration {
2
+ /** Raw values at or below this level are treated as silence. */
3
+ silenceFloor: number;
4
+ /** Raw value representing ordinary conversational speech. Maps to 0.5. */
5
+ speechReference: number;
6
+ /** Raw value representing a strong, uncommon speech peak. Maps to 1. */
7
+ speechPeak: number;
8
+ }
9
+ export interface VolumeEnvelopeCalibration {
10
+ /** Milliseconds to move 90% toward a rising target. */
11
+ riseTimeMs: number;
12
+ /** Milliseconds to move 90% toward a falling target. */
13
+ fallTimeMs: number;
14
+ }
15
+ export interface VolumeCalibration {
16
+ amplitude: VolumeAmplitudeCalibration;
17
+ envelope: VolumeEnvelopeCalibration;
18
+ }
19
+ export interface VolumeCalibrationOverrides {
20
+ amplitude?: Partial<VolumeAmplitudeCalibration>;
21
+ envelope?: Partial<VolumeEnvelopeCalibration>;
22
+ }
23
+ export type VolumeCalibrationSource = VolumeCalibrationOverrides | (() => VolumeCalibrationOverrides);
24
+ export interface VolumeSample {
25
+ /** Unmodified value measured from the provider audio source. */
16
26
  raw: number;
17
- /** Value after noise floor, gain, and power-curve shaping. */
18
- shaped: number;
19
- /** Final value after attack/release smoothing. */
27
+ /** Value after silence, reference, and peak mapping. */
28
+ mapped: number;
29
+ /** Stable envelope after elapsed-time rise/fall processing. */
20
30
  normalized: number;
31
+ /** Elapsed time used for this envelope update. */
32
+ elapsedMs: number;
33
+ }
34
+ export interface VolumeCalibrationCapture {
35
+ silence: number[];
36
+ quiet: number[];
37
+ normal: number[];
38
+ energetic: number[];
39
+ }
40
+ export interface VolumeCalibrationMetrics {
41
+ silenceP99: number;
42
+ quietMedian: number;
43
+ normalMedian: number;
44
+ energeticMedian: number;
45
+ speechP99: number;
46
+ saturationRatio: number;
47
+ }
48
+ export interface VolumeCalibrationFit {
49
+ calibration: VolumeCalibration;
50
+ metrics: VolumeCalibrationMetrics;
51
+ }
52
+ export interface VolumeNormalizer {
53
+ sample(rawValue: number, timestampMs?: number): VolumeSample;
54
+ reset(value?: number): void;
21
55
  }
22
56
  export interface MediaStreamTrackVolumeMeter {
23
57
  stop(): Promise<void>;
24
58
  }
25
59
  export type AudioContextSource = () => AudioContext | undefined;
26
- export declare const DEFAULT_OUTPUT_VOLUME_CALIBRATION: OutputVolumeCalibration;
27
- export declare function calibrateOutputVolume(rawValue: number, previous: number, source?: OutputVolumeCalibrationSource): OutputVolumeSample;
60
+ export declare const DEFAULT_VOLUME_CALIBRATION: VolumeCalibration;
61
+ export declare function mapVolumeAmplitude(rawValue: number, calibration: VolumeAmplitudeCalibration): number;
62
+ export declare function calibrateVolume(rawValue: number, previous: number, elapsedMs: number, defaults?: VolumeCalibration, source?: VolumeCalibrationSource): VolumeSample;
63
+ export declare function createVolumeNormalizer(defaults?: VolumeCalibration, source?: VolumeCalibrationSource): VolumeNormalizer;
64
+ export declare function fitVolumeCalibration(capture: VolumeCalibrationCapture, envelope?: VolumeEnvelopeCalibration): VolumeCalibrationFit;
28
65
  export declare function createMediaStreamTrackVolumeMeter(track: MediaStreamTrack, createAudioContext: AudioContextSource, onVolume: (volume: number) => void): MediaStreamTrackVolumeMeter | undefined;
@@ -1,4 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
+ import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
2
3
  export type ElevenLabsMode = 'speaking' | 'listening';
3
4
  export type ElevenLabsStatus = 'disconnected' | 'connecting' | 'connected' | 'disconnecting';
4
5
  export type ElevenLabsConnectionType = 'websocket' | 'webrtc';
@@ -41,13 +42,23 @@ type ElevenLabsSessionAuth = {
41
42
  signedUrl?: never;
42
43
  connectionType?: 'webrtc';
43
44
  };
44
- export type ElevenLabsConfig = ElevenLabsSessionAuth & {
45
+ type ElevenLabsSessionConfig = ElevenLabsSessionAuth & {
45
46
  /** orb-ui expects a voice conversation, so text-only sessions are intentionally unsupported. */
46
47
  textOnly?: false;
47
48
  /** Allow @elevenlabs/client startSession options that orb-ui does not inspect. */
48
49
  [key: string]: unknown;
49
50
  };
50
- export type ElevenLabsStartSessionOptions = ElevenLabsConfig & ElevenLabsCallbacks;
51
+ export type ElevenLabsConfig = ElevenLabsSessionConfig & {
52
+ /** Optional live-tunable input calibration overrides. */
53
+ inputVolumeCalibration?: VolumeCalibrationSource;
54
+ /** Optional live-tunable output calibration overrides. */
55
+ outputVolumeCalibration?: VolumeCalibrationSource;
56
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
57
+ onInputVolumeSample?: (sample: VolumeSample) => void;
58
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
59
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
60
+ };
61
+ export type ElevenLabsStartSessionOptions = ElevenLabsSessionConfig & ElevenLabsCallbacks;
51
62
  export interface ElevenLabsConversationClass {
52
63
  startSession(options: ElevenLabsStartSessionOptions): Promise<ElevenLabsConversation>;
53
64
  }
@@ -1,5 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
- import { OutputVolumeCalibrationSource, OutputVolumeSample } from '../audio-level.js';
2
+ import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
3
3
  export interface GeminiLiveInlineData {
4
4
  data?: string;
5
5
  mimeType?: string;
@@ -53,10 +53,14 @@ export interface GeminiLiveAdapterConfig {
53
53
  getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
54
54
  /** Runtime override for tests or custom browser wrappers. */
55
55
  createAudioContext?: () => AudioContext;
56
- /** Optional live-tunable output shaping. A getter is read for every meter sample. */
57
- outputVolumeCalibration?: OutputVolumeCalibrationSource;
58
- /** Receives raw, shaped, and smoothed output levels for diagnostics. */
59
- onOutputVolumeSample?: (sample: OutputVolumeSample) => void;
56
+ /** Optional live-tunable input calibration overrides. */
57
+ inputVolumeCalibration?: VolumeCalibrationSource;
58
+ /** Optional live-tunable output calibration overrides. */
59
+ outputVolumeCalibration?: VolumeCalibrationSource;
60
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
61
+ onInputVolumeSample?: (sample: VolumeSample) => void;
62
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
63
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
60
64
  }
61
65
  export interface GeminiLiveOrbAdapter extends OrbAdapter {
62
66
  start(): Promise<void>;
@@ -1,8 +1,9 @@
1
- export { createVapiAdapter } from './vapi/index.js';
1
+ export { createVapiAdapter, type VapiAdapterOptions } from './vapi/index.js';
2
2
  export { createElevenLabsAdapter, type ElevenLabsCallbacks, type ElevenLabsConfig, type ElevenLabsConnectionType, type ElevenLabsConversation, type ElevenLabsConversationClass, type ElevenLabsMode, type ElevenLabsOrbAdapter, type ElevenLabsStartSessionOptions, type ElevenLabsStatus, } from './elevenlabs/index.js';
3
3
  export { createLiveKitAdapter, type LiveKitAdapterConfig, type LiveKitConnectionDetails, type LiveKitOrbAdapter, type LiveKitResolvedTokenOptions, type LiveKitTokenOptions, type LiveKitTokenSource, } from './livekit/index.js';
4
4
  export { createPipecatAdapter, type PipecatAdapterOptions, type PipecatClientLike, type PipecatOrbAdapter, type PipecatParticipantLike, type PipecatTracksLike, } from './pipecat/index.js';
5
5
  export { createOpenAIRealtimeAdapter, type OpenAIRealtimeAdapterConfig, type OpenAIRealtimeClientSecret, type OpenAIRealtimeOrbAdapter, } from './openai-realtime/index.js';
6
6
  export { createGeminiLiveAdapter, type GeminiLiveAdapterConfig, type GeminiLiveCallbacks, type GeminiLiveInlineData, type GeminiLiveOrbAdapter, type GeminiLiveServerMessage, type GeminiLiveSession, } from './gemini-live/index.js';
7
- export { DEFAULT_OUTPUT_VOLUME_CALIBRATION, type OutputVolumeCalibration, type OutputVolumeCalibrationSource, type OutputVolumeSample, } from './audio-level.js';
7
+ export { DEFAULT_VOLUME_CALIBRATION, calibrateVolume, createVolumeNormalizer, fitVolumeCalibration, mapVolumeAmplitude, type VolumeAmplitudeCalibration, type VolumeCalibration, type VolumeCalibrationCapture, type VolumeCalibrationFit, type VolumeCalibrationMetrics, type VolumeCalibrationOverrides, type VolumeCalibrationSource, type VolumeEnvelopeCalibration, type VolumeNormalizer, type VolumeSample, } from './audio-level.js';
8
+ export { PROVIDER_VOLUME_CALIBRATIONS, type DirectionalVolumeCalibration } from './volume-presets.js';
8
9
  export type { OrbAdapter, OrbSignal, OrbSignalListener, OrbState } from './types.js';
@@ -1,5 +1,5 @@
1
1
  import { LiveKitOrbAdapter, LiveKitTokenOptions } from './index.js';
2
- import { OutputVolumeCalibrationSource, OutputVolumeSample } from '../audio-level.js';
2
+ import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
3
3
  interface LiveKitBrowserAdapterBase extends Omit<LiveKitTokenOptions, 'agentName' | 'roomName'> {
4
4
  /** Agent dispatched into the room. Required for LiveKit Cloud sandbox sessions. */
5
5
  agentName?: LiveKitTokenOptions['agentName'];
@@ -9,10 +9,14 @@ interface LiveKitBrowserAdapterBase extends Omit<LiveKitTokenOptions, 'agentName
9
9
  connectOptions?: Record<string, unknown>;
10
10
  /** Enable the local microphone after connecting. Defaults to true. */
11
11
  enableMicrophone?: boolean;
12
- /** Optional live-tunable output shaping. A getter is read for every meter sample. */
13
- outputVolumeCalibration?: OutputVolumeCalibrationSource;
14
- /** Receives raw, shaped, and smoothed output levels for diagnostics. */
15
- onOutputVolumeSample?: (sample: OutputVolumeSample) => void;
12
+ /** Optional live-tunable input calibration overrides. */
13
+ inputVolumeCalibration?: VolumeCalibrationSource;
14
+ /** Optional live-tunable output calibration overrides. */
15
+ outputVolumeCalibration?: VolumeCalibrationSource;
16
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
17
+ onInputVolumeSample?: (sample: VolumeSample) => void;
18
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
19
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
16
20
  }
17
21
  export type LiveKitTokenEndpointOptions = Omit<RequestInit, 'body'>;
18
22
  export interface LiveKitSandboxOptions {
@@ -1,5 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
- import { OutputVolumeCalibrationSource, OutputVolumeSample } from '../audio-level.js';
2
+ import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
3
3
  interface LKAnalyserResult {
4
4
  calculateVolume: () => number;
5
5
  cleanup: () => Promise<void>;
@@ -69,10 +69,14 @@ export interface LiveKitTokenSource {
69
69
  fetch(options?: LiveKitResolvedTokenOptions, force?: boolean): Promise<LiveKitConnectionDetails>;
70
70
  }
71
71
  interface LiveKitVolumeConfig {
72
- /** Optional live-tunable output shaping. A getter is read for every meter sample. */
73
- outputVolumeCalibration?: OutputVolumeCalibrationSource;
74
- /** Receives raw, shaped, and smoothed output levels for diagnostics. */
75
- onOutputVolumeSample?: (sample: OutputVolumeSample) => void;
72
+ /** Optional live-tunable input calibration overrides. */
73
+ inputVolumeCalibration?: VolumeCalibrationSource;
74
+ /** Optional live-tunable output calibration overrides. */
75
+ outputVolumeCalibration?: VolumeCalibrationSource;
76
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
77
+ onInputVolumeSample?: (sample: VolumeSample) => void;
78
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
79
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
76
80
  }
77
81
  interface LiveKitManagedBaseConfig<TTrack = unknown> extends LiveKitVolumeConfig {
78
82
  /** The createAudioAnalyser function from livekit-client. */
@@ -1,5 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
- import { OutputVolumeCalibrationSource, OutputVolumeSample } from '../audio-level.js';
2
+ import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
3
3
  export interface OpenAIRealtimeClientSecret {
4
4
  value: string;
5
5
  }
@@ -20,10 +20,14 @@ export interface OpenAIRealtimeAdapterConfig {
20
20
  createAudioElement?: () => HTMLAudioElement;
21
21
  /** Return undefined to disable browser-side volume metering. */
22
22
  createAudioContext?: () => AudioContext | undefined;
23
- /** Optional live-tunable output shaping. A getter is read for every meter sample. */
24
- outputVolumeCalibration?: OutputVolumeCalibrationSource;
25
- /** Receives raw, shaped, and smoothed output levels for diagnostics. */
26
- onOutputVolumeSample?: (sample: OutputVolumeSample) => void;
23
+ /** Optional live-tunable input calibration overrides. */
24
+ inputVolumeCalibration?: VolumeCalibrationSource;
25
+ /** Optional live-tunable output calibration overrides. */
26
+ outputVolumeCalibration?: VolumeCalibrationSource;
27
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
28
+ onInputVolumeSample?: (sample: VolumeSample) => void;
29
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
30
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
27
31
  }
28
32
  export interface OpenAIRealtimeOrbAdapter extends OrbAdapter {
29
33
  start(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
- import { AudioContextSource, OutputVolumeCalibrationSource, OutputVolumeSample } from '../audio-level.js';
2
+ import { AudioContextSource, VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
3
3
  type PipecatListener = (...args: unknown[]) => void;
4
4
  /** Minimal PipecatClient surface used by orb-ui. */
5
5
  export interface PipecatClientLike {
@@ -43,10 +43,14 @@ export interface PipecatAdapterOptions {
43
43
  createAudioElement?: () => HTMLAudioElement;
44
44
  /** Return undefined to disable browser-track volume metering. */
45
45
  createAudioContext?: AudioContextSource;
46
- /** Optional live-tunable output shaping. A getter is read for every meter sample. */
47
- outputVolumeCalibration?: OutputVolumeCalibrationSource;
48
- /** Receives raw, shaped, and smoothed output levels for diagnostics. */
49
- onOutputVolumeSample?: (sample: OutputVolumeSample) => void;
46
+ /** Optional live-tunable input calibration overrides. */
47
+ inputVolumeCalibration?: VolumeCalibrationSource;
48
+ /** Optional live-tunable output calibration overrides. */
49
+ outputVolumeCalibration?: VolumeCalibrationSource;
50
+ /** Receives raw, mapped, and normalized input levels for diagnostics. */
51
+ onInputVolumeSample?: (sample: VolumeSample) => void;
52
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
53
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
50
54
  }
51
55
  export interface PipecatOrbAdapter extends OrbAdapter {
52
56
  start(): Promise<void>;
@@ -1,7 +1,2 @@
1
1
  import { OrbAdapter, OrbSignal, OrbSignalListener, OrbState } from '../components/Orb/Orb.types.js';
2
2
  export type { OrbAdapter, OrbSignal, OrbSignalListener, OrbState };
3
- /**
4
- * Shared mic volume curve — rescale real-world mic range to 0–1 with pow shaping
5
- * for custom provider adapters that need browser-side input metering.
6
- */
7
- export declare function normalizeMicVolume(v: number): number;
@@ -1,4 +1,5 @@
1
1
  import { OrbAdapter } from '../types.js';
2
+ import { AudioContextSource, VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
2
3
  interface VapiClient {
3
4
  on(event: 'call-start', listener: () => void): void;
4
5
  on(event: 'call-end', listener: () => void): void;
@@ -10,6 +11,20 @@ interface VapiClient {
10
11
  removeListener(event: string, listener: (...args: unknown[]) => void): void;
11
12
  start(...args: any[]): Promise<unknown>;
12
13
  stop(): void;
14
+ /** Public SDK access to the existing call's microphone; no second capture. */
15
+ getDailyCallObject?(): {
16
+ participants(): {
17
+ local?: {
18
+ tracks?: {
19
+ audio?: {
20
+ state?: string;
21
+ persistentTrack?: MediaStreamTrack;
22
+ track?: MediaStreamTrack;
23
+ };
24
+ };
25
+ };
26
+ };
27
+ } | null;
13
28
  }
14
29
  interface VapiMessage {
15
30
  type: string;
@@ -28,15 +43,26 @@ interface VapiMessage {
28
43
  * call-end → 'idle'
29
44
  * error → 'error'
30
45
  *
31
- * Volume: raw Vapi values are normalized (noise gate + EMA) before being emitted
32
- * as outputVolume while the assistant is speaking.
46
+ * Volume: raw Vapi values are mapped through the provider profile and emitted
47
+ * as a stable normalized outputVolume envelope while the assistant is speaking.
48
+ * Input: meters the SDK-owned local audio track when getDailyCallObject exists.
33
49
  *
34
50
  * @param client - A Vapi instance from @vapi-ai/web
35
51
  * @param options - Optional config (e.g. assistantId to pass to vapi.start())
36
52
  */
37
- interface VapiAdapterOptions {
53
+ export interface VapiAdapterOptions {
38
54
  /** Assistant ID passed to vapi.start() when the orb is clicked. */
39
55
  assistantId?: string;
56
+ /** Return undefined to disable metering of the SDK-owned microphone track. */
57
+ createAudioContext?: AudioContextSource;
58
+ /** Optional live-tunable input calibration overrides. */
59
+ inputVolumeCalibration?: VolumeCalibrationSource;
60
+ /** Optional live-tunable output calibration overrides. */
61
+ outputVolumeCalibration?: VolumeCalibrationSource;
62
+ /** Receives raw microphone RMS, mapped, and normalized input levels. */
63
+ onInputVolumeSample?: (sample: VolumeSample) => void;
64
+ /** Receives raw, mapped, and normalized output levels for diagnostics. */
65
+ onOutputVolumeSample?: (sample: VolumeSample) => void;
40
66
  }
41
67
  export declare function createVapiAdapter(client: VapiClient, options?: VapiAdapterOptions): OrbAdapter;
42
68
  export {};
@@ -0,0 +1,35 @@
1
+ import { VolumeCalibration } from './audio-level.js';
2
+ export interface DirectionalVolumeCalibration {
3
+ input?: VolumeCalibration;
4
+ output?: VolumeCalibration;
5
+ }
6
+ /**
7
+ * Shipped provider baselines. The playground calibration runner generates
8
+ * replacements from guided raw-level captures without requiring manual sliders.
9
+ */
10
+ export declare const PROVIDER_VOLUME_CALIBRATIONS: {
11
+ readonly vapi: {
12
+ readonly input: VolumeCalibration;
13
+ readonly output: VolumeCalibration;
14
+ };
15
+ readonly elevenlabs: {
16
+ readonly input: VolumeCalibration;
17
+ readonly output: VolumeCalibration;
18
+ };
19
+ readonly livekit: {
20
+ readonly input: VolumeCalibration;
21
+ readonly output: VolumeCalibration;
22
+ };
23
+ readonly pipecat: {
24
+ readonly input: VolumeCalibration;
25
+ readonly output: VolumeCalibration;
26
+ };
27
+ readonly openai: {
28
+ readonly input: VolumeCalibration;
29
+ readonly output: VolumeCalibration;
30
+ };
31
+ readonly gemini: {
32
+ readonly input: VolumeCalibration;
33
+ readonly output: VolumeCalibration;
34
+ };
35
+ };