@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,203 @@
1
+ /**
2
+ * Voice Profile Model
3
+ *
4
+ * Manages voice profiles for AI-powered voice synthesis and cloning.
5
+ * Supports voice design via natural language descriptions and voice
6
+ * cloning from audio samples.
7
+ */
8
+ import type { SmrtObjectOptions } from '@happyvertical/smrt-core';
9
+ import { SmrtObject } from '@happyvertical/smrt-core';
10
+ import type { SpeechVoice } from '@happyvertical/speech';
11
+ /**
12
+ * Voice profile status
13
+ */
14
+ export type VoiceProfileStatus = 'pending' | 'processing' | 'ready' | 'failed';
15
+ /**
16
+ * Voice gender classification
17
+ */
18
+ export type VoiceGender = 'male' | 'female' | 'neutral';
19
+ /**
20
+ * Voice profile creation options
21
+ */
22
+ export interface VoiceProfileOptions extends SmrtObjectOptions {
23
+ /**
24
+ * Human-readable name for the voice profile
25
+ */
26
+ name?: string;
27
+ /**
28
+ * Description of the voice characteristics
29
+ */
30
+ description?: string | null;
31
+ /**
32
+ * ISO language code (e.g., 'en-US', 'zh-CN')
33
+ */
34
+ language?: string;
35
+ /**
36
+ * Voice gender classification
37
+ * @default 'neutral'
38
+ */
39
+ gender?: VoiceGender;
40
+ /**
41
+ * Natural language description for voice design
42
+ * Used when creating a voice from scratch
43
+ */
44
+ designPrompt?: string | null;
45
+ /**
46
+ * Asset ID of the audio sample for voice cloning
47
+ * Should be at least 3 seconds of clear speech
48
+ */
49
+ sampleAssetId?: string | null;
50
+ /**
51
+ * Provider-specific voice data (ID, embedding, etc.)
52
+ * Stored after voice creation/cloning
53
+ */
54
+ voiceData?: Record<string, unknown> | null;
55
+ /**
56
+ * Default speech speed multiplier
57
+ * @default 1.0
58
+ */
59
+ defaultSpeed?: number;
60
+ /**
61
+ * Default pitch adjustment in semitones
62
+ * @default 0
63
+ */
64
+ defaultPitch?: number;
65
+ /**
66
+ * Voice profile status
67
+ * @default 'pending'
68
+ */
69
+ status?: VoiceProfileStatus;
70
+ /**
71
+ * TTS provider that created this voice
72
+ * @default 'qwen3-tts'
73
+ */
74
+ provider?: string;
75
+ /**
76
+ * Error message if status is 'failed'
77
+ */
78
+ errorMessage?: string | null;
79
+ /**
80
+ * Tenant ID for multi-tenant isolation
81
+ * Null for global/default voices
82
+ */
83
+ tenantId?: string | null;
84
+ }
85
+ /**
86
+ * Voice profile for AI-powered speech synthesis
87
+ *
88
+ * VoiceProfile represents a configured voice identity that can be used
89
+ * for text-to-speech synthesis. Voices can be created through:
90
+ * - Voice design: Natural language description of desired voice characteristics
91
+ * - Voice cloning: 3+ second audio sample for voice replication
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { VoiceProfile } from '@happyvertical/smrt-voice';
96
+ *
97
+ * // Create a designed voice
98
+ * const anchorVoice = new VoiceProfile({
99
+ * name: 'News Anchor',
100
+ * description: 'Professional news anchor voice with clear enunciation',
101
+ * language: 'en-US',
102
+ * gender: 'male',
103
+ * designPrompt: 'Warm, authoritative male voice with slight gravitas, suitable for news broadcasts',
104
+ * provider: 'qwen3-tts',
105
+ * });
106
+ *
107
+ * // Create a cloned voice
108
+ * const clonedVoice = new VoiceProfile({
109
+ * name: 'Custom Voice',
110
+ * description: 'Cloned from user sample',
111
+ * language: 'en-US',
112
+ * sampleAssetId: 'asset-123',
113
+ * provider: 'qwen3-tts',
114
+ * });
115
+ * ```
116
+ */
117
+ export declare class VoiceProfile extends SmrtObject {
118
+ /**
119
+ * Tenant ID for multi-tenant isolation
120
+ * Nullable to support global/default voices
121
+ */
122
+ tenantId: string | null;
123
+ /**
124
+ * Human-readable name for the voice profile
125
+ */
126
+ name: string;
127
+ /**
128
+ * Description of the voice characteristics
129
+ */
130
+ description: string | null;
131
+ /**
132
+ * ISO language code (e.g., 'en-US', 'zh-CN')
133
+ */
134
+ language: string;
135
+ /**
136
+ * Voice gender classification
137
+ */
138
+ gender: VoiceGender;
139
+ /**
140
+ * Natural language description for voice design
141
+ * Used when creating a voice from scratch via AI
142
+ */
143
+ designPrompt: string | null;
144
+ /**
145
+ * Asset ID of the audio sample for voice cloning
146
+ * Should be at least 3 seconds of clear speech
147
+ */
148
+ sampleAssetId: string | null;
149
+ /**
150
+ * Provider-specific voice data (ID, embedding, etc.)
151
+ * Stored after voice creation/cloning is complete
152
+ */
153
+ voiceData: Record<string, unknown> | null;
154
+ /**
155
+ * Default speech speed multiplier (0.5 - 2.0)
156
+ * 1.0 = normal speed
157
+ */
158
+ defaultSpeed: number;
159
+ /**
160
+ * Default pitch adjustment in semitones (-20 to 20)
161
+ * 0 = no adjustment
162
+ */
163
+ defaultPitch: number;
164
+ /**
165
+ * Voice profile status
166
+ * - pending: Profile created but voice not yet generated
167
+ * - processing: Voice generation/cloning in progress
168
+ * - ready: Voice is ready for use
169
+ * - failed: Voice generation failed
170
+ */
171
+ status: VoiceProfileStatus;
172
+ /**
173
+ * TTS provider that created/manages this voice
174
+ */
175
+ provider: string;
176
+ /**
177
+ * Error message if status is 'failed'
178
+ */
179
+ errorMessage: string | null;
180
+ constructor(options?: VoiceProfileOptions);
181
+ /**
182
+ * Check if this voice profile uses voice cloning
183
+ */
184
+ get isCloned(): boolean;
185
+ /**
186
+ * Check if this voice profile uses voice design
187
+ */
188
+ get isDesigned(): boolean;
189
+ /**
190
+ * Check if the voice is ready for use
191
+ */
192
+ get isReady(): boolean;
193
+ /**
194
+ * Check if this is a global (default) voice
195
+ */
196
+ get isGlobal(): boolean;
197
+ /**
198
+ * Convert this persisted profile into the runtime voice shape consumed by
199
+ * @happyvertical/speech adapters.
200
+ */
201
+ toSpeechVoice(): SpeechVoice;
202
+ }
203
+ //# sourceMappingURL=voice-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-profile.d.ts","sourceRoot":"","sources":["../src/voice-profile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM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,MAAM,GAAG,IAAI,CAAQ;IAE/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAM;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAElC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAW;IAE3B;;OAEG;IACH,MAAM,EAAE,WAAW,CAAa;IAEhC;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEnC;;;OAGG;IAEH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEpC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAQ;IAEjD;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAO;IAE3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAK;IAEzB;;;;;;OAMG;IACH,MAAM,EAAE,kBAAkB,CAAa;IAEvC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAe;IAE/B;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAEvB,OAAO,GAAE,mBAAwB;IAwB7C;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,aAAa,IAAI,WAAW;CA0B7B"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Voice Sample Model
3
+ *
4
+ * Manages audio samples used for voice cloning.
5
+ * Samples should be at least 3 seconds of clear speech.
6
+ */
7
+ import type { SmrtObjectOptions } from '@happyvertical/smrt-core';
8
+ import { SmrtObject } from '@happyvertical/smrt-core';
9
+ /**
10
+ * Audio sample quality rating
11
+ */
12
+ export type SampleQuality = 'low' | 'medium' | 'high';
13
+ /**
14
+ * Voice sample creation options
15
+ */
16
+ export interface VoiceSampleOptions extends SmrtObjectOptions {
17
+ /**
18
+ * Voice profile this sample belongs to
19
+ */
20
+ voiceProfileId?: string | null;
21
+ /**
22
+ * Asset ID of the audio file
23
+ */
24
+ assetId?: string | null;
25
+ /**
26
+ * Sample duration in seconds
27
+ */
28
+ duration?: number;
29
+ /**
30
+ * Transcription of what was said in the sample
31
+ */
32
+ transcription?: string | null;
33
+ /**
34
+ * Quality rating based on audio analysis
35
+ * @default 'medium'
36
+ */
37
+ quality?: SampleQuality;
38
+ /**
39
+ * Sample rate in Hz (e.g., 44100, 48000)
40
+ */
41
+ sampleRate?: number | null;
42
+ /**
43
+ * Number of audio channels (1 = mono, 2 = stereo)
44
+ */
45
+ channels?: number | null;
46
+ /**
47
+ * Audio format (e.g., 'wav', 'mp3', 'ogg')
48
+ */
49
+ format?: string | null;
50
+ /**
51
+ * Whether this is the primary sample for the voice profile
52
+ * @default false
53
+ */
54
+ isPrimary?: boolean;
55
+ /**
56
+ * Tenant ID for multi-tenant isolation
57
+ */
58
+ tenantId?: string | null;
59
+ }
60
+ /**
61
+ * Audio sample for voice cloning
62
+ *
63
+ * VoiceSample represents an audio recording used as source material
64
+ * for voice cloning. For best results, samples should be:
65
+ * - At least 3 seconds long
66
+ * - Clear speech without background noise
67
+ * - Single speaker only
68
+ * - High quality (44.1kHz or higher)
69
+ *
70
+ * Multiple samples can be associated with a single VoiceProfile
71
+ * to improve voice cloning quality.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * import { VoiceSample } from '@happyvertical/smrt-voice';
76
+ *
77
+ * const sample = new VoiceSample({
78
+ * voiceProfileId: 'voice-123',
79
+ * assetId: 'asset-456',
80
+ * duration: 5.2,
81
+ * transcription: 'Hello, this is a test recording for voice cloning.',
82
+ * quality: 'high',
83
+ * sampleRate: 48000,
84
+ * channels: 1,
85
+ * format: 'wav',
86
+ * isPrimary: true,
87
+ * });
88
+ * ```
89
+ */
90
+ export declare class VoiceSample extends SmrtObject {
91
+ /**
92
+ * Tenant ID for multi-tenant isolation
93
+ */
94
+ tenantId: string | null;
95
+ /**
96
+ * Voice profile this sample belongs to
97
+ */
98
+ voiceProfileId: string | null;
99
+ /**
100
+ * Asset ID of the audio file
101
+ * References an Asset in smrt-assets
102
+ */
103
+ assetId: string | null;
104
+ /**
105
+ * Sample duration in seconds
106
+ */
107
+ duration: number;
108
+ /**
109
+ * Transcription of what was said in the sample
110
+ * Used for alignment and quality verification
111
+ */
112
+ transcription: string | null;
113
+ /**
114
+ * Quality rating based on audio analysis
115
+ * - low: Noisy or short samples
116
+ * - medium: Acceptable quality
117
+ * - high: Clear audio, good length
118
+ */
119
+ quality: SampleQuality;
120
+ /**
121
+ * Sample rate in Hz
122
+ */
123
+ sampleRate: number | null;
124
+ /**
125
+ * Number of audio channels
126
+ */
127
+ channels: number | null;
128
+ /**
129
+ * Audio format
130
+ */
131
+ format: string | null;
132
+ /**
133
+ * Whether this is the primary sample for the voice profile
134
+ */
135
+ isPrimary: boolean;
136
+ constructor(options?: VoiceSampleOptions);
137
+ /**
138
+ * Check if sample meets minimum duration requirement (3 seconds)
139
+ */
140
+ get meetsMinDuration(): boolean;
141
+ /**
142
+ * Check if sample is high quality and suitable for cloning
143
+ */
144
+ get isSuitableForCloning(): boolean;
145
+ }
146
+ //# sourceMappingURL=voice-sample.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-sample.d.ts","sourceRoot":"","sources":["../src/voice-sample.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAIlC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/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AAI,oBAAoB,IAAI,OAAO,CAElC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-voice",
3
- "version": "0.51.32",
3
+ "version": "0.51.33",
4
4
  "type": "module",
5
5
  "description": "Voice profile management for AI-powered voice synthesis and cloning in the SMRT ecosystem",
6
6
  "author": "HappyVertical",
@@ -29,20 +29,20 @@
29
29
  "AGENTS.md"
30
30
  ],
31
31
  "dependencies": {
32
- "@happyvertical/smrt-assets": "0.51.32",
33
- "@happyvertical/smrt-config": "0.51.32",
34
- "@happyvertical/smrt-content": "0.51.32",
35
- "@happyvertical/smrt-core": "0.51.32",
36
- "@happyvertical/smrt-tenancy": "0.51.32",
32
+ "@happyvertical/smrt-assets": "0.51.33",
33
+ "@happyvertical/smrt-config": "0.51.33",
34
+ "@happyvertical/smrt-content": "0.51.33",
35
+ "@happyvertical/smrt-core": "0.51.33",
36
+ "@happyvertical/smrt-tenancy": "0.51.33",
37
37
  "@happyvertical/speech": "^0.94.1",
38
38
  "@happyvertical/utils": "^0.94.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@happyvertical/logger": "^0.94.1",
42
- "@happyvertical/smrt-vitest": "0.51.32",
42
+ "@happyvertical/smrt-vitest": "0.51.33",
43
43
  "@happyvertical/sql": "^0.94.1",
44
44
  "@types/node": "24.13.6",
45
- "typescript": "5.9.3",
45
+ "typescript": "6.0.3",
46
46
  "vite": "8.1.4",
47
47
  "vitest": "4.1.10"
48
48
  },