@cartesia/cartesia-js 1.0.2 → 1.0.3
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 +31 -31
- package/CHANGELOG.md +6 -0
- package/README.md +11 -6
- package/dist/{chunk-IZBPLCGW.js → chunk-EUW2435M.js} +1 -0
- package/dist/{chunk-EDAAHENY.js → chunk-NWCW6C7H.js} +1 -1
- package/dist/{chunk-UCYL2SOX.js → chunk-YFN6TFR4.js} +10 -0
- package/dist/{chunk-NVOCUUOF.js → chunk-ZF6HASZT.js} +2 -2
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/lib/index.cjs +11 -0
- package/dist/lib/index.js +4 -4
- package/dist/react/index.cjs +11 -0
- package/dist/react/index.js +4 -4
- package/dist/tts/index.cjs +1 -0
- package/dist/tts/index.js +2 -2
- package/dist/tts/websocket.cjs +1 -0
- package/dist/tts/websocket.js +1 -1
- package/dist/types/index.d.cts +15 -4
- package/dist/types/index.d.ts +15 -4
- package/dist/voices/index.cjs +10 -0
- package/dist/voices/index.d.cts +2 -1
- package/dist/voices/index.d.ts +2 -1
- package/dist/voices/index.js +1 -1
- package/package.json +1 -1
- package/src/tts/websocket.ts +2 -0
- package/src/types/index.ts +17 -3
- package/src/voices/index.ts +13 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -5,32 +5,19 @@ $ tsup src/ --format cjs,esm --dts
|
|
|
5
5
|
[34mCLI[39m Target: es6
|
|
6
6
|
[34mCJS[39m Build start
|
|
7
7
|
[34mESM[39m Build start
|
|
8
|
-
[32mCJS[39m [1mdist/types/index.cjs [22m[32m764.00 B[39m
|
|
9
|
-
[32mCJS[39m [1mdist/voices/index.cjs [22m[32m5.36 KB[39m
|
|
10
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m24.67 KB[39m
|
|
11
|
-
[32mCJS[39m [1mdist/lib/client.cjs [22m[32m4.07 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/lib/constants.cjs [22m[32m1.43 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/lib/index.cjs [22m[32m20.57 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/react/index.cjs [22m[32m32.23 KB[39m
|
|
15
|
-
[32mCJS[39m [1mdist/react/utils.cjs [22m[32m1.80 KB[39m
|
|
16
|
-
[32mCJS[39m [1mdist/tts/index.cjs [22m[32m18.92 KB[39m
|
|
17
|
-
[32mCJS[39m [1mdist/tts/player.cjs [22m[32m6.96 KB[39m
|
|
18
|
-
[32mCJS[39m [1mdist/tts/source.cjs [22m[32m8.15 KB[39m
|
|
19
|
-
[32mCJS[39m [1mdist/tts/utils.cjs [22m[32m4.33 KB[39m
|
|
20
|
-
[32mCJS[39m [1mdist/tts/websocket.cjs [22m[32m18.61 KB[39m
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in 75ms
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[32m499.00 B[39m
|
|
23
|
-
[32mESM[39m [1mdist/lib/constants.js [22m[32m183.00 B[39m
|
|
24
8
|
[32mESM[39m [1mdist/chunk-FXPGR372.js [22m[32m0 B[39m
|
|
9
|
+
[32mESM[39m [1mdist/index.js [22m[32m499.00 B[39m
|
|
10
|
+
[32mESM[39m [1mdist/lib/client.js [22m[32m132.00 B[39m
|
|
25
11
|
[32mESM[39m [1mdist/react/index.js [22m[32m7.62 KB[39m
|
|
26
12
|
[32mESM[39m [1mdist/tts/index.js [22m[32m261.00 B[39m
|
|
13
|
+
[32mESM[39m [1mdist/lib/constants.js [22m[32m183.00 B[39m
|
|
27
14
|
[32mESM[39m [1mdist/lib/index.js [22m[32m322.00 B[39m
|
|
28
|
-
[32mESM[39m [1mdist/chunk-
|
|
29
|
-
[32mESM[39m [1mdist/chunk-
|
|
15
|
+
[32mESM[39m [1mdist/chunk-ZF6HASZT.js [22m[32m353.00 B[39m
|
|
16
|
+
[32mESM[39m [1mdist/chunk-YFN6TFR4.js [22m[32m1.74 KB[39m
|
|
30
17
|
[32mESM[39m [1mdist/react/utils.js [22m[32m109.00 B[39m
|
|
31
18
|
[32mESM[39m [1mdist/chunk-NQVZNVOU.js [22m[32m337.00 B[39m
|
|
32
|
-
[32mESM[39m [1mdist/chunk-
|
|
33
|
-
[32mESM[39m [1mdist/chunk-
|
|
19
|
+
[32mESM[39m [1mdist/chunk-NWCW6C7H.js [22m[32m439.00 B[39m
|
|
20
|
+
[32mESM[39m [1mdist/chunk-EUW2435M.js [22m[32m7.17 KB[39m
|
|
34
21
|
[32mESM[39m [1mdist/chunk-PISCPZK4.js [22m[32m1.02 KB[39m
|
|
35
22
|
[32mESM[39m [1mdist/chunk-2BFEKY3F.js [22m[32m366.00 B[39m
|
|
36
23
|
[32mESM[39m [1mdist/tts/player.js [22m[32m174.00 B[39m
|
|
@@ -38,16 +25,29 @@ $ tsup src/ --format cjs,esm --dts
|
|
|
38
25
|
[32mESM[39m [1mdist/chunk-BHY7MNGT.js [22m[32m2.11 KB[39m
|
|
39
26
|
[32mESM[39m [1mdist/chunk-6YQ6KDIQ.js [22m[32m5.32 KB[39m
|
|
40
27
|
[32mESM[39m [1mdist/chunk-GHY2WEOK.js [22m[32m2.70 KB[39m
|
|
28
|
+
[32mESM[39m [1mdist/voices/index.js [22m[32m174.00 B[39m
|
|
29
|
+
[32mESM[39m [1mdist/types/index.js [22m[32m31.00 B[39m
|
|
41
30
|
[32mESM[39m [1mdist/tts/source.js [22m[32m144.00 B[39m
|
|
42
31
|
[32mESM[39m [1mdist/tts/utils.js [22m[32m426.00 B[39m
|
|
43
32
|
[32mESM[39m [1mdist/tts/websocket.js [22m[32m242.00 B[39m
|
|
44
|
-
[32mESM[39m
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
33
|
+
[32mESM[39m ⚡️ Build success in 72ms
|
|
34
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m24.98 KB[39m
|
|
35
|
+
[32mCJS[39m [1mdist/lib/client.cjs [22m[32m4.07 KB[39m
|
|
36
|
+
[32mCJS[39m [1mdist/lib/constants.cjs [22m[32m1.43 KB[39m
|
|
37
|
+
[32mCJS[39m [1mdist/lib/index.cjs [22m[32m20.87 KB[39m
|
|
38
|
+
[32mCJS[39m [1mdist/react/index.cjs [22m[32m32.54 KB[39m
|
|
39
|
+
[32mCJS[39m [1mdist/react/utils.cjs [22m[32m1.80 KB[39m
|
|
40
|
+
[32mCJS[39m [1mdist/tts/index.cjs [22m[32m18.96 KB[39m
|
|
41
|
+
[32mCJS[39m [1mdist/tts/player.cjs [22m[32m6.96 KB[39m
|
|
42
|
+
[32mCJS[39m [1mdist/tts/utils.cjs [22m[32m4.33 KB[39m
|
|
43
|
+
[32mCJS[39m [1mdist/tts/source.cjs [22m[32m8.15 KB[39m
|
|
44
|
+
[32mCJS[39m [1mdist/types/index.cjs [22m[32m764.00 B[39m
|
|
45
|
+
[32mCJS[39m [1mdist/tts/websocket.cjs [22m[32m18.65 KB[39m
|
|
46
|
+
[32mCJS[39m [1mdist/voices/index.cjs [22m[32m5.62 KB[39m
|
|
47
|
+
[32mCJS[39m ⚡️ Build success in 73ms
|
|
48
48
|
[34mDTS[39m Build start
|
|
49
|
-
[32mDTS[39m ⚡️ Build success in
|
|
50
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
49
|
+
[32mDTS[39m ⚡️ Build success in 8468ms
|
|
50
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m866.00 B[39m
|
|
51
51
|
[32mDTS[39m [1mdist/lib/constants.d.cts [22m[32m564.00 B[39m
|
|
52
52
|
[32mDTS[39m [1mdist/lib/index.d.cts [22m[32m410.00 B[39m
|
|
53
53
|
[32mDTS[39m [1mdist/react/index.d.cts [22m[32m1.09 KB[39m
|
|
@@ -57,10 +57,10 @@ $ tsup src/ --format cjs,esm --dts
|
|
|
57
57
|
[32mDTS[39m [1mdist/tts/utils.d.cts [22m[32m2.68 KB[39m
|
|
58
58
|
[32mDTS[39m [1mdist/tts/websocket.d.cts [22m[32m2.94 KB[39m
|
|
59
59
|
[32mDTS[39m [1mdist/tts/source.d.cts [22m[32m2.55 KB[39m
|
|
60
|
-
[32mDTS[39m [1mdist/voices/index.d.cts [22m[
|
|
60
|
+
[32mDTS[39m [1mdist/voices/index.d.cts [22m[32m573.00 B[39m
|
|
61
61
|
[32mDTS[39m [1mdist/lib/client.d.cts [22m[32m293.00 B[39m
|
|
62
|
-
[32mDTS[39m [1mdist/types/index.d.cts [22m[32m3.
|
|
63
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
62
|
+
[32mDTS[39m [1mdist/types/index.d.cts [22m[32m3.50 KB[39m
|
|
63
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m858.00 B[39m
|
|
64
64
|
[32mDTS[39m [1mdist/lib/constants.d.ts [22m[32m564.00 B[39m
|
|
65
65
|
[32mDTS[39m [1mdist/lib/index.d.ts [22m[32m404.00 B[39m
|
|
66
66
|
[32mDTS[39m [1mdist/react/index.d.ts [22m[32m1.09 KB[39m
|
|
@@ -70,6 +70,6 @@ $ tsup src/ --format cjs,esm --dts
|
|
|
70
70
|
[32mDTS[39m [1mdist/tts/utils.d.ts [22m[32m2.68 KB[39m
|
|
71
71
|
[32mDTS[39m [1mdist/tts/websocket.d.ts [22m[32m2.94 KB[39m
|
|
72
72
|
[32mDTS[39m [1mdist/tts/source.d.ts [22m[32m2.55 KB[39m
|
|
73
|
-
[32mDTS[39m [1mdist/voices/index.d.ts [22m[
|
|
73
|
+
[32mDTS[39m [1mdist/voices/index.d.ts [22m[32m571.00 B[39m
|
|
74
74
|
[32mDTS[39m [1mdist/lib/client.d.ts [22m[32m292.00 B[39m
|
|
75
|
-
[32mDTS[39m [1mdist/types/index.d.ts [22m[32m3.
|
|
75
|
+
[32mDTS[39m [1mdist/types/index.d.ts [22m[32m3.50 KB[39m
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -52,6 +52,17 @@ console.log(voices);
|
|
|
52
52
|
const voice = await cartesia.voices.get("<voice-id>");
|
|
53
53
|
console.log(voice);
|
|
54
54
|
|
|
55
|
+
// Clone a voice from a file.
|
|
56
|
+
const clonedVoiceEmbedding = await cartesia.voices.clone({
|
|
57
|
+
mode: "clip",
|
|
58
|
+
clip: myFile, // Pass a File object or a Blob.
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Mix voices together.
|
|
62
|
+
const mixedVoiceEmbedding = await cartesia.voices.mix({
|
|
63
|
+
voices: [{ id: "<voice-id-1>", weight: 0.6 }, { id: "<voice-id-2>", weight: 0.4 }],
|
|
64
|
+
});
|
|
65
|
+
|
|
55
66
|
// Create a voice.
|
|
56
67
|
const newVoice = await cartesia.voices.create({
|
|
57
68
|
name: "Tim",
|
|
@@ -59,12 +70,6 @@ const newVoice = await cartesia.voices.create({
|
|
|
59
70
|
embedding: Array(192).fill(1.0),
|
|
60
71
|
});
|
|
61
72
|
console.log(newVoice);
|
|
62
|
-
|
|
63
|
-
// Clone a voice from a file.
|
|
64
|
-
const clonedVoice = await cartesia.voices.clone({
|
|
65
|
-
mode: "clip",
|
|
66
|
-
clip: myFile, // Pass a File object or a Blob.
|
|
67
|
-
});
|
|
68
73
|
```
|
|
69
74
|
|
|
70
75
|
### TTS over WebSocket
|
|
@@ -169,6 +169,7 @@ var WebSocket = class extends Client {
|
|
|
169
169
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
170
170
|
return url.toString();
|
|
171
171
|
}));
|
|
172
|
+
this.socket.binaryType = "arraybuffer";
|
|
172
173
|
this.socket.onopen = () => {
|
|
173
174
|
__privateSet(this, _isConnected, true);
|
|
174
175
|
emitter.emit("open");
|
|
@@ -54,6 +54,16 @@ var Voices = class extends Client {
|
|
|
54
54
|
throw new Error("Invalid mode for clone()");
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
mix(options) {
|
|
58
|
+
return __async(this, null, function* () {
|
|
59
|
+
const request = options;
|
|
60
|
+
const response = yield this._fetch("/voices/mix", {
|
|
61
|
+
method: "POST",
|
|
62
|
+
body: JSON.stringify(request)
|
|
63
|
+
});
|
|
64
|
+
return response.json();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
export {
|
package/dist/index.cjs
CHANGED
|
@@ -510,6 +510,7 @@ var WebSocket = class extends Client {
|
|
|
510
510
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
511
511
|
return url.toString();
|
|
512
512
|
}));
|
|
513
|
+
this.socket.binaryType = "arraybuffer";
|
|
513
514
|
this.socket.onopen = () => {
|
|
514
515
|
__privateSet(this, _isConnected, true);
|
|
515
516
|
emitter.emit("open");
|
|
@@ -639,6 +640,16 @@ var Voices = class extends Client {
|
|
|
639
640
|
throw new Error("Invalid mode for clone()");
|
|
640
641
|
});
|
|
641
642
|
}
|
|
643
|
+
mix(options) {
|
|
644
|
+
return __async(this, null, function* () {
|
|
645
|
+
const request = options;
|
|
646
|
+
const response = yield this._fetch("/voices/mix", {
|
|
647
|
+
method: "POST",
|
|
648
|
+
body: JSON.stringify(request)
|
|
649
|
+
});
|
|
650
|
+
return response.json();
|
|
651
|
+
});
|
|
652
|
+
}
|
|
642
653
|
};
|
|
643
654
|
|
|
644
655
|
// src/lib/index.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Cartesia, Cartesia as default } from './lib/index.cjs';
|
|
2
|
-
export { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.cjs';
|
|
2
|
+
export { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.cjs';
|
|
3
3
|
export { default as WebPlayer } from './tts/player.cjs';
|
|
4
4
|
export { default as Source } from './tts/source.cjs';
|
|
5
5
|
export { default as WebSocket } from './tts/websocket.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Cartesia, Cartesia as default } from './lib/index.js';
|
|
2
|
-
export { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js';
|
|
2
|
+
export { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js';
|
|
3
3
|
export { default as WebPlayer } from './tts/player.js';
|
|
4
4
|
export { default as Source } from './tts/source.js';
|
|
5
5
|
export { default as WebSocket } from './tts/websocket.js';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./chunk-FXPGR372.js";
|
|
2
2
|
import {
|
|
3
3
|
Cartesia
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ZF6HASZT.js";
|
|
5
|
+
import "./chunk-YFN6TFR4.js";
|
|
6
|
+
import "./chunk-NWCW6C7H.js";
|
|
7
7
|
import {
|
|
8
8
|
WebSocket
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EUW2435M.js";
|
|
10
10
|
import "./chunk-PISCPZK4.js";
|
|
11
11
|
import "./chunk-2BFEKY3F.js";
|
|
12
12
|
import {
|
package/dist/lib/index.cjs
CHANGED
|
@@ -493,6 +493,7 @@ var WebSocket = class extends Client {
|
|
|
493
493
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
494
494
|
return url.toString();
|
|
495
495
|
}));
|
|
496
|
+
this.socket.binaryType = "arraybuffer";
|
|
496
497
|
this.socket.onopen = () => {
|
|
497
498
|
__privateSet(this, _isConnected, true);
|
|
498
499
|
emitter.emit("open");
|
|
@@ -622,6 +623,16 @@ var Voices = class extends Client {
|
|
|
622
623
|
throw new Error("Invalid mode for clone()");
|
|
623
624
|
});
|
|
624
625
|
}
|
|
626
|
+
mix(options) {
|
|
627
|
+
return __async(this, null, function* () {
|
|
628
|
+
const request = options;
|
|
629
|
+
const response = yield this._fetch("/voices/mix", {
|
|
630
|
+
method: "POST",
|
|
631
|
+
body: JSON.stringify(request)
|
|
632
|
+
});
|
|
633
|
+
return response.json();
|
|
634
|
+
});
|
|
635
|
+
}
|
|
625
636
|
};
|
|
626
637
|
|
|
627
638
|
// src/lib/index.ts
|
package/dist/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Cartesia
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-ZF6HASZT.js";
|
|
4
|
+
import "../chunk-YFN6TFR4.js";
|
|
5
|
+
import "../chunk-NWCW6C7H.js";
|
|
6
|
+
import "../chunk-EUW2435M.js";
|
|
7
7
|
import "../chunk-PISCPZK4.js";
|
|
8
8
|
import "../chunk-2BFEKY3F.js";
|
|
9
9
|
import "../chunk-BHY7MNGT.js";
|
package/dist/react/index.cjs
CHANGED
|
@@ -507,6 +507,7 @@ var WebSocket = class extends Client {
|
|
|
507
507
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
508
508
|
return url.toString();
|
|
509
509
|
}));
|
|
510
|
+
this.socket.binaryType = "arraybuffer";
|
|
510
511
|
this.socket.onopen = () => {
|
|
511
512
|
__privateSet(this, _isConnected, true);
|
|
512
513
|
emitter.emit("open");
|
|
@@ -636,6 +637,16 @@ var Voices = class extends Client {
|
|
|
636
637
|
throw new Error("Invalid mode for clone()");
|
|
637
638
|
});
|
|
638
639
|
}
|
|
640
|
+
mix(options) {
|
|
641
|
+
return __async(this, null, function* () {
|
|
642
|
+
const request = options;
|
|
643
|
+
const response = yield this._fetch("/voices/mix", {
|
|
644
|
+
method: "POST",
|
|
645
|
+
body: JSON.stringify(request)
|
|
646
|
+
});
|
|
647
|
+
return response.json();
|
|
648
|
+
});
|
|
649
|
+
}
|
|
639
650
|
};
|
|
640
651
|
|
|
641
652
|
// src/lib/index.ts
|
package/dist/react/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Cartesia
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-ZF6HASZT.js";
|
|
4
|
+
import "../chunk-YFN6TFR4.js";
|
|
5
5
|
import {
|
|
6
6
|
pingServer
|
|
7
7
|
} from "../chunk-NQVZNVOU.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-NWCW6C7H.js";
|
|
9
|
+
import "../chunk-EUW2435M.js";
|
|
10
10
|
import "../chunk-PISCPZK4.js";
|
|
11
11
|
import "../chunk-2BFEKY3F.js";
|
|
12
12
|
import {
|
package/dist/tts/index.cjs
CHANGED
|
@@ -493,6 +493,7 @@ var WebSocket = class extends Client {
|
|
|
493
493
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
494
494
|
return url.toString();
|
|
495
495
|
}));
|
|
496
|
+
this.socket.binaryType = "arraybuffer";
|
|
496
497
|
this.socket.onopen = () => {
|
|
497
498
|
__privateSet(this, _isConnected, true);
|
|
498
499
|
emitter.emit("open");
|
package/dist/tts/index.js
CHANGED
package/dist/tts/websocket.cjs
CHANGED
|
@@ -491,6 +491,7 @@ var WebSocket = class extends Client {
|
|
|
491
491
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
492
492
|
return url.toString();
|
|
493
493
|
}));
|
|
494
|
+
this.socket.binaryType = "arraybuffer";
|
|
494
495
|
this.socket.onopen = () => {
|
|
495
496
|
__privateSet(this, _isConnected, true);
|
|
496
497
|
emitter.emit("open");
|
package/dist/tts/websocket.js
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -11,10 +11,10 @@ type ConnectionEventData = {
|
|
|
11
11
|
close: never;
|
|
12
12
|
};
|
|
13
13
|
type VoiceSpecifier = {
|
|
14
|
-
mode
|
|
14
|
+
mode?: "id";
|
|
15
15
|
id: string;
|
|
16
16
|
} | {
|
|
17
|
-
mode
|
|
17
|
+
mode?: "embedding";
|
|
18
18
|
embedding: number[];
|
|
19
19
|
};
|
|
20
20
|
type Emotion = "anger" | "sadness" | "positivity" | "curiosity" | "surprise";
|
|
@@ -22,7 +22,7 @@ type Intensity = "lowest" | "low" | "high" | "highest";
|
|
|
22
22
|
type EmotionControl = Emotion | `${Emotion}:${Intensity}`;
|
|
23
23
|
type VoiceOptions = VoiceSpecifier & {
|
|
24
24
|
__experimental_controls?: {
|
|
25
|
-
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest";
|
|
25
|
+
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest" | number;
|
|
26
26
|
emotion?: EmotionControl[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
@@ -83,6 +83,14 @@ type CloneOptions = {
|
|
|
83
83
|
clip: Blob;
|
|
84
84
|
enhance?: boolean;
|
|
85
85
|
};
|
|
86
|
+
interface VoiceToMix {
|
|
87
|
+
id?: string;
|
|
88
|
+
embedding?: number[];
|
|
89
|
+
weight: number;
|
|
90
|
+
}
|
|
91
|
+
interface MixVoicesOptions {
|
|
92
|
+
voices: VoiceToMix[];
|
|
93
|
+
}
|
|
86
94
|
type Voice = {
|
|
87
95
|
id: string;
|
|
88
96
|
name: string;
|
|
@@ -98,6 +106,9 @@ type UpdateVoice = Partial<Pick<Voice, "name" | "description" | "embedding">>;
|
|
|
98
106
|
type CloneResponse = {
|
|
99
107
|
embedding: number[];
|
|
100
108
|
};
|
|
109
|
+
type MixVoicesResponse = {
|
|
110
|
+
embedding: number[];
|
|
111
|
+
};
|
|
101
112
|
type WebSocketOptions = {
|
|
102
113
|
container?: string;
|
|
103
114
|
encoding?: string;
|
|
@@ -112,4 +123,4 @@ type SourceEventData = {
|
|
|
112
123
|
type TypedArray = Float32Array | Int16Array | Uint8Array;
|
|
113
124
|
type Encoding = "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
|
|
114
125
|
|
|
115
|
-
export type { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
|
|
126
|
+
export type { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ type ConnectionEventData = {
|
|
|
11
11
|
close: never;
|
|
12
12
|
};
|
|
13
13
|
type VoiceSpecifier = {
|
|
14
|
-
mode
|
|
14
|
+
mode?: "id";
|
|
15
15
|
id: string;
|
|
16
16
|
} | {
|
|
17
|
-
mode
|
|
17
|
+
mode?: "embedding";
|
|
18
18
|
embedding: number[];
|
|
19
19
|
};
|
|
20
20
|
type Emotion = "anger" | "sadness" | "positivity" | "curiosity" | "surprise";
|
|
@@ -22,7 +22,7 @@ type Intensity = "lowest" | "low" | "high" | "highest";
|
|
|
22
22
|
type EmotionControl = Emotion | `${Emotion}:${Intensity}`;
|
|
23
23
|
type VoiceOptions = VoiceSpecifier & {
|
|
24
24
|
__experimental_controls?: {
|
|
25
|
-
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest";
|
|
25
|
+
speed?: "slowest" | "slow" | "normal" | "fast" | "fastest" | number;
|
|
26
26
|
emotion?: EmotionControl[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
@@ -83,6 +83,14 @@ type CloneOptions = {
|
|
|
83
83
|
clip: Blob;
|
|
84
84
|
enhance?: boolean;
|
|
85
85
|
};
|
|
86
|
+
interface VoiceToMix {
|
|
87
|
+
id?: string;
|
|
88
|
+
embedding?: number[];
|
|
89
|
+
weight: number;
|
|
90
|
+
}
|
|
91
|
+
interface MixVoicesOptions {
|
|
92
|
+
voices: VoiceToMix[];
|
|
93
|
+
}
|
|
86
94
|
type Voice = {
|
|
87
95
|
id: string;
|
|
88
96
|
name: string;
|
|
@@ -98,6 +106,9 @@ type UpdateVoice = Partial<Pick<Voice, "name" | "description" | "embedding">>;
|
|
|
98
106
|
type CloneResponse = {
|
|
99
107
|
embedding: number[];
|
|
100
108
|
};
|
|
109
|
+
type MixVoicesResponse = {
|
|
110
|
+
embedding: number[];
|
|
111
|
+
};
|
|
101
112
|
type WebSocketOptions = {
|
|
102
113
|
container?: string;
|
|
103
114
|
encoding?: string;
|
|
@@ -112,4 +123,4 @@ type SourceEventData = {
|
|
|
112
123
|
type TypedArray = Float32Array | Int16Array | Uint8Array;
|
|
113
124
|
type Encoding = "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
|
|
114
125
|
|
|
115
|
-
export type { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
|
|
126
|
+
export type { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
|
package/dist/voices/index.cjs
CHANGED
|
@@ -159,4 +159,14 @@ var Voices = class extends Client {
|
|
|
159
159
|
throw new Error("Invalid mode for clone()");
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
+
mix(options) {
|
|
163
|
+
return __async(this, null, function* () {
|
|
164
|
+
const request = options;
|
|
165
|
+
const response = yield this._fetch("/voices/mix", {
|
|
166
|
+
method: "POST",
|
|
167
|
+
body: JSON.stringify(request)
|
|
168
|
+
});
|
|
169
|
+
return response.json();
|
|
170
|
+
});
|
|
171
|
+
}
|
|
162
172
|
};
|
package/dist/voices/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from '../lib/client.cjs';
|
|
2
|
-
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse } from '../types/index.cjs';
|
|
2
|
+
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, MixVoicesOptions, MixVoicesResponse } from '../types/index.cjs';
|
|
3
3
|
import 'emittery';
|
|
4
4
|
|
|
5
5
|
declare class Voices extends Client {
|
|
@@ -8,6 +8,7 @@ declare class Voices extends Client {
|
|
|
8
8
|
create(voice: CreateVoice): Promise<Voice>;
|
|
9
9
|
update(id: string, voice: UpdateVoice): Promise<Voice>;
|
|
10
10
|
clone(options: CloneOptions): Promise<CloneResponse>;
|
|
11
|
+
mix(options: MixVoicesOptions): Promise<MixVoicesResponse>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export { Voices as default };
|
package/dist/voices/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from '../lib/client.js';
|
|
2
|
-
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse } from '../types/index.js';
|
|
2
|
+
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, MixVoicesOptions, MixVoicesResponse } from '../types/index.js';
|
|
3
3
|
import 'emittery';
|
|
4
4
|
|
|
5
5
|
declare class Voices extends Client {
|
|
@@ -8,6 +8,7 @@ declare class Voices extends Client {
|
|
|
8
8
|
create(voice: CreateVoice): Promise<Voice>;
|
|
9
9
|
update(id: string, voice: UpdateVoice): Promise<Voice>;
|
|
10
10
|
clone(options: CloneOptions): Promise<CloneResponse>;
|
|
11
|
+
mix(options: MixVoicesOptions): Promise<MixVoicesResponse>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export { Voices as default };
|
package/dist/voices/index.js
CHANGED
package/package.json
CHANGED
package/src/tts/websocket.ts
CHANGED
|
@@ -182,6 +182,8 @@ export default class WebSocket extends Client {
|
|
|
182
182
|
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
183
183
|
return url.toString();
|
|
184
184
|
});
|
|
185
|
+
this.socket.binaryType = "arraybuffer";
|
|
186
|
+
|
|
185
187
|
this.socket.onopen = () => {
|
|
186
188
|
this.#isConnected = true;
|
|
187
189
|
emitter.emit("open");
|
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
|
};
|
|
@@ -112,6 +112,16 @@ export type CloneOptions =
|
|
|
112
112
|
enhance?: boolean;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
+
export interface VoiceToMix {
|
|
116
|
+
id?: string;
|
|
117
|
+
embedding?: number[];
|
|
118
|
+
weight: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MixVoicesOptions {
|
|
122
|
+
voices: VoiceToMix[];
|
|
123
|
+
}
|
|
124
|
+
|
|
115
125
|
export type Voice = {
|
|
116
126
|
id: string;
|
|
117
127
|
name: string;
|
|
@@ -134,6 +144,10 @@ export type CloneResponse = {
|
|
|
134
144
|
embedding: number[];
|
|
135
145
|
};
|
|
136
146
|
|
|
147
|
+
export type MixVoicesResponse = {
|
|
148
|
+
embedding: number[];
|
|
149
|
+
};
|
|
150
|
+
|
|
137
151
|
export type WebSocketOptions = {
|
|
138
152
|
container?: string;
|
|
139
153
|
encoding?: string;
|
package/src/voices/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
CloneOptions,
|
|
4
4
|
CloneResponse,
|
|
5
5
|
CreateVoice,
|
|
6
|
+
MixVoicesOptions,
|
|
7
|
+
MixVoicesResponse,
|
|
6
8
|
UpdateVoice,
|
|
7
9
|
Voice,
|
|
8
10
|
} from "../types";
|
|
@@ -51,4 +53,15 @@ export default class Voices extends Client {
|
|
|
51
53
|
|
|
52
54
|
throw new Error("Invalid mode for clone()");
|
|
53
55
|
}
|
|
56
|
+
|
|
57
|
+
async mix(options: MixVoicesOptions): Promise<MixVoicesResponse> {
|
|
58
|
+
const request: MixVoicesOptions = options;
|
|
59
|
+
|
|
60
|
+
const response = await this._fetch("/voices/mix", {
|
|
61
|
+
method: "POST",
|
|
62
|
+
body: JSON.stringify(request),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return response.json() as Promise<MixVoicesResponse>;
|
|
66
|
+
}
|
|
54
67
|
}
|