@cartesia/cartesia-js 1.0.2 → 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/.turbo/turbo-build.log +41 -41
- package/CHANGELOG.md +12 -0
- package/README.md +43 -9
- package/dist/{chunk-NQVZNVOU.js → chunk-3FL2SNIR.js} +1 -1
- package/dist/{chunk-NVOCUUOF.js → chunk-4GEDAGVY.js} +3 -3
- package/dist/{chunk-PISCPZK4.js → chunk-6PWLZAMS.js} +1 -1
- package/dist/{chunk-UCYL2SOX.js → chunk-CWIJUBG6.js} +20 -2
- package/dist/{chunk-IZBPLCGW.js → chunk-L3OMQKWL.js} +35 -10
- package/dist/{chunk-LZO6K34D.js → chunk-MNOPO7G6.js} +2 -2
- package/dist/{chunk-EDAAHENY.js → chunk-MUPVAEL7.js} +2 -2
- package/dist/{chunk-BHY7MNGT.js → chunk-VCZESWYA.js} +1 -1
- package/dist/{chunk-6YQ6KDIQ.js → chunk-VVDJR3OA.js} +32 -1
- package/dist/{chunk-GHY2WEOK.js → chunk-WIFMLPT5.js} +0 -13
- package/dist/index.cjs +80 -17
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/lib/client.js +2 -2
- package/dist/lib/constants.js +1 -1
- package/dist/lib/index.cjs +80 -17
- package/dist/lib/index.js +8 -8
- package/dist/react/index.cjs +83 -17
- package/dist/react/index.js +13 -10
- package/dist/react/utils.js +2 -2
- package/dist/tts/index.cjs +62 -17
- package/dist/tts/index.js +6 -6
- package/dist/tts/player.js +4 -4
- package/dist/tts/source.cjs +31 -0
- package/dist/tts/source.d.cts +9 -0
- package/dist/tts/source.d.ts +9 -0
- package/dist/tts/source.js +2 -2
- package/dist/tts/utils.js +3 -3
- package/dist/tts/websocket.cjs +62 -17
- package/dist/tts/websocket.d.cts +9 -3
- package/dist/tts/websocket.d.ts +9 -3
- package/dist/tts/websocket.js +5 -5
- package/dist/types/index.d.cts +32 -6
- package/dist/types/index.d.ts +32 -6
- package/dist/voices/index.cjs +18 -0
- package/dist/voices/index.d.cts +3 -1
- package/dist/voices/index.d.ts +3 -1
- package/dist/voices/index.js +3 -3
- package/package.json +1 -1
- package/src/react/index.ts +4 -0
- package/src/tts/source.ts +35 -0
- package/src/tts/websocket.ts +35 -2
- package/src/types/index.ts +46 -5
- package/src/voices/index.ts +22 -0
package/src/types/index.ts
CHANGED
|
@@ -16,11 +16,11 @@ export type ConnectionEventData = {
|
|
|
16
16
|
|
|
17
17
|
export type VoiceSpecifier =
|
|
18
18
|
| {
|
|
19
|
-
mode
|
|
19
|
+
mode?: "id";
|
|
20
20
|
id: string;
|
|
21
21
|
}
|
|
22
22
|
| {
|
|
23
|
-
mode
|
|
23
|
+
mode?: "embedding";
|
|
24
24
|
embedding: number[];
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -35,7 +35,7 @@ export type EmotionControl = Emotion | `${Emotion}:${Intensity}`;
|
|
|
35
35
|
|
|
36
36
|
export type VoiceOptions = VoiceSpecifier & {
|
|
37
37
|
__experimental_controls?: {
|
|
38
|
-
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest";
|
|
38
|
+
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest" | number;
|
|
39
39
|
emotion?: EmotionControl[];
|
|
40
40
|
};
|
|
41
41
|
};
|
|
@@ -52,10 +52,24 @@ export type StreamRequest = {
|
|
|
52
52
|
context_id?: string;
|
|
53
53
|
continue?: boolean;
|
|
54
54
|
duration?: number;
|
|
55
|
-
language?:
|
|
55
|
+
language?: Language;
|
|
56
56
|
add_timestamps?: boolean;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
export type ContinueRequest = StreamRequest & {
|
|
60
|
+
context_id: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type Language =
|
|
64
|
+
| "en"
|
|
65
|
+
| "es"
|
|
66
|
+
| "fr"
|
|
67
|
+
| "de"
|
|
68
|
+
| "ja"
|
|
69
|
+
| "zh"
|
|
70
|
+
| "pt"
|
|
71
|
+
| (string & {});
|
|
72
|
+
|
|
59
73
|
export type StreamOptions = {
|
|
60
74
|
timeout?: number;
|
|
61
75
|
};
|
|
@@ -112,6 +126,25 @@ export type CloneOptions =
|
|
|
112
126
|
enhance?: boolean;
|
|
113
127
|
};
|
|
114
128
|
|
|
129
|
+
export type LocalizeOptions = {
|
|
130
|
+
mode: "embedding";
|
|
131
|
+
embedding: number[];
|
|
132
|
+
} & {
|
|
133
|
+
language: Language;
|
|
134
|
+
dialect: string & {};
|
|
135
|
+
original_speaker_gender: "male" | "female" | (string & {});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export interface VoiceToMix {
|
|
139
|
+
id?: string;
|
|
140
|
+
embedding?: number[];
|
|
141
|
+
weight: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface MixVoicesOptions {
|
|
145
|
+
voices: VoiceToMix[];
|
|
146
|
+
}
|
|
147
|
+
|
|
115
148
|
export type Voice = {
|
|
116
149
|
id: string;
|
|
117
150
|
name: string;
|
|
@@ -120,7 +153,7 @@ export type Voice = {
|
|
|
120
153
|
is_public: boolean;
|
|
121
154
|
user_id: string;
|
|
122
155
|
created_at: string;
|
|
123
|
-
language:
|
|
156
|
+
language: Language;
|
|
124
157
|
};
|
|
125
158
|
|
|
126
159
|
export type CreateVoice = Pick<Voice, "name" | "description" | "embedding"> &
|
|
@@ -134,6 +167,14 @@ export type CloneResponse = {
|
|
|
134
167
|
embedding: number[];
|
|
135
168
|
};
|
|
136
169
|
|
|
170
|
+
export type LocalizeResponse = {
|
|
171
|
+
embedding: number[];
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export type MixVoicesResponse = {
|
|
175
|
+
embedding: number[];
|
|
176
|
+
};
|
|
177
|
+
|
|
137
178
|
export type WebSocketOptions = {
|
|
138
179
|
container?: string;
|
|
139
180
|
encoding?: string;
|
package/src/voices/index.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type {
|
|
|
3
3
|
CloneOptions,
|
|
4
4
|
CloneResponse,
|
|
5
5
|
CreateVoice,
|
|
6
|
+
LocalizeOptions,
|
|
7
|
+
LocalizeResponse,
|
|
8
|
+
MixVoicesOptions,
|
|
9
|
+
MixVoicesResponse,
|
|
6
10
|
UpdateVoice,
|
|
7
11
|
Voice,
|
|
8
12
|
} from "../types";
|
|
@@ -51,4 +55,22 @@ export default class Voices extends Client {
|
|
|
51
55
|
|
|
52
56
|
throw new Error("Invalid mode for clone()");
|
|
53
57
|
}
|
|
58
|
+
|
|
59
|
+
async mix(options: MixVoicesOptions): Promise<MixVoicesResponse> {
|
|
60
|
+
const response = await this._fetch("/voices/mix", {
|
|
61
|
+
method: "POST",
|
|
62
|
+
body: JSON.stringify(options),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return response.json() as Promise<MixVoicesResponse>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async localize(options: LocalizeOptions): Promise<LocalizeResponse> {
|
|
69
|
+
const response = await this._fetch("/voices/localize", {
|
|
70
|
+
method: "POST",
|
|
71
|
+
body: JSON.stringify(options),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return response.json() as Promise<LocalizeResponse>;
|
|
75
|
+
}
|
|
54
76
|
}
|