@cartesia/cartesia-js 1.0.1 → 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.
@@ -5,71 +5,71 @@ $ tsup src/ --format cjs,esm --dts
5
5
  CLI Target: es6
6
6
  CJS Build start
7
7
  ESM Build start
8
- CJS dist/index.cjs 24.12 KB
9
- CJS dist/lib/client.cjs 3.34 KB
10
- CJS dist/react/index.cjs 31.68 KB
11
- CJS dist/tts/index.cjs 18.49 KB
12
- CJS dist/types/index.cjs 764.00 B
13
- CJS dist/voices/index.cjs 5.04 KB
14
- CJS dist/lib/constants.cjs 1.43 KB
15
- CJS dist/lib/index.cjs 20.02 KB
16
- CJS dist/react/utils.cjs 1.80 KB
17
- CJS dist/tts/player.cjs 6.96 KB
18
- CJS dist/tts/source.cjs 8.15 KB
19
- CJS dist/tts/utils.cjs 4.33 KB
20
- CJS dist/tts/websocket.cjs 18.18 KB
21
- CJS ⚡️ Build success in 110ms
22
8
  ESM dist/chunk-FXPGR372.js 0 B
23
- ESM dist/tts/source.js 144.00 B
24
- ESM dist/tts/utils.js 426.00 B
25
- ESM dist/tts/websocket.js 242.00 B
26
- ESM dist/types/index.js 31.00 B
27
- ESM dist/voices/index.js 174.00 B
28
9
  ESM dist/index.js 499.00 B
29
10
  ESM dist/lib/client.js 132.00 B
11
+ ESM dist/react/index.js 7.62 KB
12
+ ESM dist/tts/index.js 261.00 B
30
13
  ESM dist/lib/constants.js 183.00 B
31
14
  ESM dist/lib/index.js 322.00 B
32
- ESM dist/react/index.js 7.62 KB
33
- ESM dist/chunk-OFH3ML4L.js 353.00 B
34
- ESM dist/chunk-KUSVZXDT.js 1.35 KB
15
+ ESM dist/chunk-ZF6HASZT.js 353.00 B
16
+ ESM dist/chunk-YFN6TFR4.js 1.74 KB
35
17
  ESM dist/react/utils.js 109.00 B
36
18
  ESM dist/chunk-NQVZNVOU.js 337.00 B
37
- ESM dist/tts/index.js 261.00 B
38
- ESM dist/chunk-2NA5SEML.js 439.00 B
39
- ESM dist/chunk-ASZKHN7Q.js 6.89 KB
40
- ESM dist/chunk-5M33ZF3Y.js 841.00 B
19
+ ESM dist/chunk-NWCW6C7H.js 439.00 B
20
+ ESM dist/chunk-EUW2435M.js 7.17 KB
21
+ ESM dist/chunk-PISCPZK4.js 1.02 KB
41
22
  ESM dist/chunk-2BFEKY3F.js 366.00 B
42
23
  ESM dist/tts/player.js 174.00 B
43
24
  ESM dist/chunk-LZO6K34D.js 3.76 KB
44
25
  ESM dist/chunk-BHY7MNGT.js 2.11 KB
45
26
  ESM dist/chunk-6YQ6KDIQ.js 5.32 KB
46
27
  ESM dist/chunk-GHY2WEOK.js 2.70 KB
47
- ESM ⚡️ Build success in 112ms
28
+ ESM dist/voices/index.js 174.00 B
29
+ ESM dist/types/index.js 31.00 B
30
+ ESM dist/tts/source.js 144.00 B
31
+ ESM dist/tts/utils.js 426.00 B
32
+ ESM dist/tts/websocket.js 242.00 B
33
+ ESM ⚡️ Build success in 72ms
34
+ CJS dist/index.cjs 24.98 KB
35
+ CJS dist/lib/client.cjs 4.07 KB
36
+ CJS dist/lib/constants.cjs 1.43 KB
37
+ CJS dist/lib/index.cjs 20.87 KB
38
+ CJS dist/react/index.cjs 32.54 KB
39
+ CJS dist/react/utils.cjs 1.80 KB
40
+ CJS dist/tts/index.cjs 18.96 KB
41
+ CJS dist/tts/player.cjs 6.96 KB
42
+ CJS dist/tts/utils.cjs 4.33 KB
43
+ CJS dist/tts/source.cjs 8.15 KB
44
+ CJS dist/types/index.cjs 764.00 B
45
+ CJS dist/tts/websocket.cjs 18.65 KB
46
+ CJS dist/voices/index.cjs 5.62 KB
47
+ CJS ⚡️ Build success in 73ms
48
48
  DTS Build start
49
- DTS ⚡️ Build success in 8520ms
50
- DTS dist/index.d.cts 804.00 B
49
+ DTS ⚡️ Build success in 8468ms
50
+ DTS dist/index.d.cts 866.00 B
51
51
  DTS dist/lib/constants.d.cts 564.00 B
52
52
  DTS dist/lib/index.d.cts 410.00 B
53
- DTS dist/react/index.d.cts 1.07 KB
53
+ DTS dist/react/index.d.cts 1.09 KB
54
54
  DTS dist/react/utils.d.cts 240.00 B
55
55
  DTS dist/tts/index.d.cts 471.00 B
56
56
  DTS dist/tts/player.d.cts 1.20 KB
57
57
  DTS dist/tts/utils.d.cts 2.68 KB
58
58
  DTS dist/tts/websocket.d.cts 2.94 KB
59
59
  DTS dist/tts/source.d.cts 2.55 KB
60
- DTS dist/voices/index.d.cts 399.00 B
61
- DTS dist/lib/client.d.cts 267.00 B
62
- DTS dist/types/index.d.cts 3.07 KB
63
- DTS dist/index.d.ts 796.00 B
60
+ DTS dist/voices/index.d.cts 573.00 B
61
+ DTS dist/lib/client.d.cts 293.00 B
62
+ DTS dist/types/index.d.cts 3.50 KB
63
+ DTS dist/index.d.ts 858.00 B
64
64
  DTS dist/lib/constants.d.ts 564.00 B
65
65
  DTS dist/lib/index.d.ts 404.00 B
66
- DTS dist/react/index.d.ts 1.07 KB
66
+ DTS dist/react/index.d.ts 1.09 KB
67
67
  DTS dist/react/utils.d.ts 240.00 B
68
68
  DTS dist/tts/index.d.ts 467.00 B
69
69
  DTS dist/tts/player.d.ts 1.20 KB
70
70
  DTS dist/tts/utils.d.ts 2.68 KB
71
71
  DTS dist/tts/websocket.d.ts 2.94 KB
72
72
  DTS dist/tts/source.d.ts 2.55 KB
73
- DTS dist/voices/index.d.ts 397.00 B
74
- DTS dist/lib/client.d.ts 266.00 B
75
- DTS dist/types/index.d.ts 3.07 KB
73
+ DTS dist/voices/index.d.ts 571.00 B
74
+ DTS dist/lib/client.d.ts 292.00 B
75
+ DTS dist/types/index.d.ts 3.50 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @cartesia/cartesia-js
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9b157d6: Support Bun by adding socket binaryType
8
+
9
+ ## 1.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Make voice creation and cloning fully compatible with API.
14
+
3
15
  ## 1.0.1
4
16
 
5
17
  ### Patch Changes
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Client
3
- } from "./chunk-5M33ZF3Y.js";
3
+ } from "./chunk-PISCPZK4.js";
4
4
  import {
5
5
  CARTESIA_VERSION,
6
6
  constructApiUrl
@@ -159,56 +159,61 @@ var WebSocket = class extends Client {
159
159
  * @throws {Error} If the WebSocket fails to connect.
160
160
  */
161
161
  connect() {
162
- const url = constructApiUrl(this.baseUrl, "/tts/websocket", {
163
- websocket: true
162
+ return __async(this, null, function* () {
163
+ const emitter = new Emittery();
164
+ this.socket = new PartySocketWebSocket(() => __async(this, null, function* () {
165
+ const url = constructApiUrl(this.baseUrl, "/tts/websocket", {
166
+ websocket: true
167
+ });
168
+ url.searchParams.set("api_key", yield this.apiKey());
169
+ url.searchParams.set("cartesia_version", CARTESIA_VERSION);
170
+ return url.toString();
171
+ }));
172
+ this.socket.binaryType = "arraybuffer";
173
+ this.socket.onopen = () => {
174
+ __privateSet(this, _isConnected, true);
175
+ emitter.emit("open");
176
+ };
177
+ this.socket.onclose = () => {
178
+ __privateSet(this, _isConnected, false);
179
+ emitter.emit("close");
180
+ };
181
+ return new Promise(
182
+ (resolve, reject) => {
183
+ var _a, _b, _c;
184
+ (_a = this.socket) == null ? void 0 : _a.addEventListener(
185
+ "open",
186
+ () => {
187
+ resolve(getEmitteryCallbacks(emitter));
188
+ },
189
+ {
190
+ once: true
191
+ }
192
+ );
193
+ const aborter = new AbortController();
194
+ (_b = this.socket) == null ? void 0 : _b.addEventListener(
195
+ "error",
196
+ () => {
197
+ aborter.abort();
198
+ reject(new Error("WebSocket failed to connect."));
199
+ },
200
+ {
201
+ signal: aborter.signal
202
+ }
203
+ );
204
+ (_c = this.socket) == null ? void 0 : _c.addEventListener(
205
+ "close",
206
+ () => {
207
+ aborter.abort();
208
+ reject(new Error("WebSocket closed before it could connect."));
209
+ },
210
+ {
211
+ signal: aborter.signal
212
+ }
213
+ );
214
+ }
215
+ );
164
216
  });
165
- url.searchParams.set("api_key", this.apiKey);
166
- url.searchParams.set("cartesia_version", CARTESIA_VERSION);
167
- const emitter = new Emittery();
168
- this.socket = new PartySocketWebSocket(url.toString());
169
- this.socket.onopen = () => {
170
- __privateSet(this, _isConnected, true);
171
- emitter.emit("open");
172
- };
173
- this.socket.onclose = () => {
174
- __privateSet(this, _isConnected, false);
175
- emitter.emit("close");
176
- };
177
- return new Promise(
178
- (resolve, reject) => {
179
- var _a, _b, _c;
180
- (_a = this.socket) == null ? void 0 : _a.addEventListener(
181
- "open",
182
- () => {
183
- resolve(getEmitteryCallbacks(emitter));
184
- },
185
- {
186
- once: true
187
- }
188
- );
189
- const aborter = new AbortController();
190
- (_b = this.socket) == null ? void 0 : _b.addEventListener(
191
- "error",
192
- () => {
193
- aborter.abort();
194
- reject(new Error("WebSocket failed to connect."));
195
- },
196
- {
197
- signal: aborter.signal
198
- }
199
- );
200
- (_c = this.socket) == null ? void 0 : _c.addEventListener(
201
- "close",
202
- () => {
203
- aborter.abort();
204
- reject(new Error("WebSocket closed before it could connect."));
205
- },
206
- {
207
- signal: aborter.signal
208
- }
209
- );
210
- }
211
- );
212
217
  }
213
218
  /**
214
219
  * Disconnect from the Cartesia streaming WebSocket.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocket
3
- } from "./chunk-ASZKHN7Q.js";
3
+ } from "./chunk-EUW2435M.js";
4
4
  import {
5
5
  Client
6
- } from "./chunk-5M33ZF3Y.js";
6
+ } from "./chunk-PISCPZK4.js";
7
7
 
8
8
  // src/tts/index.ts
9
9
  var TTS = class extends Client {
@@ -0,0 +1,40 @@
1
+ import {
2
+ BASE_URL,
3
+ CARTESIA_VERSION,
4
+ constructApiUrl
5
+ } from "./chunk-2BFEKY3F.js";
6
+ import {
7
+ __async,
8
+ __spreadProps,
9
+ __spreadValues
10
+ } from "./chunk-GHY2WEOK.js";
11
+
12
+ // src/lib/client.ts
13
+ import fetch from "cross-fetch";
14
+ var Client = class {
15
+ constructor(options = {}) {
16
+ const apiKey = options.apiKey || process.env.CARTESIA_API_KEY;
17
+ if (!apiKey) {
18
+ throw new Error("Missing Cartesia API key.");
19
+ }
20
+ this.apiKey = typeof apiKey === "function" ? apiKey : () => __async(this, null, function* () {
21
+ return apiKey;
22
+ });
23
+ this.baseUrl = options.baseUrl || BASE_URL;
24
+ }
25
+ _fetch(_0) {
26
+ return __async(this, arguments, function* (path, options = {}) {
27
+ const url = constructApiUrl(this.baseUrl, path);
28
+ const headers = new Headers(options.headers);
29
+ headers.set("X-API-Key", yield this.apiKey());
30
+ headers.set("Cartesia-Version", CARTESIA_VERSION);
31
+ return fetch(url.toString(), __spreadProps(__spreadValues({}, options), {
32
+ headers
33
+ }));
34
+ });
35
+ }
36
+ };
37
+
38
+ export {
39
+ Client
40
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ Client
3
+ } from "./chunk-PISCPZK4.js";
4
+ import {
5
+ __async
6
+ } from "./chunk-GHY2WEOK.js";
7
+
8
+ // src/voices/index.ts
9
+ var Voices = class extends Client {
10
+ list() {
11
+ return __async(this, null, function* () {
12
+ const response = yield this._fetch("/voices");
13
+ return response.json();
14
+ });
15
+ }
16
+ get(voiceId) {
17
+ return __async(this, null, function* () {
18
+ const response = yield this._fetch(`/voices/${voiceId}`);
19
+ return response.json();
20
+ });
21
+ }
22
+ create(voice) {
23
+ return __async(this, null, function* () {
24
+ const response = yield this._fetch("/voices", {
25
+ method: "POST",
26
+ body: JSON.stringify(voice)
27
+ });
28
+ return response.json();
29
+ });
30
+ }
31
+ update(id, voice) {
32
+ return __async(this, null, function* () {
33
+ const response = yield this._fetch(`/voices/${id}`, {
34
+ method: "PATCH",
35
+ body: JSON.stringify(voice)
36
+ });
37
+ return response.json();
38
+ });
39
+ }
40
+ clone(options) {
41
+ return __async(this, null, function* () {
42
+ if (options.mode === "clip") {
43
+ const formData = new FormData();
44
+ formData.append("clip", options.clip);
45
+ if (options.enhance !== void 0) {
46
+ formData.append("enhance", options.enhance.toString());
47
+ }
48
+ const response = yield this._fetch("/voices/clone/clip", {
49
+ method: "POST",
50
+ body: formData
51
+ });
52
+ return response.json();
53
+ }
54
+ throw new Error("Invalid mode for clone()");
55
+ });
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
+ }
67
+ };
68
+
69
+ export {
70
+ Voices
71
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Voices
3
- } from "./chunk-KUSVZXDT.js";
3
+ } from "./chunk-YFN6TFR4.js";
4
4
  import {
5
5
  TTS
6
- } from "./chunk-2NA5SEML.js";
6
+ } from "./chunk-NWCW6C7H.js";
7
7
  import {
8
8
  Client
9
- } from "./chunk-5M33ZF3Y.js";
9
+ } from "./chunk-PISCPZK4.js";
10
10
 
11
11
  // src/lib/index.ts
12
12
  var Cartesia = class extends Client {
package/dist/index.cjs CHANGED
@@ -126,20 +126,25 @@ var constructApiUrl = (baseUrl, path, { websocket = false } = {}) => {
126
126
  // src/lib/client.ts
127
127
  var Client = class {
128
128
  constructor(options = {}) {
129
- if (!(options.apiKey || process.env.CARTESIA_API_KEY)) {
129
+ const apiKey = options.apiKey || process.env.CARTESIA_API_KEY;
130
+ if (!apiKey) {
130
131
  throw new Error("Missing Cartesia API key.");
131
132
  }
132
- this.apiKey = options.apiKey || process.env.CARTESIA_API_KEY;
133
+ this.apiKey = typeof apiKey === "function" ? apiKey : () => __async(this, null, function* () {
134
+ return apiKey;
135
+ });
133
136
  this.baseUrl = options.baseUrl || BASE_URL;
134
137
  }
135
- fetch(path, options = {}) {
136
- const url = constructApiUrl(this.baseUrl, path);
137
- return (0, import_cross_fetch.default)(url.toString(), __spreadProps(__spreadValues({}, options), {
138
- headers: __spreadValues({
139
- "X-API-Key": this.apiKey,
140
- "Cartesia-Version": CARTESIA_VERSION
141
- }, options.headers)
142
- }));
138
+ _fetch(_0) {
139
+ return __async(this, arguments, function* (path, options = {}) {
140
+ const url = constructApiUrl(this.baseUrl, path);
141
+ const headers = new Headers(options.headers);
142
+ headers.set("X-API-Key", yield this.apiKey());
143
+ headers.set("Cartesia-Version", CARTESIA_VERSION);
144
+ return (0, import_cross_fetch.default)(url.toString(), __spreadProps(__spreadValues({}, options), {
145
+ headers
146
+ }));
147
+ });
143
148
  }
144
149
  };
145
150
 
@@ -495,56 +500,61 @@ var WebSocket = class extends Client {
495
500
  * @throws {Error} If the WebSocket fails to connect.
496
501
  */
497
502
  connect() {
498
- const url = constructApiUrl(this.baseUrl, "/tts/websocket", {
499
- websocket: true
503
+ return __async(this, null, function* () {
504
+ const emitter = new import_emittery2.default();
505
+ this.socket = new import_partysocket.WebSocket(() => __async(this, null, function* () {
506
+ const url = constructApiUrl(this.baseUrl, "/tts/websocket", {
507
+ websocket: true
508
+ });
509
+ url.searchParams.set("api_key", yield this.apiKey());
510
+ url.searchParams.set("cartesia_version", CARTESIA_VERSION);
511
+ return url.toString();
512
+ }));
513
+ this.socket.binaryType = "arraybuffer";
514
+ this.socket.onopen = () => {
515
+ __privateSet(this, _isConnected, true);
516
+ emitter.emit("open");
517
+ };
518
+ this.socket.onclose = () => {
519
+ __privateSet(this, _isConnected, false);
520
+ emitter.emit("close");
521
+ };
522
+ return new Promise(
523
+ (resolve, reject) => {
524
+ var _a, _b, _c;
525
+ (_a = this.socket) == null ? void 0 : _a.addEventListener(
526
+ "open",
527
+ () => {
528
+ resolve(getEmitteryCallbacks(emitter));
529
+ },
530
+ {
531
+ once: true
532
+ }
533
+ );
534
+ const aborter = new AbortController();
535
+ (_b = this.socket) == null ? void 0 : _b.addEventListener(
536
+ "error",
537
+ () => {
538
+ aborter.abort();
539
+ reject(new Error("WebSocket failed to connect."));
540
+ },
541
+ {
542
+ signal: aborter.signal
543
+ }
544
+ );
545
+ (_c = this.socket) == null ? void 0 : _c.addEventListener(
546
+ "close",
547
+ () => {
548
+ aborter.abort();
549
+ reject(new Error("WebSocket closed before it could connect."));
550
+ },
551
+ {
552
+ signal: aborter.signal
553
+ }
554
+ );
555
+ }
556
+ );
500
557
  });
501
- url.searchParams.set("api_key", this.apiKey);
502
- url.searchParams.set("cartesia_version", CARTESIA_VERSION);
503
- const emitter = new import_emittery2.default();
504
- this.socket = new import_partysocket.WebSocket(url.toString());
505
- this.socket.onopen = () => {
506
- __privateSet(this, _isConnected, true);
507
- emitter.emit("open");
508
- };
509
- this.socket.onclose = () => {
510
- __privateSet(this, _isConnected, false);
511
- emitter.emit("close");
512
- };
513
- return new Promise(
514
- (resolve, reject) => {
515
- var _a, _b, _c;
516
- (_a = this.socket) == null ? void 0 : _a.addEventListener(
517
- "open",
518
- () => {
519
- resolve(getEmitteryCallbacks(emitter));
520
- },
521
- {
522
- once: true
523
- }
524
- );
525
- const aborter = new AbortController();
526
- (_b = this.socket) == null ? void 0 : _b.addEventListener(
527
- "error",
528
- () => {
529
- aborter.abort();
530
- reject(new Error("WebSocket failed to connect."));
531
- },
532
- {
533
- signal: aborter.signal
534
- }
535
- );
536
- (_c = this.socket) == null ? void 0 : _c.addEventListener(
537
- "close",
538
- () => {
539
- aborter.abort();
540
- reject(new Error("WebSocket closed before it could connect."));
541
- },
542
- {
543
- signal: aborter.signal
544
- }
545
- );
546
- }
547
- );
548
558
  }
549
559
  /**
550
560
  * Disconnect from the Cartesia streaming WebSocket.
@@ -585,40 +595,43 @@ var TTS = class extends Client {
585
595
  var Voices = class extends Client {
586
596
  list() {
587
597
  return __async(this, null, function* () {
588
- const response = yield this.fetch("/voices");
598
+ const response = yield this._fetch("/voices");
589
599
  return response.json();
590
600
  });
591
601
  }
592
602
  get(voiceId) {
593
603
  return __async(this, null, function* () {
594
- const response = yield this.fetch(`/voices/${voiceId}`);
604
+ const response = yield this._fetch(`/voices/${voiceId}`);
595
605
  return response.json();
596
606
  });
597
607
  }
598
608
  create(voice) {
599
609
  return __async(this, null, function* () {
600
- const response = yield this.fetch("/voices", {
610
+ const response = yield this._fetch("/voices", {
601
611
  method: "POST",
602
612
  body: JSON.stringify(voice)
603
613
  });
604
614
  return response.json();
605
615
  });
606
616
  }
617
+ update(id, voice) {
618
+ return __async(this, null, function* () {
619
+ const response = yield this._fetch(`/voices/${id}`, {
620
+ method: "PATCH",
621
+ body: JSON.stringify(voice)
622
+ });
623
+ return response.json();
624
+ });
625
+ }
607
626
  clone(options) {
608
627
  return __async(this, null, function* () {
609
- if (options.mode === "url") {
610
- const response = yield this.fetch(
611
- `/voices/clone/url?link=${options.link}`,
612
- {
613
- method: "POST"
614
- }
615
- );
616
- return response.json();
617
- }
618
628
  if (options.mode === "clip") {
619
629
  const formData = new FormData();
620
630
  formData.append("clip", options.clip);
621
- const response = yield this.fetch("/voices/clone/clip", {
631
+ if (options.enhance !== void 0) {
632
+ formData.append("enhance", options.enhance.toString());
633
+ }
634
+ const response = yield this._fetch("/voices/clone/clip", {
622
635
  method: "POST",
623
636
  body: formData
624
637
  });
@@ -627,6 +640,16 @@ var Voices = class extends Client {
627
640
  throw new Error("Invalid mode for clone()");
628
641
  });
629
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
+ }
630
653
  };
631
654
 
632
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, 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, 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,13 +1,13 @@
1
1
  import "./chunk-FXPGR372.js";
2
2
  import {
3
3
  Cartesia
4
- } from "./chunk-OFH3ML4L.js";
5
- import "./chunk-KUSVZXDT.js";
6
- import "./chunk-2NA5SEML.js";
4
+ } from "./chunk-ZF6HASZT.js";
5
+ import "./chunk-YFN6TFR4.js";
6
+ import "./chunk-NWCW6C7H.js";
7
7
  import {
8
8
  WebSocket
9
- } from "./chunk-ASZKHN7Q.js";
10
- import "./chunk-5M33ZF3Y.js";
9
+ } from "./chunk-EUW2435M.js";
10
+ import "./chunk-PISCPZK4.js";
11
11
  import "./chunk-2BFEKY3F.js";
12
12
  import {
13
13
  Player