fi-glass 1.1.0
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.
- package/LICENSE +77 -0
- package/README.md +162 -0
- package/dist/agent/index.d.ts +399 -0
- package/dist/agent/index.js +1979 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/composer/index.d.ts +57 -0
- package/dist/composer/index.js +112 -0
- package/dist/composer/index.js.map +1 -0
- package/dist/conversation/index.d.ts +80 -0
- package/dist/conversation/index.js +207 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/glass-theme-D-leVuKb.d.ts +19 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +4316 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/index.d.ts +213 -0
- package/dist/messages/index.js +337 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/persona-selector/index.d.ts +54 -0
- package/dist/persona-selector/index.js +215 -0
- package/dist/persona-selector/index.js.map +1 -0
- package/dist/shell/index.d.ts +429 -0
- package/dist/shell/index.js +1566 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/theme/index.d.ts +58 -0
- package/dist/theme/index.js +38 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/voice/index.d.ts +790 -0
- package/dist/voice/index.js +2591 -0
- package/dist/voice/index.js.map +1 -0
- package/package.json +85 -0
- package/src/theme/glass-chat-preset.ts +74 -0
- package/src/theme/glass-chat.css +217 -0
- package/src/theme/glass-theme.ts +26 -0
- package/src/theme/glass.css +27 -0
- package/src/theme/index.css +3 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/tokens.css +13 -0
|
@@ -0,0 +1,790 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { AudioSource, VoiceAdapter } from '@free-intelligence/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared Recording Component Types
|
|
7
|
+
*
|
|
8
|
+
* Common types and configurations for recording UI components.
|
|
9
|
+
* Used by: RecordingControls, VoiceMicButton, and future recording UIs.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Universal recording state enum.
|
|
14
|
+
* All recording components should use these states.
|
|
15
|
+
*/
|
|
16
|
+
type RecordingStateType = 'idle' | 'starting' | 'recording' | 'pausing' | 'paused' | 'resuming' | 'processing' | 'stopping' | 'finalized';
|
|
17
|
+
type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
+
interface ButtonSizeConfig {
|
|
19
|
+
button: string;
|
|
20
|
+
icon: string;
|
|
21
|
+
ring?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const BUTTON_SIZES: Record<ButtonSize, ButtonSizeConfig>;
|
|
24
|
+
type ColorTheme = 'medical' | 'chat' | 'minimal';
|
|
25
|
+
interface StateColors {
|
|
26
|
+
idle: string;
|
|
27
|
+
starting: string;
|
|
28
|
+
recording: string;
|
|
29
|
+
pausing: string;
|
|
30
|
+
paused: string;
|
|
31
|
+
resuming: string;
|
|
32
|
+
processing: string;
|
|
33
|
+
stopping: string;
|
|
34
|
+
finalized: string;
|
|
35
|
+
}
|
|
36
|
+
declare const COLOR_THEMES: Record<ColorTheme, StateColors>;
|
|
37
|
+
type PulseStyle = 'none' | 'ping' | 'rings' | 'vad';
|
|
38
|
+
interface PulseConfig {
|
|
39
|
+
style: PulseStyle;
|
|
40
|
+
color?: string;
|
|
41
|
+
audioLevel?: number;
|
|
42
|
+
isSilent?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface StatusTextConfig {
|
|
45
|
+
idle: string;
|
|
46
|
+
starting: string;
|
|
47
|
+
recording: string;
|
|
48
|
+
pausing: string;
|
|
49
|
+
paused: string;
|
|
50
|
+
resuming: string;
|
|
51
|
+
processing: string;
|
|
52
|
+
stopping: string;
|
|
53
|
+
finalized: string;
|
|
54
|
+
}
|
|
55
|
+
declare const STATUS_TEXT_ES: StatusTextConfig;
|
|
56
|
+
declare const STATUS_TEXT_EN: StatusTextConfig;
|
|
57
|
+
|
|
58
|
+
interface RecordingButtonProps {
|
|
59
|
+
/** Button size variant */
|
|
60
|
+
size?: ButtonSize;
|
|
61
|
+
/** Background color (domain class) */
|
|
62
|
+
bgColor: string;
|
|
63
|
+
/** Icon to display */
|
|
64
|
+
icon: LucideIcon;
|
|
65
|
+
/** Whether icon should spin (for loading states) */
|
|
66
|
+
iconSpin?: boolean;
|
|
67
|
+
/** Icon color (domain class, default: rec-icon-white) */
|
|
68
|
+
iconColor?: string;
|
|
69
|
+
/** Whether button is disabled */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** Click handler */
|
|
72
|
+
onClick: () => void;
|
|
73
|
+
/** Accessibility label */
|
|
74
|
+
ariaLabel: string;
|
|
75
|
+
/** Additional button classes */
|
|
76
|
+
className?: string;
|
|
77
|
+
/** Border/ring styles for accessibility */
|
|
78
|
+
borderStyle?: string;
|
|
79
|
+
/** Animation classes (e.g., animate-heartbeat) */
|
|
80
|
+
animate?: string;
|
|
81
|
+
}
|
|
82
|
+
declare const RecordingButton: react.ForwardRefExoticComponent<RecordingButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
83
|
+
|
|
84
|
+
interface PulseRingsProps {
|
|
85
|
+
/** Animation style */
|
|
86
|
+
style: PulseStyle;
|
|
87
|
+
/** Ring color name (e.g. 'yellow-500') */
|
|
88
|
+
color?: string;
|
|
89
|
+
/** Audio level 0-255 for VAD style */
|
|
90
|
+
audioLevel?: number;
|
|
91
|
+
/** Whether audio is silent (for VAD color switching) */
|
|
92
|
+
isSilent?: boolean;
|
|
93
|
+
/** Additional container classes */
|
|
94
|
+
className?: string;
|
|
95
|
+
}
|
|
96
|
+
declare function PulseRings({ style, color, audioLevel, isSilent, className, }: PulseRingsProps): react.JSX.Element | null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* RecordingTimer - Shared Timer Display Component
|
|
100
|
+
*
|
|
101
|
+
* Displays recording time in MM:SS format.
|
|
102
|
+
* Used by: RecordingControls, VoiceMicButton
|
|
103
|
+
*
|
|
104
|
+
* Features:
|
|
105
|
+
* - Multiple size variants
|
|
106
|
+
* - Optional recording dot indicator
|
|
107
|
+
* - Configurable colors
|
|
108
|
+
*/
|
|
109
|
+
interface RecordingTimerProps {
|
|
110
|
+
/** Time in seconds */
|
|
111
|
+
time: number;
|
|
112
|
+
/** Whether to show the timer */
|
|
113
|
+
visible?: boolean;
|
|
114
|
+
/** Size variant */
|
|
115
|
+
size?: 'sm' | 'md' | 'lg';
|
|
116
|
+
/** Show blinking recording dot */
|
|
117
|
+
showDot?: boolean;
|
|
118
|
+
/** Text color (domain class) */
|
|
119
|
+
textColor?: string;
|
|
120
|
+
/** Dot color (domain class) */
|
|
121
|
+
dotColor?: string;
|
|
122
|
+
/** Additional classes */
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Format seconds to MM:SS string
|
|
127
|
+
*/
|
|
128
|
+
declare function formatRecordingTime(seconds: number): string;
|
|
129
|
+
declare function RecordingTimer({ time, visible, size, showDot, textColor, dotColor, className, }: RecordingTimerProps): react.JSX.Element | null;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* StatusText - Recording Status Display Component
|
|
133
|
+
*
|
|
134
|
+
* Shows current recording status with optional loader.
|
|
135
|
+
* Used by: RecordingControls, VoiceMicButton
|
|
136
|
+
*/
|
|
137
|
+
interface StatusTextProps {
|
|
138
|
+
/** Status message to display */
|
|
139
|
+
text: string;
|
|
140
|
+
/** Text color (domain class) */
|
|
141
|
+
color?: string;
|
|
142
|
+
/** Show loading spinner */
|
|
143
|
+
showLoader?: boolean;
|
|
144
|
+
/** Animate with pulse effect */
|
|
145
|
+
animate?: boolean;
|
|
146
|
+
/** Additional classes */
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
declare function StatusText({ text, color, showLoader, animate, className, }: StatusTextProps): react.JSX.Element;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* VoiceMicButton Component
|
|
153
|
+
*
|
|
154
|
+
* Compact microphone button for chat with VAD (Voice Activity Detection).
|
|
155
|
+
* Uses shared recording primitives from ./recording.
|
|
156
|
+
*
|
|
157
|
+
* Features:
|
|
158
|
+
* - VAD rings that respond to audio level
|
|
159
|
+
* - Color feedback: green (voice), red (silent)
|
|
160
|
+
* - Compact design for chat toolbar
|
|
161
|
+
* - Recording timer display
|
|
162
|
+
*
|
|
163
|
+
* Refactored: 2025-12-11 - Uses shared recording primitives
|
|
164
|
+
*/
|
|
165
|
+
interface VoiceMicButtonProps {
|
|
166
|
+
isRecording: boolean;
|
|
167
|
+
isTranscribing: boolean;
|
|
168
|
+
audioLevel: number;
|
|
169
|
+
isSilent: boolean;
|
|
170
|
+
recordingTime: number;
|
|
171
|
+
onStart: () => void;
|
|
172
|
+
onStop: () => void;
|
|
173
|
+
className?: string;
|
|
174
|
+
}
|
|
175
|
+
declare function VoiceMicButton({ isRecording, isTranscribing, audioLevel, isSilent, recordingTime, onStart, onStop, className, }: VoiceMicButtonProps): react.JSX.Element;
|
|
176
|
+
|
|
177
|
+
interface SpeakButtonProps {
|
|
178
|
+
/** Text to speak. */
|
|
179
|
+
content: string;
|
|
180
|
+
/** Voice id (e.g. "nova"); shown in the tooltip. */
|
|
181
|
+
voice?: string;
|
|
182
|
+
/** Whether this is a user message (lets the player offer voice selection). */
|
|
183
|
+
isUserMessage?: boolean;
|
|
184
|
+
/** Open/play handler — provided by the app's audio player. */
|
|
185
|
+
onOpenPlayer: (text: string, voice: string, isUserMessage?: boolean) => void;
|
|
186
|
+
/**
|
|
187
|
+
* Synthesis in flight (B3-VOICE-FIGLASS-6): renders a spinner instead of the
|
|
188
|
+
* speaker, disables the button and sets aria-busy. TTS takes seconds; a
|
|
189
|
+
* silent button reads as dead and invites paid spam clicks. Wire it to
|
|
190
|
+
* `useVoice.isLoading` (scoped to this message via `currentText`).
|
|
191
|
+
*/
|
|
192
|
+
busy?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* The clip is already in the session cache (B3-VOICE-FIGLASS-8): clicking
|
|
195
|
+
* replays instantly and bills nothing. Renders a Play icon instead of the
|
|
196
|
+
* speaker so the user can tell "already generated" from "will synthesize
|
|
197
|
+
* (paid, takes seconds)". Wire it to `useVoice.hasCachedAudio(content, voice)`.
|
|
198
|
+
* `busy` takes precedence while a synthesis is in flight.
|
|
199
|
+
*/
|
|
200
|
+
cached?: boolean;
|
|
201
|
+
/** Size preset (drives default padding + icon size). */
|
|
202
|
+
size?: 'xs' | 'sm' | 'md';
|
|
203
|
+
/** Override the button class entirely (e.g. aurity's exact legacy string). */
|
|
204
|
+
className?: string;
|
|
205
|
+
/** Override the icon class. */
|
|
206
|
+
iconClassName?: string;
|
|
207
|
+
/** Override the tooltip (default: "Escuchar (<voice>)"). */
|
|
208
|
+
title?: string;
|
|
209
|
+
/** Tooltip while busy (default: "Generando audio…"). */
|
|
210
|
+
busyTitle?: string;
|
|
211
|
+
/** Tooltip when the clip is cached (default: "Reproducir (ya generado)"). */
|
|
212
|
+
cachedTitle?: string;
|
|
213
|
+
}
|
|
214
|
+
declare function SpeakButton({ content, voice, isUserMessage, onOpenPlayer, busy, cached, size, className, iconClassName, title, busyTitle, cachedTitle, }: SpeakButtonProps): react.JSX.Element;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* fi-glass · audioPlayer — the reusable TTS *playback* engine (headless).
|
|
218
|
+
*
|
|
219
|
+
* The missing half of the voice stack: `useVoice`/SpeakButton resolve an
|
|
220
|
+
* `AudioSource` (synthesis), but nothing in fi-glass actually PLAYS it — every
|
|
221
|
+
* consumer (aurity, and next og118) had to re-wire its own <audio>, play/stop,
|
|
222
|
+
* loading/error and object-URL cleanup. This engine owns that lifecycle once so
|
|
223
|
+
* apps inherit it instead of re-implementing it.
|
|
224
|
+
*
|
|
225
|
+
* Deliberately framework-agnostic and dependency-injected: it talks to an
|
|
226
|
+
* `AudioElementLike` (defaults to `new Audio()`) and to the object-URL helpers,
|
|
227
|
+
* so the whole state machine — including URL-leak cleanup — is unit-testable in
|
|
228
|
+
* node with a fake element and zero DOM. The React `useAudioPlayer` hook and the
|
|
229
|
+
* `<AudioPlayer>` component are thin shells over this.
|
|
230
|
+
*
|
|
231
|
+
* Ownership rule (avoids the leak in useVoice.close): the engine revokes ONLY
|
|
232
|
+
* the object URLs it created itself (from a Blob). A `{ url }` source is owned by
|
|
233
|
+
* the caller / kept open for streaming, so it is never revoked here.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
type AudioPlayerStatus = 'idle' | 'loading' | 'playing' | 'paused' | 'error';
|
|
237
|
+
interface AudioPlayerState {
|
|
238
|
+
status: AudioPlayerStatus;
|
|
239
|
+
isPlaying: boolean;
|
|
240
|
+
isLoading: boolean;
|
|
241
|
+
error: Error | null;
|
|
242
|
+
/** The URL currently loaded into the element (object URL or external url). */
|
|
243
|
+
currentSrc: string | null;
|
|
244
|
+
/** Seconds; 0 until metadata loads. */
|
|
245
|
+
duration: number;
|
|
246
|
+
currentTime: number;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The slice of HTMLAudioElement the engine touches. Real playback passes a
|
|
250
|
+
* `new Audio()`; tests pass a fake that drives the same events synchronously.
|
|
251
|
+
*/
|
|
252
|
+
interface AudioElementLike {
|
|
253
|
+
src: string;
|
|
254
|
+
currentTime: number;
|
|
255
|
+
readonly duration: number;
|
|
256
|
+
readonly paused: boolean;
|
|
257
|
+
play(): Promise<void>;
|
|
258
|
+
pause(): void;
|
|
259
|
+
load(): void;
|
|
260
|
+
addEventListener(type: string, listener: () => void): void;
|
|
261
|
+
removeEventListener(type: string, listener: () => void): void;
|
|
262
|
+
}
|
|
263
|
+
interface AudioPlayerDeps {
|
|
264
|
+
/** Build the audio element. Default: `() => new Audio()` (browser only). */
|
|
265
|
+
createElement?: () => AudioElementLike;
|
|
266
|
+
/** Default: `URL.createObjectURL`. */
|
|
267
|
+
createObjectURL?: (blob: Blob) => string;
|
|
268
|
+
/** Default: `URL.revokeObjectURL`. */
|
|
269
|
+
revokeObjectURL?: (url: string) => void;
|
|
270
|
+
}
|
|
271
|
+
interface AudioPlayerOptions extends AudioPlayerDeps {
|
|
272
|
+
/** Called on a playback/load error (app owns logging/reporting). */
|
|
273
|
+
onError?: (error: unknown, context: string) => void;
|
|
274
|
+
/** Called once when the current clip finishes. */
|
|
275
|
+
onEnded?: () => void;
|
|
276
|
+
}
|
|
277
|
+
interface AudioPlayerController {
|
|
278
|
+
getState(): AudioPlayerState;
|
|
279
|
+
/** Subscribe to state changes; returns an unsubscribe fn. */
|
|
280
|
+
subscribe(listener: () => void): () => void;
|
|
281
|
+
/** Point the player at a new source (revokes any previously-owned URL). */
|
|
282
|
+
load(source: AudioSource): void;
|
|
283
|
+
/** Start/resume playback of the loaded source. */
|
|
284
|
+
play(): Promise<void>;
|
|
285
|
+
pause(): void;
|
|
286
|
+
/** Stop, rewind to 0 and release any owned object URL. */
|
|
287
|
+
stop(): void;
|
|
288
|
+
/** Play if paused/idle, pause if playing. */
|
|
289
|
+
toggle(): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Jump to an absolute position in seconds, clamped to [0, duration] (or
|
|
292
|
+
* [0, seconds] while duration is still unknown). Drives the rich progress
|
|
293
|
+
* bar / scrubber. No-op after dispose or before a source is loaded.
|
|
294
|
+
*/
|
|
295
|
+
seek(seconds: number): void;
|
|
296
|
+
/**
|
|
297
|
+
* Move the playhead by a relative delta in seconds (negative = rewind),
|
|
298
|
+
* clamped like `seek`. Powers the "back 10s / forward 10s" controls.
|
|
299
|
+
*/
|
|
300
|
+
seekBy(deltaSeconds: number): void;
|
|
301
|
+
/** Tear down: detach listeners, pause, release owned URL. Idempotent. */
|
|
302
|
+
dispose(): void;
|
|
303
|
+
}
|
|
304
|
+
declare function createAudioPlayer(options?: AudioPlayerOptions): AudioPlayerController;
|
|
305
|
+
|
|
306
|
+
interface UseAudioPlayerOptions {
|
|
307
|
+
onError?: (error: unknown, context: string) => void;
|
|
308
|
+
onEnded?: () => void;
|
|
309
|
+
/**
|
|
310
|
+
* Dependency overrides forwarded to the engine. Apps never need these; tests
|
|
311
|
+
* and non-DOM environments inject a fake element / URL helpers.
|
|
312
|
+
*/
|
|
313
|
+
deps?: Pick<AudioPlayerOptions, 'createElement' | 'createObjectURL' | 'revokeObjectURL'>;
|
|
314
|
+
}
|
|
315
|
+
interface UseAudioPlayerReturn extends AudioPlayerState {
|
|
316
|
+
/** Point the player at a source without starting it. */
|
|
317
|
+
load: (source: AudioSource) => void;
|
|
318
|
+
play: () => Promise<void>;
|
|
319
|
+
pause: () => void;
|
|
320
|
+
stop: () => void;
|
|
321
|
+
toggle: () => Promise<void>;
|
|
322
|
+
/** Jump to an absolute position (seconds), clamped to [0, duration]. */
|
|
323
|
+
seek: (seconds: number) => void;
|
|
324
|
+
/** Move the playhead by a relative delta (seconds); negative rewinds. */
|
|
325
|
+
seekBy: (deltaSeconds: number) => void;
|
|
326
|
+
/** Convenience: load a source and immediately play it. */
|
|
327
|
+
playSource: (source: AudioSource) => Promise<void>;
|
|
328
|
+
}
|
|
329
|
+
declare function useAudioPlayer(opts?: UseAudioPlayerOptions): UseAudioPlayerReturn;
|
|
330
|
+
|
|
331
|
+
interface AudioPlayerProps {
|
|
332
|
+
/** Audio to play; when it changes the player loads the new source. */
|
|
333
|
+
source?: AudioSource | null;
|
|
334
|
+
/** Start playing as soon as a new source loads. Default false. */
|
|
335
|
+
autoPlay?: boolean;
|
|
336
|
+
/** Called on a playback/load error. */
|
|
337
|
+
onError?: (error: unknown, context: string) => void;
|
|
338
|
+
/** Called when the clip finishes. */
|
|
339
|
+
onEnded?: () => void;
|
|
340
|
+
/** Override the wrapper class. */
|
|
341
|
+
className?: string;
|
|
342
|
+
/** Override the button class (applies to both buttons). */
|
|
343
|
+
buttonClassName?: string;
|
|
344
|
+
/** Override the icon class. */
|
|
345
|
+
iconClassName?: string;
|
|
346
|
+
}
|
|
347
|
+
declare function AudioPlayer({ source, autoPlay, onError, onEnded, className, buttonClassName, iconClassName, }: AudioPlayerProps): react.JSX.Element;
|
|
348
|
+
|
|
349
|
+
interface RichAudioPlayerProps {
|
|
350
|
+
/** Audio to play; when it changes the player loads the new source. */
|
|
351
|
+
source?: AudioSource | null;
|
|
352
|
+
/** Start playing as soon as a new source loads. Default false. */
|
|
353
|
+
autoPlay?: boolean;
|
|
354
|
+
/** Seconds the skip-back / skip-forward controls jump. Default 10. */
|
|
355
|
+
skipSeconds?: number;
|
|
356
|
+
/** Show the mm:ss / mm:ss time readout. Default true. */
|
|
357
|
+
showTime?: boolean;
|
|
358
|
+
/** Called on a playback/load error. */
|
|
359
|
+
onError?: (error: unknown, context: string) => void;
|
|
360
|
+
/** Called when the clip finishes. */
|
|
361
|
+
onEnded?: () => void;
|
|
362
|
+
/** Override the wrapper class. */
|
|
363
|
+
className?: string;
|
|
364
|
+
/** Override the button class (applies to all transport buttons). */
|
|
365
|
+
buttonClassName?: string;
|
|
366
|
+
/** Override the icon class. */
|
|
367
|
+
iconClassName?: string;
|
|
368
|
+
/** Override the progress scrubber class. */
|
|
369
|
+
progressClassName?: string;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Format seconds as mm:ss (or h:mm:ss past an hour). Pure + exported so the
|
|
373
|
+
* readout formatting is unit-tested without rendering. Guards NaN/negatives
|
|
374
|
+
* (duration is NaN until metadata loads) by collapsing them to 0:00.
|
|
375
|
+
*/
|
|
376
|
+
declare function formatPlaybackTime(seconds: number): string;
|
|
377
|
+
declare function RichAudioPlayer({ source, autoPlay, skipSeconds, showTime, onError, onEnded, className, buttonClassName, iconClassName, progressClassName, }: RichAudioPlayerProps): react.JSX.Element;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* fi-glass · AudioVisualizer — reusable audio-level graphic (bars / pulse).
|
|
381
|
+
*
|
|
382
|
+
* The visual half of the voice UX that AURITY had baked into its clinical
|
|
383
|
+
* capture screen: animated bars and pulsing rings that react to audio level.
|
|
384
|
+
* Extracted here as a pure, presentational primitive so any surface — a TTS
|
|
385
|
+
* player, a recording composer, a future shell — can render levels without
|
|
386
|
+
* pulling in Web Audio, a microphone, or the network.
|
|
387
|
+
*
|
|
388
|
+
* Deliberately data-driven: it renders whatever normalized `levels` (0..1) it
|
|
389
|
+
* is handed. Real consumers feed it analyser output (e.g. `useAudioAnalysis`
|
|
390
|
+
* scaled to 0..1); tests feed it a fixed array. No effects, no timers, no
|
|
391
|
+
* randomness — same props in, same DOM out — so it is unit-testable with static
|
|
392
|
+
* rendering and never depends on a live mic.
|
|
393
|
+
*
|
|
394
|
+
* Accessibility: it is a non-interactive graphic, exposed as role="img" with a
|
|
395
|
+
* label so assistive tech announces it as a single "audio level" image rather
|
|
396
|
+
* than a pile of empty divs.
|
|
397
|
+
*/
|
|
398
|
+
type AudioVisualizerVariant = 'bars' | 'pulse';
|
|
399
|
+
interface AudioVisualizerProps {
|
|
400
|
+
/**
|
|
401
|
+
* Normalized amplitude samples in [0, 1]. Out-of-range values are clamped.
|
|
402
|
+
* For `bars`, each sample is one bar; for `pulse`, the peak drives the ring.
|
|
403
|
+
*/
|
|
404
|
+
levels: number[];
|
|
405
|
+
/** Visual style. Default 'bars'. */
|
|
406
|
+
variant?: AudioVisualizerVariant;
|
|
407
|
+
/**
|
|
408
|
+
* Whether the source is actively producing audio. When false the graphic
|
|
409
|
+
* renders at rest (flat bars / collapsed pulse) regardless of `levels`, so a
|
|
410
|
+
* paused player or an idle mic reads as silent.
|
|
411
|
+
*/
|
|
412
|
+
active?: boolean;
|
|
413
|
+
/**
|
|
414
|
+
* For `bars`: force a fixed bar count, resampling `levels` to fit. Defaults to
|
|
415
|
+
* `levels.length`. Lets a surface keep a stable bar count across frames.
|
|
416
|
+
*/
|
|
417
|
+
barCount?: number;
|
|
418
|
+
/** Accessible label. Default 'Visualizador de nivel de audio'. */
|
|
419
|
+
label?: string;
|
|
420
|
+
/** Wrapper class. */
|
|
421
|
+
className?: string;
|
|
422
|
+
/** Per-bar class (bars variant). */
|
|
423
|
+
barClassName?: string;
|
|
424
|
+
/** Fill color applied inline (bars background / pulse border). */
|
|
425
|
+
color?: string;
|
|
426
|
+
}
|
|
427
|
+
/** Clamp to [0,1] and drop non-finite values to 0. Pure + exported for tests. */
|
|
428
|
+
declare function normalizeLevels(levels: number[]): number[];
|
|
429
|
+
/**
|
|
430
|
+
* Resample an array to exactly `count` points by nearest-index sampling. Pure +
|
|
431
|
+
* exported so the resampling rule is unit-tested. Returns zeros for count<=0.
|
|
432
|
+
*/
|
|
433
|
+
declare function resampleLevels(levels: number[], count: number): number[];
|
|
434
|
+
declare function AudioVisualizer({ levels, variant, active, barCount, label, className, barClassName, color, }: AudioVisualizerProps): react.JSX.Element;
|
|
435
|
+
|
|
436
|
+
interface ComposerMicSlotProps {
|
|
437
|
+
/**
|
|
438
|
+
* Whether voice dictation is wired (an STT adapter exists). Default false →
|
|
439
|
+
* the slot renders disabled/unavailable. No STT backend is required for the
|
|
440
|
+
* slot itself; this flag is the consumer's declaration of capability.
|
|
441
|
+
*/
|
|
442
|
+
available?: boolean;
|
|
443
|
+
/** Currently capturing audio. */
|
|
444
|
+
recording?: boolean;
|
|
445
|
+
/** Transcribing / processing — shows a spinner and disables interaction. */
|
|
446
|
+
busy?: boolean;
|
|
447
|
+
/** Begin capture (consumer owns the recorder). Ignored when unavailable. */
|
|
448
|
+
onStart?: () => void;
|
|
449
|
+
/** Stop capture. Ignored when unavailable. */
|
|
450
|
+
onStop?: () => void;
|
|
451
|
+
/** Label/title shown while unavailable. */
|
|
452
|
+
unavailableLabel?: string;
|
|
453
|
+
/** aria-label for the start affordance. */
|
|
454
|
+
startLabel?: string;
|
|
455
|
+
/** aria-label for the stop affordance. */
|
|
456
|
+
stopLabel?: string;
|
|
457
|
+
/** aria-label while busy. */
|
|
458
|
+
busyLabel?: string;
|
|
459
|
+
/** Wrapper class. */
|
|
460
|
+
className?: string;
|
|
461
|
+
/** Button class. */
|
|
462
|
+
buttonClassName?: string;
|
|
463
|
+
/** Icon class. */
|
|
464
|
+
iconClassName?: string;
|
|
465
|
+
}
|
|
466
|
+
declare function ComposerMicSlot({ available, recording, busy, onStart, onStop, unavailableLabel, startLabel, stopLabel, busyLabel, className, buttonClassName, iconClassName, }: ComposerMicSlotProps): react.JSX.Element;
|
|
467
|
+
|
|
468
|
+
interface UseVoiceOptions {
|
|
469
|
+
/** Called when synthesis fails (app decides logging/reporting). */
|
|
470
|
+
onError?: (error: unknown, context: string) => void;
|
|
471
|
+
}
|
|
472
|
+
interface UseVoiceReturn {
|
|
473
|
+
isOpen: boolean;
|
|
474
|
+
isLoading: boolean;
|
|
475
|
+
audioUrl: string | null;
|
|
476
|
+
voiceName: string;
|
|
477
|
+
isUserMessage: boolean;
|
|
478
|
+
currentVoice: string;
|
|
479
|
+
currentText: string;
|
|
480
|
+
generateAudio: (text: string, voice?: string, isUser?: boolean) => Promise<void>;
|
|
481
|
+
changeVoice: (newVoice: string) => Promise<void>;
|
|
482
|
+
close: () => void;
|
|
483
|
+
/**
|
|
484
|
+
* Whether `text` (+`voice`, default 'nova') is already in the session cache —
|
|
485
|
+
* i.e. clicking Speak would replay instantly and bill nothing. Lets the UI
|
|
486
|
+
* tell "will synthesize (paid, seconds)" apart from "already generated"
|
|
487
|
+
* (B3-VOICE-FIGLASS-8). Render-time freshness is guaranteed by the state
|
|
488
|
+
* updates every synthesis already makes (isLoading/audioUrl).
|
|
489
|
+
*/
|
|
490
|
+
hasCachedAudio: (text: string, voice?: string) => boolean;
|
|
491
|
+
}
|
|
492
|
+
declare function useVoice(adapter: VoiceAdapter | undefined, opts?: UseVoiceOptions): UseVoiceReturn;
|
|
493
|
+
|
|
494
|
+
interface UseDictationOptions {
|
|
495
|
+
/** Chunk interval in ms handed to the recorder (default 30s). */
|
|
496
|
+
timeSliceMs?: number;
|
|
497
|
+
/** Specific audio input device id. */
|
|
498
|
+
deviceId?: string | null;
|
|
499
|
+
/** Called with the full accumulated transcript on each chunk. */
|
|
500
|
+
onTranscriptUpdate?: (full: string) => void;
|
|
501
|
+
/** Called on recording/transcription failure. */
|
|
502
|
+
onError?: (message: string) => void;
|
|
503
|
+
}
|
|
504
|
+
interface UseDictationReturn {
|
|
505
|
+
isRecording: boolean;
|
|
506
|
+
recordingTime: number;
|
|
507
|
+
audioLevel: number;
|
|
508
|
+
isSilent: boolean;
|
|
509
|
+
/** Live, normalized (0..1) frequency bands — feed AudioVisualizer `levels`. */
|
|
510
|
+
bands: number[];
|
|
511
|
+
liveTranscript: string;
|
|
512
|
+
isTranscribing: boolean;
|
|
513
|
+
startRecording: () => Promise<void>;
|
|
514
|
+
stopRecording: () => Promise<void>;
|
|
515
|
+
}
|
|
516
|
+
declare function useDictation(adapter: VoiceAdapter | undefined, opts?: UseDictationOptions): UseDictationReturn;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* useRecorder Hook
|
|
520
|
+
*
|
|
521
|
+
* Maneja la grabación de audio con arquitectura dual recorder:
|
|
522
|
+
* - Chunked recorder: Para transcripción en tiempo real (chunks de 3s)
|
|
523
|
+
* - Continuous recorder: Para audio completo sin chunks (playback final)
|
|
524
|
+
*
|
|
525
|
+
* Extraído de ConversationCapture durante refactoring incremental.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* const { isRecording, recordingTime, startRecording, stopRecording, fullAudioBlob, currentStream } =
|
|
529
|
+
* useRecorder({
|
|
530
|
+
* onChunk: async (blob, chunkNumber) => {
|
|
531
|
+
* // Process chunk (upload, transcribe, etc.)
|
|
532
|
+
* },
|
|
533
|
+
* onError: (error) => console.error(error)
|
|
534
|
+
* });
|
|
535
|
+
*/
|
|
536
|
+
interface UseRecorderConfig {
|
|
537
|
+
onChunk: (blob: Blob, chunkNumber: number) => Promise<void> | void;
|
|
538
|
+
onError?: (error: string) => void;
|
|
539
|
+
timeSlice?: number;
|
|
540
|
+
sampleRate?: number;
|
|
541
|
+
channels?: number;
|
|
542
|
+
/** Optional external MediaStream (e.g., from demo audio) instead of microphone */
|
|
543
|
+
externalStream?: MediaStream | null;
|
|
544
|
+
/** Specific audio input device ID (null = use system default) */
|
|
545
|
+
deviceId?: string | null;
|
|
546
|
+
}
|
|
547
|
+
interface UseRecorderReturn {
|
|
548
|
+
isRecording: boolean;
|
|
549
|
+
recordingTime: number;
|
|
550
|
+
currentStream: MediaStream | null;
|
|
551
|
+
fullAudioBlob: Blob | null;
|
|
552
|
+
fullAudioUrl: string | null;
|
|
553
|
+
startRecording: () => Promise<void>;
|
|
554
|
+
stopRecording: () => Promise<Blob | null>;
|
|
555
|
+
}
|
|
556
|
+
declare function useRecorder(config: UseRecorderConfig): UseRecorderReturn;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* useAudioAnalysis Hook
|
|
560
|
+
*
|
|
561
|
+
* Analiza el nivel de audio en tiempo real usando Web Audio API.
|
|
562
|
+
* Incluye detección de silencio y control de ganancia.
|
|
563
|
+
* Extraído de ConversationCapture durante refactoring incremental.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* const { audioLevel, isSilent } = useAudioAnalysis(stream, {
|
|
567
|
+
* silenceThreshold: 5,
|
|
568
|
+
* gain: 2.5,
|
|
569
|
+
* isActive: isRecording
|
|
570
|
+
* });
|
|
571
|
+
*/
|
|
572
|
+
interface AudioAnalysisConfig {
|
|
573
|
+
silenceThreshold?: number;
|
|
574
|
+
gain?: number;
|
|
575
|
+
isActive: boolean;
|
|
576
|
+
/** How many frequency bands to expose for a bar visualizer. Default 24. */
|
|
577
|
+
bandCount?: number;
|
|
578
|
+
}
|
|
579
|
+
interface UseAudioAnalysisReturn {
|
|
580
|
+
audioLevel: number;
|
|
581
|
+
isSilent: boolean;
|
|
582
|
+
/**
|
|
583
|
+
* Normalized (0..1) frequency bands, downsampled from the analyser's spectrum
|
|
584
|
+
* to `bandCount` entries. Empty + zeroed while inactive. Feed straight to
|
|
585
|
+
* AudioVisualizer `levels` for a live equalizer that reacts to the voice's
|
|
586
|
+
* pitch, not just its volume.
|
|
587
|
+
*/
|
|
588
|
+
bands: number[];
|
|
589
|
+
}
|
|
590
|
+
declare function useAudioAnalysis(stream: MediaStream | null, config: AudioAnalysisConfig): UseAudioAnalysisReturn;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* RecordRTC-based Audio Recorder Factory
|
|
594
|
+
*
|
|
595
|
+
* Uses stop/start loop pattern to generate chunks with valid headers.
|
|
596
|
+
* Each chunk is a COMPLETE recording with full EBML/WAV headers.
|
|
597
|
+
*
|
|
598
|
+
* Why RecordRTC only (no MediaRecorder fallback):
|
|
599
|
+
* - MediaRecorder generates headerless chunks after chunk 0
|
|
600
|
+
* - OpenAI Whisper rejects headerless chunks with 400 error
|
|
601
|
+
* - A broken fallback is worse than a clear error
|
|
602
|
+
*
|
|
603
|
+
* File: apps/aurity/lib/recording/makeRecorder.ts
|
|
604
|
+
* Updated: 2025-12-11 (Removed broken MediaRecorder fallback)
|
|
605
|
+
*/
|
|
606
|
+
type ChunkHandler = (blob: Blob) => void;
|
|
607
|
+
interface RecorderOptions {
|
|
608
|
+
timeSlice?: number;
|
|
609
|
+
sampleRate?: number;
|
|
610
|
+
channels?: number;
|
|
611
|
+
}
|
|
612
|
+
interface Recorder {
|
|
613
|
+
start: () => void;
|
|
614
|
+
stop: () => Promise<Blob>;
|
|
615
|
+
kind: 'recordrtc';
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Create audio recorder with chunk support using RecordRTC.
|
|
619
|
+
*
|
|
620
|
+
* Uses stop/start loop pattern:
|
|
621
|
+
* 1. Record for N seconds
|
|
622
|
+
* 2. Stop recording → generates complete file with headers
|
|
623
|
+
* 3. Get blob → chunk has all headers (EBML/WAV)
|
|
624
|
+
* 4. Start new recording → next chunk also complete
|
|
625
|
+
*
|
|
626
|
+
* @param stream MediaStream from getUserMedia
|
|
627
|
+
* @param onChunk Callback for each chunk (timeslice interval)
|
|
628
|
+
* @param opts Recording options
|
|
629
|
+
* @returns Recorder instance
|
|
630
|
+
* @throws Error if RecordRTC import fails
|
|
631
|
+
*/
|
|
632
|
+
declare function makeRecorder(stream: MediaStream, onChunk: ChunkHandler, opts?: RecorderOptions): Promise<Recorder>;
|
|
633
|
+
|
|
634
|
+
type AudioArtifactState = 'recording' | 'paused' | 'stopping' | 'saved' | 'queued' | 'uploading' | 'transcribing' | 'transcribed' | 'archived' | 'failed' | 'deleted';
|
|
635
|
+
interface AudioArtifact {
|
|
636
|
+
id: string;
|
|
637
|
+
mime: string;
|
|
638
|
+
size: number;
|
|
639
|
+
durationMs?: number;
|
|
640
|
+
createdAt: string;
|
|
641
|
+
updatedAt: string;
|
|
642
|
+
state: AudioArtifactState;
|
|
643
|
+
transcript?: string;
|
|
644
|
+
errorMessage?: string;
|
|
645
|
+
}
|
|
646
|
+
interface StoredAudioArtifact extends AudioArtifact {
|
|
647
|
+
blob: Blob;
|
|
648
|
+
}
|
|
649
|
+
interface AudioQueuePolicy {
|
|
650
|
+
maxItems: number;
|
|
651
|
+
maxBytes: number;
|
|
652
|
+
maxBytesPerItem: number;
|
|
653
|
+
}
|
|
654
|
+
declare const AUDIO_QUEUE_DEFAULTS: AudioQueuePolicy;
|
|
655
|
+
declare function makeArtifactId(): string;
|
|
656
|
+
declare function isPending(a: AudioArtifact): boolean;
|
|
657
|
+
declare function isTerminal(a: AudioArtifact): boolean;
|
|
658
|
+
declare function artifactLabel(state: AudioArtifactState): string;
|
|
659
|
+
declare function formatArtifactSize(bytes: number): string;
|
|
660
|
+
declare function formatArtifactDuration(ms?: number): string;
|
|
661
|
+
|
|
662
|
+
interface AudioQueueStoreOptions {
|
|
663
|
+
dbName?: string;
|
|
664
|
+
storeName?: string;
|
|
665
|
+
}
|
|
666
|
+
declare class AudioQueueStore {
|
|
667
|
+
private readonly dbName;
|
|
668
|
+
private readonly storeName;
|
|
669
|
+
private dbPromise;
|
|
670
|
+
constructor(opts?: AudioQueueStoreOptions);
|
|
671
|
+
private open;
|
|
672
|
+
private run;
|
|
673
|
+
list(): Promise<StoredAudioArtifact[]>;
|
|
674
|
+
get(id: string): Promise<StoredAudioArtifact | null>;
|
|
675
|
+
put(artifact: StoredAudioArtifact): Promise<void>;
|
|
676
|
+
updateMeta(id: string, patch: Partial<Omit<AudioArtifact, 'id' | 'blob'>>): Promise<void>;
|
|
677
|
+
delete(id: string): Promise<void>;
|
|
678
|
+
clear(): Promise<void>;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
interface UseDurableRecordingOptions {
|
|
682
|
+
store: AudioQueueStore;
|
|
683
|
+
policy?: AudioQueuePolicy;
|
|
684
|
+
deviceId?: string | null;
|
|
685
|
+
onSaved?: (artifact: AudioArtifact) => void;
|
|
686
|
+
onError?: (message: string) => void;
|
|
687
|
+
}
|
|
688
|
+
interface UseDurableRecordingReturn {
|
|
689
|
+
artifact: AudioArtifact | null;
|
|
690
|
+
recordingTime: number;
|
|
691
|
+
/** Everything recorded so far, available while state === 'paused' (null
|
|
692
|
+
* otherwise). A complete playable WAV — feed it to a player as a preview. */
|
|
693
|
+
pausedPreviewBlob: Blob | null;
|
|
694
|
+
bands: number[];
|
|
695
|
+
audioLevel: number;
|
|
696
|
+
isSilent: boolean;
|
|
697
|
+
isStarting: boolean;
|
|
698
|
+
startRecording: () => Promise<void>;
|
|
699
|
+
pauseRecording: () => void;
|
|
700
|
+
resumeRecording: () => void;
|
|
701
|
+
stopRecording: () => Promise<AudioArtifact | null>;
|
|
702
|
+
cancelRecording: () => void;
|
|
703
|
+
isAtCapacity: boolean;
|
|
704
|
+
}
|
|
705
|
+
declare function useDurableRecording(opts: UseDurableRecordingOptions): UseDurableRecordingReturn;
|
|
706
|
+
|
|
707
|
+
interface UseAudioQueueOptions {
|
|
708
|
+
store: AudioQueueStore;
|
|
709
|
+
adapter?: VoiceAdapter;
|
|
710
|
+
onTranscribed?: (id: string, text: string) => void;
|
|
711
|
+
onError?: (id: string, message: string) => void;
|
|
712
|
+
}
|
|
713
|
+
interface UseAudioQueueReturn {
|
|
714
|
+
artifacts: AudioArtifact[];
|
|
715
|
+
totalBytes: number;
|
|
716
|
+
isLoading: boolean;
|
|
717
|
+
transcribeArtifact: (id: string) => Promise<void>;
|
|
718
|
+
retryTranscription: (id: string) => Promise<void>;
|
|
719
|
+
getPlaybackUrl: (id: string) => Promise<string | null>;
|
|
720
|
+
deleteArtifact: (id: string) => Promise<void>;
|
|
721
|
+
archiveArtifact: (id: string) => Promise<void>;
|
|
722
|
+
clearTranscribed: () => Promise<void>;
|
|
723
|
+
reload: () => Promise<void>;
|
|
724
|
+
}
|
|
725
|
+
declare function useAudioQueue(opts: UseAudioQueueOptions): UseAudioQueueReturn;
|
|
726
|
+
|
|
727
|
+
interface AudioQueuePanelProps {
|
|
728
|
+
queue: UseAudioQueueReturn;
|
|
729
|
+
/** CSS class applied to the root container */
|
|
730
|
+
className?: string;
|
|
731
|
+
/** Privacy notice text. Defaults to a generic local-storage notice. */
|
|
732
|
+
privacyNotice?: string;
|
|
733
|
+
/** How long the privacy notice stays visible, in ms. 0 keeps it forever.
|
|
734
|
+
* Default 35s — it is recurring info, not a warning the user must dismiss. */
|
|
735
|
+
privacyNoticeMs?: number;
|
|
736
|
+
/** Max visible items before scroll */
|
|
737
|
+
maxVisible?: number;
|
|
738
|
+
/** Artifact ids to hide from the panel (e.g. the active draft shown inline
|
|
739
|
+
* via AudioDraftPlayer, so it is not duplicated in the backlog list). */
|
|
740
|
+
excludeIds?: string[];
|
|
741
|
+
}
|
|
742
|
+
declare function AudioQueuePanel({ queue, className, privacyNotice, privacyNoticeMs, maxVisible, excludeIds, }: AudioQueuePanelProps): react.JSX.Element | null;
|
|
743
|
+
|
|
744
|
+
interface AudioQueueItemProps {
|
|
745
|
+
artifact: AudioArtifact;
|
|
746
|
+
onTranscribe?: (id: string) => void;
|
|
747
|
+
onRetry?: (id: string) => void;
|
|
748
|
+
onDelete?: (id: string) => void;
|
|
749
|
+
/** Mark a transcribed artifact as used/sent — hides it from the queue
|
|
750
|
+
* without deleting the audio. */
|
|
751
|
+
onArchive?: (id: string) => void;
|
|
752
|
+
onGetPlaybackUrl?: (id: string) => Promise<string | null>;
|
|
753
|
+
className?: string;
|
|
754
|
+
}
|
|
755
|
+
declare function AudioQueueItem({ artifact, onTranscribe, onRetry, onDelete, onArchive, onGetPlaybackUrl, className, }: AudioQueueItemProps): react.JSX.Element;
|
|
756
|
+
|
|
757
|
+
interface AudioDraftPlayerProps {
|
|
758
|
+
/** The draft artifact (the just-recorded, not-yet-acted-on audio). */
|
|
759
|
+
artifact: AudioArtifact;
|
|
760
|
+
/** Resolve a playback object URL for the artifact (revoked here on unmount). */
|
|
761
|
+
onGetPlaybackUrl?: (id: string) => Promise<string | null>;
|
|
762
|
+
/** Primary action — transcribe / send / use the draft. */
|
|
763
|
+
onPrimary?: (id: string) => void;
|
|
764
|
+
/** Discard the draft (deletes the real artifact). */
|
|
765
|
+
onDiscard?: (id: string) => void;
|
|
766
|
+
/** Retry a failed primary action. */
|
|
767
|
+
onRetry?: (id: string) => void;
|
|
768
|
+
/** Resume a paused recording. When provided, a Resume button replaces the
|
|
769
|
+
* primary action (the user hasn't finished recording yet). */
|
|
770
|
+
onResume?: () => void;
|
|
771
|
+
/** Everything recorded so far, available while paused (segmented pause).
|
|
772
|
+
* When set, the paused row plays it back through RichAudioPlayer. */
|
|
773
|
+
pausedPreview?: Blob | null;
|
|
774
|
+
/** Label for the primary action button (default: "Transcribir"). */
|
|
775
|
+
primaryActionLabel?: string;
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
declare function AudioDraftPlayer({ artifact, onGetPlaybackUrl, onPrimary, onDiscard, onRetry, onResume, pausedPreview, primaryActionLabel, className, }: AudioDraftPlayerProps): react.JSX.Element;
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Concatenate same-format PCM WAV blobs into one WAV.
|
|
782
|
+
*
|
|
783
|
+
* A single segment is returned as-is (no parse, no copy) — the common case
|
|
784
|
+
* when the user never paused. Throws if segments disagree on sample rate,
|
|
785
|
+
* channels, or bit depth: that would splice garbage, and the recorder pins
|
|
786
|
+
* one format for the whole session, so a mismatch is a bug upstream.
|
|
787
|
+
*/
|
|
788
|
+
declare function mergeWavBlobs(blobs: Blob[]): Promise<Blob>;
|
|
789
|
+
|
|
790
|
+
export { AUDIO_QUEUE_DEFAULTS, type AudioArtifact, type AudioArtifactState, AudioDraftPlayer, type AudioDraftPlayerProps, type AudioElementLike, AudioPlayer, type AudioPlayerController, type AudioPlayerOptions, type AudioPlayerProps, type AudioPlayerState, type AudioPlayerStatus, AudioQueueItem, type AudioQueueItemProps, AudioQueuePanel, type AudioQueuePanelProps, type AudioQueuePolicy, AudioQueueStore, type AudioQueueStoreOptions, AudioVisualizer, type AudioVisualizerProps, type AudioVisualizerVariant, BUTTON_SIZES, type ButtonSize, type ButtonSizeConfig, COLOR_THEMES, type ColorTheme, ComposerMicSlot, type ComposerMicSlotProps, type PulseConfig, PulseRings, type PulseRingsProps, type PulseStyle, RecordingButton, type RecordingButtonProps, type RecordingStateType, RecordingTimer, type RecordingTimerProps, RichAudioPlayer, type RichAudioPlayerProps, STATUS_TEXT_EN, STATUS_TEXT_ES, SpeakButton, type SpeakButtonProps, type StateColors, StatusText, type StatusTextConfig, type StatusTextProps, type StoredAudioArtifact, type UseAudioPlayerOptions, type UseAudioPlayerReturn, type UseAudioQueueOptions, type UseAudioQueueReturn, type UseDictationOptions, type UseDictationReturn, type UseDurableRecordingOptions, type UseDurableRecordingReturn, type UseVoiceOptions, type UseVoiceReturn, VoiceMicButton, artifactLabel, createAudioPlayer, formatArtifactDuration, formatArtifactSize, formatPlaybackTime, formatRecordingTime, isPending, isTerminal, makeArtifactId, makeRecorder, mergeWavBlobs, normalizeLevels, resampleLevels, useAudioAnalysis, useAudioPlayer, useAudioQueue, useDictation, useDurableRecording, useRecorder, useVoice };
|