@happyvertical/smrt-voice 0.51.32 → 0.51.33

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=__smrt-register__.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,587 +1,40 @@
1
- import { AudioInput } from '@happyvertical/speech';
2
- import { Content } from '@happyvertical/smrt-content';
3
- import { ContentOptions } from '@happyvertical/smrt-content';
4
- import { SmrtObject } from '@happyvertical/smrt-core';
5
- import { SmrtObjectOptions } from '@happyvertical/smrt-core';
6
- import { Speech } from '@happyvertical/speech';
7
- import { SpeechAdapterAvailability } from '@happyvertical/speech';
8
- import { SpeechSynthesizer } from '@happyvertical/speech';
9
- import { SpeechSynthesizerType } from '@happyvertical/speech';
10
- import { SpeechVoice } from '@happyvertical/speech';
11
- import { SpeechVoiceInput } from '@happyvertical/speech';
12
- import { WordTiming as SpeechWordTiming } from '@happyvertical/speech';
13
- import { SynthesisRequest } from '@happyvertical/speech';
14
- import { SynthesizedSpeech } from '@happyvertical/speech';
15
- import { Transcriber } from '@happyvertical/speech';
16
- import { TranscriberType } from '@happyvertical/speech';
17
- import { TranscriptionRequest } from '@happyvertical/speech';
18
- import { TranscriptResult } from '@happyvertical/speech';
19
- import { TranscriptSegment } from '@happyvertical/speech';
20
-
21
- export { AudioInput }
22
-
23
- export declare function metadataFromSynthesizedSpeech(speech: SynthesizedSpeech): VoiceOutputMetadata;
24
-
25
- /**
26
- * Audio sample quality rating
27
- */
28
- export declare type SampleQuality = 'low' | 'medium' | 'high';
29
-
30
- export { Speech }
31
-
32
- export { SpeechAdapterAvailability }
33
-
34
- export { SpeechSynthesizer }
35
-
36
- export { SpeechSynthesizerType }
37
-
38
- export { SpeechVoice }
39
-
40
- export { SpeechVoiceInput }
41
-
42
- export { SpeechWordTiming }
43
-
44
- export { SynthesisRequest }
45
-
46
- export { SynthesizedSpeech }
47
-
48
- export { Transcriber }
49
-
50
- export { TranscriberType }
51
-
52
- export { TranscriptionRequest }
53
-
54
- export { TranscriptResult }
55
-
56
- export { TranscriptSegment }
57
-
58
- /**
59
- * Voice gender classification
60
- */
61
- export declare type VoiceGender = 'male' | 'female' | 'neutral';
62
-
63
- /**
64
- * Generated audio output from text-to-speech synthesis
65
- *
66
- * VoiceOutput extends Content to represent audio generated from
67
- * text using a VoiceProfile. It includes word-level timing information
68
- * for lip-sync alignment in video production.
69
- *
70
- * @example
71
- * ```typescript
72
- * import { VoiceOutput } from '@happyvertical/smrt-voice';
73
- *
74
- * const output = new VoiceOutput({
75
- * voiceProfileId: 'voice-123',
76
- * sourceText: 'Welcome to the evening news broadcast.',
77
- * audioAssetId: 'asset-789',
78
- * duration: 3.5,
79
- * wordTimings: [
80
- * { word: 'Welcome', start: 0.0, end: 0.4 },
81
- * { word: 'to', start: 0.4, end: 0.5 },
82
- * { word: 'the', start: 0.5, end: 0.6 },
83
- * { word: 'evening', start: 0.6, end: 1.0 },
84
- * { word: 'news', start: 1.0, end: 1.3 },
85
- * { word: 'broadcast', start: 1.3, end: 1.9 },
86
- * ],
87
- * audioMetadata: {
88
- * sampleRate: 48000,
89
- * format: 'wav',
90
- * channels: 1,
91
- * provider: 'qwen3-tts',
92
- * },
93
- * });
94
- * ```
95
- */
96
- export declare class VoiceOutput extends Content {
97
- /**
98
- * Voice profile used for synthesis
99
- */
100
- voiceProfileId: string | null;
101
- /**
102
- * Original text that was synthesized
103
- */
104
- sourceText: string;
105
- /**
106
- * Asset ID of the generated audio file
107
- */
108
- audioAssetId: string | null;
109
- /**
110
- * Duration of the generated audio in seconds
111
- */
112
- duration: number;
113
- /**
114
- * Word-level timing information for lip-sync alignment
115
- */
116
- wordTimings: WordTiming[] | null;
117
- /**
118
- * Audio metadata (sample rate, format, etc.)
119
- */
120
- audioMetadata: VoiceOutputMetadata;
121
- constructor(options?: VoiceOutputOptions);
122
- /**
123
- * Get the word count of the source text
124
- */
125
- get wordCount(): number;
126
- /**
127
- * Get the average words per second rate
128
- */
129
- get wordsPerSecond(): number;
130
- /**
131
- * Check if word timing data is available for lip-sync
132
- */
133
- get hasWordTimings(): boolean;
134
- /**
135
- * Get the word at a specific timestamp
136
- */
137
- getWordAtTime(seconds: number): WordTiming | null;
138
- /**
139
- * Build a persisted output model from a provider-neutral speech result.
140
- *
141
- * The binary audio remains in the caller-owned asset pipeline; this helper
142
- * only normalizes metadata and timing fields onto the SMRT model.
143
- */
144
- static fromSynthesizedSpeech(options: VoiceOutputFromSynthesizedSpeechOptions): VoiceOutput;
145
- }
146
-
147
- /**
148
- * Create a VoiceOutput from a runtime @happyvertical/speech synthesis result.
149
- */
150
- export declare interface VoiceOutputFromSynthesizedSpeechOptions extends VoiceOutputOptions {
151
- /**
152
- * Runtime synthesis result from @happyvertical/speech.
153
- */
154
- speech: SynthesizedSpeech;
155
- }
156
-
157
- /**
158
- * Voice output metadata
159
- */
160
- export declare interface VoiceOutputMetadata {
161
- /**
162
- * Sample rate in Hz
163
- */
164
- sampleRate?: number;
165
- /**
166
- * Audio format (e.g., 'wav', 'mp3', 'ogg')
167
- */
168
- format?: string;
169
- /**
170
- * MIME type returned by the speech provider
171
- */
172
- contentType?: string;
173
- /**
174
- * Number of audio channels
175
- */
176
- channels?: number;
177
- /**
178
- * Bit depth (e.g., 16, 24, 32)
179
- */
180
- bitDepth?: number;
181
- /**
182
- * File size in bytes
183
- */
184
- fileSize?: number;
185
- /**
186
- * TTS provider used
187
- */
188
- provider?: string;
189
- /**
190
- * Model used for synthesis
191
- */
192
- model?: string;
193
- /**
194
- * Speech speed used (1.0 = normal)
195
- */
196
- speed?: number;
197
- /**
198
- * Pitch adjustment used (semitones)
199
- */
200
- pitch?: number;
201
- }
202
-
203
- /**
204
- * Voice output creation options
205
- */
206
- export declare interface VoiceOutputOptions extends ContentOptions {
207
- /**
208
- * Voice profile used for synthesis
209
- */
210
- voiceProfileId?: string | null;
211
- /**
212
- * Original text that was synthesized
213
- */
214
- sourceText?: string;
215
- /**
216
- * Asset ID of the generated audio file
217
- */
218
- audioAssetId?: string | null;
219
- /**
220
- * Duration of the generated audio in seconds
221
- */
222
- duration?: number;
223
- /**
224
- * Word-level timing information for lip-sync
225
- */
226
- wordTimings?: WordTiming[] | null;
227
- /**
228
- * Audio metadata
229
- */
230
- audioMetadata?: VoiceOutputMetadata;
231
- }
232
-
233
- /**
234
- * Voice profile for AI-powered speech synthesis
235
- *
236
- * VoiceProfile represents a configured voice identity that can be used
237
- * for text-to-speech synthesis. Voices can be created through:
238
- * - Voice design: Natural language description of desired voice characteristics
239
- * - Voice cloning: 3+ second audio sample for voice replication
240
- *
241
- * @example
242
- * ```typescript
243
- * import { VoiceProfile } from '@happyvertical/smrt-voice';
244
- *
245
- * // Create a designed voice
246
- * const anchorVoice = new VoiceProfile({
247
- * name: 'News Anchor',
248
- * description: 'Professional news anchor voice with clear enunciation',
249
- * language: 'en-US',
250
- * gender: 'male',
251
- * designPrompt: 'Warm, authoritative male voice with slight gravitas, suitable for news broadcasts',
252
- * provider: 'qwen3-tts',
253
- * });
254
- *
255
- * // Create a cloned voice
256
- * const clonedVoice = new VoiceProfile({
257
- * name: 'Custom Voice',
258
- * description: 'Cloned from user sample',
259
- * language: 'en-US',
260
- * sampleAssetId: 'asset-123',
261
- * provider: 'qwen3-tts',
262
- * });
263
- * ```
264
- */
265
- export declare class VoiceProfile extends SmrtObject {
266
- /**
267
- * Tenant ID for multi-tenant isolation
268
- * Nullable to support global/default voices
269
- */
270
- tenantId: string | null;
271
- /**
272
- * Human-readable name for the voice profile
273
- */
274
- name: string;
275
- /**
276
- * Description of the voice characteristics
277
- */
278
- description: string | null;
279
- /**
280
- * ISO language code (e.g., 'en-US', 'zh-CN')
281
- */
282
- language: string;
283
- /**
284
- * Voice gender classification
285
- */
286
- gender: VoiceGender;
287
- /**
288
- * Natural language description for voice design
289
- * Used when creating a voice from scratch via AI
290
- */
291
- designPrompt: string | null;
292
- /**
293
- * Asset ID of the audio sample for voice cloning
294
- * Should be at least 3 seconds of clear speech
295
- */
296
- sampleAssetId: string | null;
297
- /**
298
- * Provider-specific voice data (ID, embedding, etc.)
299
- * Stored after voice creation/cloning is complete
300
- */
301
- voiceData: Record<string, unknown> | null;
302
- /**
303
- * Default speech speed multiplier (0.5 - 2.0)
304
- * 1.0 = normal speed
305
- */
306
- defaultSpeed: number;
307
- /**
308
- * Default pitch adjustment in semitones (-20 to 20)
309
- * 0 = no adjustment
310
- */
311
- defaultPitch: number;
312
- /**
313
- * Voice profile status
314
- * - pending: Profile created but voice not yet generated
315
- * - processing: Voice generation/cloning in progress
316
- * - ready: Voice is ready for use
317
- * - failed: Voice generation failed
318
- */
319
- status: VoiceProfileStatus;
320
- /**
321
- * TTS provider that created/manages this voice
322
- */
323
- provider: string;
324
- /**
325
- * Error message if status is 'failed'
326
- */
327
- errorMessage: string | null;
328
- constructor(options?: VoiceProfileOptions);
329
- /**
330
- * Check if this voice profile uses voice cloning
331
- */
332
- get isCloned(): boolean;
333
- /**
334
- * Check if this voice profile uses voice design
335
- */
336
- get isDesigned(): boolean;
337
- /**
338
- * Check if the voice is ready for use
339
- */
340
- get isReady(): boolean;
341
- /**
342
- * Check if this is a global (default) voice
343
- */
344
- get isGlobal(): boolean;
345
- /**
346
- * Convert this persisted profile into the runtime voice shape consumed by
347
- * @happyvertical/speech adapters.
348
- */
349
- toSpeechVoice(): SpeechVoice;
350
- }
351
-
352
- /**
353
- * Voice profile creation options
354
- */
355
- export declare interface VoiceProfileOptions extends SmrtObjectOptions {
356
- /**
357
- * Human-readable name for the voice profile
358
- */
359
- name?: string;
360
- /**
361
- * Description of the voice characteristics
362
- */
363
- description?: string | null;
364
- /**
365
- * ISO language code (e.g., 'en-US', 'zh-CN')
366
- */
367
- language?: string;
368
- /**
369
- * Voice gender classification
370
- * @default 'neutral'
371
- */
372
- gender?: VoiceGender;
373
- /**
374
- * Natural language description for voice design
375
- * Used when creating a voice from scratch
376
- */
377
- designPrompt?: string | null;
378
- /**
379
- * Asset ID of the audio sample for voice cloning
380
- * Should be at least 3 seconds of clear speech
381
- */
382
- sampleAssetId?: string | null;
383
- /**
384
- * Provider-specific voice data (ID, embedding, etc.)
385
- * Stored after voice creation/cloning
386
- */
387
- voiceData?: Record<string, unknown> | null;
388
- /**
389
- * Default speech speed multiplier
390
- * @default 1.0
391
- */
392
- defaultSpeed?: number;
393
- /**
394
- * Default pitch adjustment in semitones
395
- * @default 0
396
- */
397
- defaultPitch?: number;
398
- /**
399
- * Voice profile status
400
- * @default 'pending'
401
- */
402
- status?: VoiceProfileStatus;
403
- /**
404
- * TTS provider that created this voice
405
- * @default 'qwen3-tts'
406
- */
407
- provider?: string;
408
- /**
409
- * Error message if status is 'failed'
410
- */
411
- errorMessage?: string | null;
412
- /**
413
- * Tenant ID for multi-tenant isolation
414
- * Null for global/default voices
415
- */
416
- tenantId?: string | null;
417
- }
418
-
419
- /**
420
- * Voice profile status
421
- */
422
- export declare type VoiceProfileStatus = 'pending' | 'processing' | 'ready' | 'failed';
423
-
424
- /**
425
- * Audio sample for voice cloning
426
- *
427
- * VoiceSample represents an audio recording used as source material
428
- * for voice cloning. For best results, samples should be:
429
- * - At least 3 seconds long
430
- * - Clear speech without background noise
431
- * - Single speaker only
432
- * - High quality (44.1kHz or higher)
433
- *
434
- * Multiple samples can be associated with a single VoiceProfile
435
- * to improve voice cloning quality.
436
- *
437
- * @example
438
- * ```typescript
439
- * import { VoiceSample } from '@happyvertical/smrt-voice';
440
- *
441
- * const sample = new VoiceSample({
442
- * voiceProfileId: 'voice-123',
443
- * assetId: 'asset-456',
444
- * duration: 5.2,
445
- * transcription: 'Hello, this is a test recording for voice cloning.',
446
- * quality: 'high',
447
- * sampleRate: 48000,
448
- * channels: 1,
449
- * format: 'wav',
450
- * isPrimary: true,
451
- * });
452
- * ```
453
- */
454
- export declare class VoiceSample extends SmrtObject {
455
- /**
456
- * Tenant ID for multi-tenant isolation
457
- */
458
- tenantId: string | null;
459
- /**
460
- * Voice profile this sample belongs to
461
- */
462
- voiceProfileId: string | null;
463
- /**
464
- * Asset ID of the audio file
465
- * References an Asset in smrt-assets
466
- */
467
- assetId: string | null;
468
- /**
469
- * Sample duration in seconds
470
- */
471
- duration: number;
472
- /**
473
- * Transcription of what was said in the sample
474
- * Used for alignment and quality verification
475
- */
476
- transcription: string | null;
477
- /**
478
- * Quality rating based on audio analysis
479
- * - low: Noisy or short samples
480
- * - medium: Acceptable quality
481
- * - high: Clear audio, good length
482
- */
483
- quality: SampleQuality;
484
- /**
485
- * Sample rate in Hz
486
- */
487
- sampleRate: number | null;
488
- /**
489
- * Number of audio channels
490
- */
491
- channels: number | null;
492
- /**
493
- * Audio format
494
- */
495
- format: string | null;
496
- /**
497
- * Whether this is the primary sample for the voice profile
498
- */
499
- isPrimary: boolean;
500
- constructor(options?: VoiceSampleOptions);
501
- /**
502
- * Check if sample meets minimum duration requirement (3 seconds)
503
- */
504
- get meetsMinDuration(): boolean;
505
- /**
506
- * Check if sample is high quality and suitable for cloning
507
- */
508
- get isSuitableForCloning(): boolean;
509
- }
510
-
511
- /**
512
- * Voice sample creation options
513
- */
514
- export declare interface VoiceSampleOptions extends SmrtObjectOptions {
515
- /**
516
- * Voice profile this sample belongs to
517
- */
518
- voiceProfileId?: string | null;
519
- /**
520
- * Asset ID of the audio file
521
- */
522
- assetId?: string | null;
523
- /**
524
- * Sample duration in seconds
525
- */
526
- duration?: number;
527
- /**
528
- * Transcription of what was said in the sample
529
- */
530
- transcription?: string | null;
531
- /**
532
- * Quality rating based on audio analysis
533
- * @default 'medium'
534
- */
535
- quality?: SampleQuality;
536
- /**
537
- * Sample rate in Hz (e.g., 44100, 48000)
538
- */
539
- sampleRate?: number | null;
540
- /**
541
- * Number of audio channels (1 = mono, 2 = stereo)
542
- */
543
- channels?: number | null;
544
- /**
545
- * Audio format (e.g., 'wav', 'mp3', 'ogg')
546
- */
547
- format?: string | null;
548
- /**
549
- * Whether this is the primary sample for the voice profile
550
- * @default false
551
- */
552
- isPrimary?: boolean;
553
- /**
554
- * Tenant ID for multi-tenant isolation
555
- */
556
- tenantId?: string | null;
557
- }
558
-
559
- /**
560
- * Word timing information for lip-sync alignment
561
- */
562
- export declare interface WordTiming {
563
- /**
564
- * The word
565
- */
566
- word: string;
567
- /**
568
- * Start time in seconds
569
- */
570
- start: number;
571
- /**
572
- * End time in seconds
573
- */
574
- end: number;
575
- /**
576
- * Provider confidence score, when available
577
- */
578
- confidence?: number;
579
- /**
580
- * Speaker identifier, when diarization is available
581
- */
582
- speakerId?: string;
583
- }
584
-
585
- export declare function wordTimingsFromSpeech(words: readonly SpeechWordTiming[] | null | undefined): WordTiming[] | null;
586
-
587
- export { }
1
+ /**
2
+ * @happyvertical/smrt-voice
3
+ *
4
+ * Voice profile management for AI-powered voice synthesis and cloning.
5
+ *
6
+ * This package provides models for managing voice profiles, audio samples,
7
+ * and synthesized voice outputs in the SMRT ecosystem.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import {
12
+ * VoiceProfile,
13
+ * VoiceSample,
14
+ * VoiceOutput,
15
+ * } from '@happyvertical/smrt-voice';
16
+ *
17
+ * // Create a voice profile with voice design
18
+ * const profile = new VoiceProfile({
19
+ * name: 'News Anchor',
20
+ * language: 'en-US',
21
+ * gender: 'male',
22
+ * designPrompt: 'Warm, authoritative male voice with clear enunciation',
23
+ * });
24
+ * await profile.save();
25
+ *
26
+ * // Or create from a cloned voice sample
27
+ * const clonedProfile = new VoiceProfile({
28
+ * name: 'Custom Voice',
29
+ * language: 'en-US',
30
+ * sampleAssetId: 'asset-123',
31
+ * });
32
+ * await clonedProfile.save();
33
+ * ```
34
+ */
35
+ import './__smrt-register__.js';
36
+ export type { AudioInput, Speech, SpeechAdapterAvailability, SpeechSynthesizer, SpeechSynthesizerType, SpeechVoice, SpeechVoiceInput, SynthesisRequest, SynthesizedSpeech, Transcriber, TranscriberType, TranscriptionRequest, TranscriptResult, TranscriptSegment, WordTiming as SpeechWordTiming, } from '@happyvertical/speech';
37
+ export { metadataFromSynthesizedSpeech, VoiceOutput, type VoiceOutputFromSynthesizedSpeechOptions, type VoiceOutputMetadata, type VoiceOutputOptions, type WordTiming, wordTimingsFromSpeech, } from './voice-output.js';
38
+ export { type VoiceGender, VoiceProfile, type VoiceProfileOptions, type VoiceProfileStatus, } from './voice-profile.js';
39
+ export { type SampleQuality, VoiceSample, type VoiceSampleOptions, } from './voice-sample.js';
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,wBAAwB,CAAC;AAEhC,YAAY,EACV,UAAU,EACV,MAAM,EACN,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,IAAI,gBAAgB,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,EAC7B,WAAW,EACX,KAAK,uCAAuC,EAC5C,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC"}