@cartesia/cartesia-js 2.2.4 → 2.2.7
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/Client.d.ts +3 -0
- package/Client.js +11 -6
- package/README.md +539 -172
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/auth/client/Client.d.ts +17 -0
- package/api/resources/auth/client/Client.js +18 -1
- package/api/resources/auth/types/TokenGrant.d.ts +3 -1
- package/api/resources/auth/types/TokenRequest.d.ts +2 -2
- package/api/resources/index.d.ts +1 -0
- package/api/resources/index.js +1 -0
- package/api/resources/infill/client/Client.js +1 -1
- package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
- package/api/resources/stt/client/Client.d.ts +43 -0
- package/api/resources/stt/client/Client.js +108 -0
- package/api/resources/stt/client/index.d.ts +1 -1
- package/api/resources/stt/client/index.js +15 -3
- package/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
- package/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
- package/api/resources/stt/client/requests/index.d.ts +1 -0
- package/api/resources/stt/client/requests/index.js +2 -0
- package/api/resources/stt/index.d.ts +1 -0
- package/api/resources/stt/index.js +1 -0
- package/api/resources/stt/types/SttEncoding.d.ts +6 -6
- package/api/resources/stt/types/SttEncoding.js +5 -0
- package/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
- package/api/resources/stt/types/TimestampGranularity.js +9 -0
- package/api/resources/stt/types/TranscriptMessage.d.ts +4 -1
- package/api/resources/stt/types/TranscriptionResponse.d.ts +4 -1
- package/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
- package/api/resources/stt/types/TranscriptionWord.js +5 -0
- package/api/resources/stt/types/index.d.ts +2 -0
- package/api/resources/stt/types/index.js +2 -0
- package/api/resources/tts/client/Client.d.ts +7 -2
- package/api/resources/tts/client/Client.js +8 -8
- package/api/resources/tts/types/Controls.d.ts +1 -1
- package/api/resources/tts/types/Emotion.d.ts +2 -33
- package/api/resources/tts/types/Emotion.js +0 -28
- package/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
- package/api/resources/tts/types/EmotionDeprecated.js +33 -0
- package/api/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/api/resources/tts/types/GenerationConfig.js +5 -0
- package/api/resources/tts/types/GenerationRequest.d.ts +5 -4
- package/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
- package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
- package/api/resources/tts/types/SseOutputFormat.js +5 -0
- package/api/resources/tts/types/TtsRequest.d.ts +1 -0
- package/api/resources/tts/types/TtssseRequest.d.ts +27 -0
- package/api/resources/tts/types/TtssseRequest.js +5 -0
- package/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
- package/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
- package/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
- package/api/resources/tts/types/index.d.ts +5 -1
- package/api/resources/tts/types/index.js +5 -1
- package/api/resources/voiceChanger/client/Client.d.ts +9 -4
- package/api/resources/voiceChanger/client/Client.js +24 -20
- package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
- package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
- package/api/resources/voices/client/Client.js +8 -8
- package/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
- package/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
- package/core/fetcher/Fetcher.d.ts +2 -2
- package/core/fetcher/Fetcher.js +4 -3
- package/core/fetcher/getResponseBody.js +3 -3
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +11 -6
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/auth/client/Client.d.ts +17 -0
- package/dist/api/resources/auth/client/Client.js +18 -1
- package/dist/api/resources/auth/types/TokenGrant.d.ts +3 -1
- package/dist/api/resources/auth/types/TokenRequest.d.ts +2 -2
- package/dist/api/resources/index.d.ts +1 -0
- package/dist/api/resources/index.js +1 -0
- package/dist/api/resources/infill/client/Client.js +1 -1
- package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
- package/dist/api/resources/stt/client/Client.d.ts +43 -0
- package/dist/api/resources/stt/client/Client.js +108 -0
- package/dist/api/resources/stt/client/index.d.ts +1 -1
- package/dist/api/resources/stt/client/index.js +15 -3
- package/dist/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
- package/dist/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
- package/dist/api/resources/stt/client/requests/index.d.ts +1 -0
- package/dist/api/resources/stt/client/requests/index.js +2 -0
- package/dist/api/resources/stt/index.d.ts +1 -0
- package/dist/api/resources/stt/index.js +1 -0
- package/dist/api/resources/stt/types/SttEncoding.d.ts +6 -6
- package/dist/api/resources/stt/types/SttEncoding.js +5 -0
- package/dist/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
- package/dist/api/resources/stt/types/TimestampGranularity.js +9 -0
- package/dist/api/resources/stt/types/TranscriptMessage.d.ts +4 -1
- package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +4 -1
- package/dist/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
- package/dist/api/resources/stt/types/TranscriptionWord.js +5 -0
- package/dist/api/resources/stt/types/index.d.ts +2 -0
- package/dist/api/resources/stt/types/index.js +2 -0
- package/dist/api/resources/tts/client/Client.d.ts +7 -2
- package/dist/api/resources/tts/client/Client.js +8 -8
- package/dist/api/resources/tts/types/Controls.d.ts +1 -1
- package/dist/api/resources/tts/types/Emotion.d.ts +2 -33
- package/dist/api/resources/tts/types/Emotion.js +0 -28
- package/dist/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
- package/dist/api/resources/tts/types/EmotionDeprecated.js +33 -0
- package/dist/api/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/dist/api/resources/tts/types/GenerationConfig.js +5 -0
- package/dist/api/resources/tts/types/GenerationRequest.d.ts +5 -4
- package/dist/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
- package/dist/api/resources/tts/types/SseOutputFormat.js +5 -0
- package/dist/api/resources/tts/types/TtsRequest.d.ts +1 -0
- package/dist/api/resources/tts/types/TtssseRequest.d.ts +27 -0
- package/dist/api/resources/tts/types/TtssseRequest.js +5 -0
- package/dist/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
- package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
- package/dist/api/resources/tts/types/index.d.ts +5 -1
- package/dist/api/resources/tts/types/index.js +5 -1
- package/dist/api/resources/voiceChanger/client/Client.d.ts +9 -4
- package/dist/api/resources/voiceChanger/client/Client.js +24 -20
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
- package/dist/api/resources/voices/client/Client.js +8 -8
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
- package/dist/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
- package/dist/core/fetcher/Fetcher.d.ts +2 -2
- package/dist/core/fetcher/Fetcher.js +4 -3
- package/dist/core/fetcher/getResponseBody.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
- package/dist/serialization/resources/auth/types/TokenGrant.js +2 -1
- package/dist/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
- package/dist/serialization/resources/auth/types/TokenRequest.js +1 -1
- package/dist/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
- package/dist/serialization/resources/stt/types/SttEncoding.js +1 -1
- package/dist/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
- package/dist/serialization/resources/stt/types/TimestampGranularity.js +41 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.js +2 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
- package/dist/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
- package/dist/serialization/resources/stt/types/TranscriptionWord.js +45 -0
- package/dist/serialization/resources/stt/types/index.d.ts +2 -0
- package/dist/serialization/resources/stt/types/index.js +2 -0
- package/dist/serialization/resources/tts/types/Controls.d.ts +2 -2
- package/dist/serialization/resources/tts/types/Controls.js +2 -2
- package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/dist/serialization/resources/tts/types/Emotion.js +1 -27
- package/dist/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
- package/dist/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
- package/dist/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/dist/serialization/resources/tts/types/GenerationConfig.js +46 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
- package/dist/serialization/resources/tts/types/GenerationRequest.js +3 -1
- package/dist/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
- package/dist/serialization/resources/tts/types/SseOutputFormat.js +46 -0
- package/dist/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
- package/dist/serialization/resources/tts/types/TtsRequest.js +2 -0
- package/dist/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
- package/dist/serialization/resources/tts/types/TtssseRequest.js +60 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
- package/dist/serialization/resources/tts/types/index.d.ts +5 -1
- package/dist/serialization/resources/tts/types/index.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/StreamingSTTClient.d.ts +22 -2
- package/dist/wrapper/StreamingSTTClient.js +124 -1
- package/dist/wrapper/SttWebsocket.d.ts +8 -3
- package/dist/wrapper/SttWebsocket.js +24 -3
- package/dist/wrapper/Websocket.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +8 -1
- package/package.json +1 -1
- package/reference.md +89 -1
- package/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
- package/serialization/resources/auth/types/TokenGrant.js +2 -1
- package/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
- package/serialization/resources/auth/types/TokenRequest.js +1 -1
- package/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
- package/serialization/resources/stt/types/SttEncoding.js +1 -1
- package/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
- package/serialization/resources/stt/types/TimestampGranularity.js +41 -0
- package/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
- package/serialization/resources/stt/types/TranscriptMessage.js +2 -0
- package/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
- package/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
- package/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
- package/serialization/resources/stt/types/TranscriptionWord.js +45 -0
- package/serialization/resources/stt/types/index.d.ts +2 -0
- package/serialization/resources/stt/types/index.js +2 -0
- package/serialization/resources/tts/types/Controls.d.ts +2 -2
- package/serialization/resources/tts/types/Controls.js +2 -2
- package/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/serialization/resources/tts/types/Emotion.js +1 -27
- package/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
- package/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
- package/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/serialization/resources/tts/types/GenerationConfig.js +46 -0
- package/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
- package/serialization/resources/tts/types/GenerationRequest.js +3 -1
- package/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
- package/serialization/resources/tts/types/SseOutputFormat.js +46 -0
- package/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
- package/serialization/resources/tts/types/TtsRequest.js +2 -0
- package/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
- package/serialization/resources/tts/types/TtssseRequest.js +60 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
- package/serialization/resources/tts/types/index.d.ts +5 -1
- package/serialization/resources/tts/types/index.js +5 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/StreamingSTTClient.d.ts +22 -2
- package/wrapper/StreamingSTTClient.js +124 -1
- package/wrapper/SttWebsocket.d.ts +8 -3
- package/wrapper/SttWebsocket.js +24 -3
- package/wrapper/Websocket.js +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface TranscriptionWord {
|
|
5
|
+
/** The transcribed word. */
|
|
6
|
+
word: string;
|
|
7
|
+
/** Start time of the word in seconds. */
|
|
8
|
+
start: number;
|
|
9
|
+
/** End time of the word in seconds. */
|
|
10
|
+
end: number;
|
|
11
|
+
}
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TimestampGranularity"), exports);
|
|
18
|
+
__exportStar(require("./TranscriptionWord"), exports);
|
|
17
19
|
__exportStar(require("./TranscriptionResponse"), exports);
|
|
18
20
|
__exportStar(require("./StreamingTranscriptionResponse"), exports);
|
|
19
21
|
__exportStar(require("./TranscriptMessage"), exports);
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
import * as environments from "../../../../environments";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
6
|
import * as Cartesia from "../../../index";
|
|
7
|
+
import * as stream from "stream";
|
|
7
8
|
export declare namespace Tts {
|
|
8
9
|
interface Options {
|
|
9
10
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
11
|
+
/** Specify a custom URL to connect the client to. */
|
|
12
|
+
baseUrl?: core.Supplier<string>;
|
|
10
13
|
apiKey?: core.Supplier<string | undefined>;
|
|
11
14
|
/** Override the Cartesia-Version header */
|
|
12
15
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -21,13 +24,15 @@ export declare namespace Tts {
|
|
|
21
24
|
abortSignal?: AbortSignal;
|
|
22
25
|
/** Override the Cartesia-Version header */
|
|
23
26
|
cartesiaVersion?: "2024-06-10";
|
|
27
|
+
/** Additional headers to include in the request. */
|
|
28
|
+
headers?: Record<string, string>;
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
31
|
export declare class Tts {
|
|
27
32
|
protected readonly _options: Tts.Options;
|
|
28
33
|
constructor(_options?: Tts.Options);
|
|
29
|
-
bytes(request: Cartesia.TtsRequest, requestOptions?: Tts.RequestOptions): Promise<
|
|
30
|
-
sse(request: Cartesia.
|
|
34
|
+
bytes(request: Cartesia.TtsRequest, requestOptions?: Tts.RequestOptions): Promise<stream.Readable>;
|
|
35
|
+
sse(request: Cartesia.TtssseRequest, requestOptions?: Tts.RequestOptions): Promise<core.Stream<Cartesia.WebSocketResponse>>;
|
|
31
36
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
32
37
|
"X-API-Key": string | undefined;
|
|
33
38
|
}>;
|
|
@@ -60,15 +60,15 @@ class Tts {
|
|
|
60
60
|
}
|
|
61
61
|
bytes(request, requestOptions) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
var _a, _b, _c, _d, _e;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f;
|
|
64
64
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
65
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
65
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/tts/bytes"),
|
|
66
66
|
method: "POST",
|
|
67
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
67
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.7", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
68
68
|
contentType: "application/json",
|
|
69
69
|
requestType: "json",
|
|
70
70
|
body: serializers.TtsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
71
|
-
responseType: "
|
|
71
|
+
responseType: "streaming",
|
|
72
72
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
73
73
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
74
74
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -99,14 +99,14 @@ class Tts {
|
|
|
99
99
|
}
|
|
100
100
|
sse(request, requestOptions) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
var _a, _b, _c, _d, _e;
|
|
102
|
+
var _a, _b, _c, _d, _e, _f;
|
|
103
103
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
104
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
104
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/tts/sse"),
|
|
105
105
|
method: "POST",
|
|
106
|
-
headers: Object.assign({ "Cartesia-Version": (
|
|
106
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.7", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
107
107
|
contentType: "application/json",
|
|
108
108
|
requestType: "json",
|
|
109
|
-
body: serializers.
|
|
109
|
+
body: serializers.TtssseRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
110
110
|
responseType: "sse",
|
|
111
111
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
112
112
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -2,37 +2,6 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Supported emotions are: anger, positivity, surprise, sadness, and curiosity.
|
|
8
|
-
*
|
|
9
|
-
* Supported levels are: lowest, low, (omit), high, highest.
|
|
5
|
+
* Guide the emotion of the generated speech.
|
|
10
6
|
*/
|
|
11
|
-
export type Emotion =
|
|
12
|
-
export declare const Emotion: {
|
|
13
|
-
readonly AngerLowest: "anger:lowest";
|
|
14
|
-
readonly AngerLow: "anger:low";
|
|
15
|
-
readonly Anger: "anger";
|
|
16
|
-
readonly AngerHigh: "anger:high";
|
|
17
|
-
readonly AngerHighest: "anger:highest";
|
|
18
|
-
readonly PositivityLowest: "positivity:lowest";
|
|
19
|
-
readonly PositivityLow: "positivity:low";
|
|
20
|
-
readonly Positivity: "positivity";
|
|
21
|
-
readonly PositivityHigh: "positivity:high";
|
|
22
|
-
readonly PositivityHighest: "positivity:highest";
|
|
23
|
-
readonly SurpriseLowest: "surprise:lowest";
|
|
24
|
-
readonly SurpriseLow: "surprise:low";
|
|
25
|
-
readonly Surprise: "surprise";
|
|
26
|
-
readonly SurpriseHigh: "surprise:high";
|
|
27
|
-
readonly SurpriseHighest: "surprise:highest";
|
|
28
|
-
readonly SadnessLowest: "sadness:lowest";
|
|
29
|
-
readonly SadnessLow: "sadness:low";
|
|
30
|
-
readonly Sadness: "sadness";
|
|
31
|
-
readonly SadnessHigh: "sadness:high";
|
|
32
|
-
readonly SadnessHighest: "sadness:highest";
|
|
33
|
-
readonly CuriosityLowest: "curiosity:lowest";
|
|
34
|
-
readonly CuriosityLow: "curiosity:low";
|
|
35
|
-
readonly Curiosity: "curiosity";
|
|
36
|
-
readonly CuriosityHigh: "curiosity:high";
|
|
37
|
-
readonly CuriosityHighest: "curiosity:highest";
|
|
38
|
-
};
|
|
7
|
+
export type Emotion = string;
|
|
@@ -3,31 +3,3 @@
|
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Emotion = void 0;
|
|
7
|
-
exports.Emotion = {
|
|
8
|
-
AngerLowest: "anger:lowest",
|
|
9
|
-
AngerLow: "anger:low",
|
|
10
|
-
Anger: "anger",
|
|
11
|
-
AngerHigh: "anger:high",
|
|
12
|
-
AngerHighest: "anger:highest",
|
|
13
|
-
PositivityLowest: "positivity:lowest",
|
|
14
|
-
PositivityLow: "positivity:low",
|
|
15
|
-
Positivity: "positivity",
|
|
16
|
-
PositivityHigh: "positivity:high",
|
|
17
|
-
PositivityHighest: "positivity:highest",
|
|
18
|
-
SurpriseLowest: "surprise:lowest",
|
|
19
|
-
SurpriseLow: "surprise:low",
|
|
20
|
-
Surprise: "surprise",
|
|
21
|
-
SurpriseHigh: "surprise:high",
|
|
22
|
-
SurpriseHighest: "surprise:highest",
|
|
23
|
-
SadnessLowest: "sadness:lowest",
|
|
24
|
-
SadnessLow: "sadness:low",
|
|
25
|
-
Sadness: "sadness",
|
|
26
|
-
SadnessHigh: "sadness:high",
|
|
27
|
-
SadnessHighest: "sadness:highest",
|
|
28
|
-
CuriosityLowest: "curiosity:lowest",
|
|
29
|
-
CuriosityLow: "curiosity:low",
|
|
30
|
-
Curiosity: "curiosity",
|
|
31
|
-
CuriosityHigh: "curiosity:high",
|
|
32
|
-
CuriosityHighest: "curiosity:highest",
|
|
33
|
-
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* An array of emotion:level tags.
|
|
6
|
+
*
|
|
7
|
+
* Supported emotions are: anger, positivity, surprise, sadness, and curiosity.
|
|
8
|
+
*
|
|
9
|
+
* Supported levels are: lowest, low, (omit), high, highest.
|
|
10
|
+
*/
|
|
11
|
+
export type EmotionDeprecated = "anger:lowest" | "anger:low" | "anger" | "anger:high" | "anger:highest" | "positivity:lowest" | "positivity:low" | "positivity" | "positivity:high" | "positivity:highest" | "surprise:lowest" | "surprise:low" | "surprise" | "surprise:high" | "surprise:highest" | "sadness:lowest" | "sadness:low" | "sadness" | "sadness:high" | "sadness:highest" | "curiosity:lowest" | "curiosity:low" | "curiosity" | "curiosity:high" | "curiosity:highest";
|
|
12
|
+
export declare const EmotionDeprecated: {
|
|
13
|
+
readonly AngerLowest: "anger:lowest";
|
|
14
|
+
readonly AngerLow: "anger:low";
|
|
15
|
+
readonly Anger: "anger";
|
|
16
|
+
readonly AngerHigh: "anger:high";
|
|
17
|
+
readonly AngerHighest: "anger:highest";
|
|
18
|
+
readonly PositivityLowest: "positivity:lowest";
|
|
19
|
+
readonly PositivityLow: "positivity:low";
|
|
20
|
+
readonly Positivity: "positivity";
|
|
21
|
+
readonly PositivityHigh: "positivity:high";
|
|
22
|
+
readonly PositivityHighest: "positivity:highest";
|
|
23
|
+
readonly SurpriseLowest: "surprise:lowest";
|
|
24
|
+
readonly SurpriseLow: "surprise:low";
|
|
25
|
+
readonly Surprise: "surprise";
|
|
26
|
+
readonly SurpriseHigh: "surprise:high";
|
|
27
|
+
readonly SurpriseHighest: "surprise:highest";
|
|
28
|
+
readonly SadnessLowest: "sadness:lowest";
|
|
29
|
+
readonly SadnessLow: "sadness:low";
|
|
30
|
+
readonly Sadness: "sadness";
|
|
31
|
+
readonly SadnessHigh: "sadness:high";
|
|
32
|
+
readonly SadnessHighest: "sadness:highest";
|
|
33
|
+
readonly CuriosityLowest: "curiosity:lowest";
|
|
34
|
+
readonly CuriosityLow: "curiosity:low";
|
|
35
|
+
readonly Curiosity: "curiosity";
|
|
36
|
+
readonly CuriosityHigh: "curiosity:high";
|
|
37
|
+
readonly CuriosityHighest: "curiosity:highest";
|
|
38
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EmotionDeprecated = void 0;
|
|
7
|
+
exports.EmotionDeprecated = {
|
|
8
|
+
AngerLowest: "anger:lowest",
|
|
9
|
+
AngerLow: "anger:low",
|
|
10
|
+
Anger: "anger",
|
|
11
|
+
AngerHigh: "anger:high",
|
|
12
|
+
AngerHighest: "anger:highest",
|
|
13
|
+
PositivityLowest: "positivity:lowest",
|
|
14
|
+
PositivityLow: "positivity:low",
|
|
15
|
+
Positivity: "positivity",
|
|
16
|
+
PositivityHigh: "positivity:high",
|
|
17
|
+
PositivityHighest: "positivity:highest",
|
|
18
|
+
SurpriseLowest: "surprise:lowest",
|
|
19
|
+
SurpriseLow: "surprise:low",
|
|
20
|
+
Surprise: "surprise",
|
|
21
|
+
SurpriseHigh: "surprise:high",
|
|
22
|
+
SurpriseHighest: "surprise:highest",
|
|
23
|
+
SadnessLowest: "sadness:lowest",
|
|
24
|
+
SadnessLow: "sadness:low",
|
|
25
|
+
Sadness: "sadness",
|
|
26
|
+
SadnessHigh: "sadness:high",
|
|
27
|
+
SadnessHighest: "sadness:highest",
|
|
28
|
+
CuriosityLowest: "curiosity:lowest",
|
|
29
|
+
CuriosityLow: "curiosity:low",
|
|
30
|
+
Curiosity: "curiosity",
|
|
31
|
+
CuriosityHigh: "curiosity:high",
|
|
32
|
+
CuriosityHighest: "curiosity:highest",
|
|
33
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* Configure the various attributes of the generated speech. These controls only for `sonic-3` and have no effect on earlier models.
|
|
7
|
+
*/
|
|
8
|
+
export interface GenerationConfig {
|
|
9
|
+
/** Adjust the volume of the generated speech between 0.5x and 2.0x the original volume (default is 1.0x). Valid values are between 0.5 and 2.0 inclusive. */
|
|
10
|
+
volume?: number;
|
|
11
|
+
/** Adjust the speed of the generated speech between 0.6x and 1.5x the original speed (default is 1.0x). Valid values are between 0.6 and 1.5 inclusive. */
|
|
12
|
+
speed?: number;
|
|
13
|
+
/** Guide the emotion of the generated speech. */
|
|
14
|
+
emotion?: Cartesia.Emotion;
|
|
15
|
+
}
|
|
@@ -10,6 +10,7 @@ export interface GenerationRequest {
|
|
|
10
10
|
voice: Cartesia.TtsRequestVoiceSpecifier;
|
|
11
11
|
language?: Cartesia.SupportedLanguage;
|
|
12
12
|
outputFormat: Cartesia.WebSocketRawOutputFormat;
|
|
13
|
+
generationConfig?: Cartesia.GenerationConfig;
|
|
13
14
|
/**
|
|
14
15
|
* The maximum duration of the audio in seconds. You do not usually need to specify this.
|
|
15
16
|
* If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
|
|
@@ -32,10 +33,10 @@ export interface GenerationRequest {
|
|
|
32
33
|
maxBufferDelayMs?: number;
|
|
33
34
|
/** Whether to flush the context. */
|
|
34
35
|
flush?: boolean;
|
|
35
|
-
/** Whether to return word-level timestamps. */
|
|
36
|
+
/** Whether to return word-level timestamps. If `false` (default), no word timestamps will be produced at all. If `true`, the server will return timestamp events containing word-level timing information. */
|
|
36
37
|
addTimestamps?: boolean;
|
|
37
|
-
/** Whether to return phoneme-level timestamps. */
|
|
38
|
+
/** Whether to return phoneme-level timestamps. If `false` (default), no phoneme timestamps will be produced. If `true`, the server will return timestamp events containing phoneme-level timing information. */
|
|
38
39
|
addPhonemeTimestamps?: boolean;
|
|
39
|
-
/** Whether to use
|
|
40
|
-
|
|
40
|
+
/** Whether to use normalized timestamps (True) or original timestamps (False). */
|
|
41
|
+
useNormalizedTimestamps?: boolean;
|
|
41
42
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface Mp3OutputFormat {
|
|
5
|
+
/** The sample rate of the audio in Hz. Supported sample rates are 8000, 16000, 22050, 24000, 44100, 48000. */
|
|
5
6
|
sampleRate: number;
|
|
6
7
|
/** The bit rate of the audio in bits per second. Supported bit rates are 32000, 64000, 96000, 128000, 192000. */
|
|
7
8
|
bitRate: number;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface RawOutputFormat {
|
|
6
6
|
encoding: Cartesia.RawEncoding;
|
|
7
|
+
/** The sample rate of the audio in Hz. Supported sample rates are 8000, 16000, 22050, 24000, 44100, 48000. */
|
|
7
8
|
sampleRate: number;
|
|
8
9
|
bitRate?: number;
|
|
9
10
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../index";
|
|
5
|
+
export interface SseOutputFormat {
|
|
6
|
+
container: "raw";
|
|
7
|
+
encoding: Cartesia.RawEncoding;
|
|
8
|
+
/** The sample rate of the audio in Hz. Supported sample rates are 8000, 16000, 22050, 24000, 44100, 48000. */
|
|
9
|
+
sampleRate: number;
|
|
10
|
+
}
|
|
@@ -9,6 +9,7 @@ export interface TtsRequest {
|
|
|
9
9
|
voice: Cartesia.TtsRequestVoiceSpecifier;
|
|
10
10
|
language?: Cartesia.SupportedLanguage;
|
|
11
11
|
outputFormat: Cartesia.OutputFormat;
|
|
12
|
+
generationConfig?: Cartesia.GenerationConfig;
|
|
12
13
|
/**
|
|
13
14
|
* The maximum duration of the audio in seconds. You do not usually need to specify this.
|
|
14
15
|
* If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../index";
|
|
5
|
+
export interface TtssseRequest {
|
|
6
|
+
/** The ID of the model to use for the generation. See [Models](/build-with-cartesia/models) for available models. */
|
|
7
|
+
modelId: string;
|
|
8
|
+
transcript: string;
|
|
9
|
+
voice: Cartesia.TtsRequestVoiceSpecifier;
|
|
10
|
+
language?: Cartesia.SupportedLanguage;
|
|
11
|
+
outputFormat: Cartesia.SseOutputFormat;
|
|
12
|
+
generationConfig?: Cartesia.GenerationConfig;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum duration of the audio in seconds. You do not usually need to specify this.
|
|
15
|
+
* If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
|
|
16
|
+
*/
|
|
17
|
+
duration?: number;
|
|
18
|
+
speed?: Cartesia.ModelSpeed;
|
|
19
|
+
/** Whether to return word-level timestamps. If `false` (default), no word timestamps will be produced at all. If `true`, the server will return timestamp events containing word-level timing information. */
|
|
20
|
+
addTimestamps?: boolean;
|
|
21
|
+
/** Whether to return phoneme-level timestamps. If `false` (default), no phoneme timestamps will be produced - if `add_timestamps` is `true`, the produced timestamps will be word timestamps instead. If `true`, the server will return timestamp events containing phoneme-level timing information. */
|
|
22
|
+
addPhonemeTimestamps?: boolean;
|
|
23
|
+
/** Whether to use normalized timestamps (True) or original timestamps (False). */
|
|
24
|
+
useNormalizedTimestamps?: boolean;
|
|
25
|
+
/** Optional context ID for this request. */
|
|
26
|
+
contextId?: Cartesia.ContextId;
|
|
27
|
+
}
|
|
@@ -5,5 +5,6 @@ import * as Cartesia from "../../../index";
|
|
|
5
5
|
export interface WebSocketRawOutputFormat {
|
|
6
6
|
container: "raw";
|
|
7
7
|
encoding: Cartesia.RawEncoding;
|
|
8
|
+
/** The sample rate of the audio in Hz. Supported sample rates are 8000, 16000, 22050, 24000, 44100, 48000. */
|
|
8
9
|
sampleRate: number;
|
|
9
10
|
}
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export type WebSocketRequest =
|
|
6
6
|
/**
|
|
7
|
-
* Use this to generate speech for a transcript.
|
|
8
|
-
* */
|
|
7
|
+
* Use this to generate speech for a transcript. */
|
|
9
8
|
Cartesia.GenerationRequest
|
|
10
9
|
/**
|
|
11
|
-
* Use this to cancel a context, so that no more messages are generated for that context.
|
|
12
|
-
* */
|
|
10
|
+
* Use this to cancel a context, so that no more messages are generated for that context. */
|
|
13
11
|
| Cartesia.CancelContextRequest;
|
|
@@ -6,13 +6,16 @@ export interface WebSocketTtsRequest {
|
|
|
6
6
|
/** The ID of the model to use for the generation. See [Models](/build-with-cartesia/models) for available models. */
|
|
7
7
|
modelId: string;
|
|
8
8
|
outputFormat?: Cartesia.OutputFormat;
|
|
9
|
+
generationConfig?: Cartesia.GenerationConfig;
|
|
9
10
|
transcript?: string;
|
|
10
11
|
voice: Cartesia.TtsRequestVoiceSpecifier;
|
|
11
12
|
duration?: number;
|
|
12
13
|
language?: string;
|
|
14
|
+
/** Whether to return word-level timestamps. If `false` (default), no word timestamps will be produced at all. If `true`, the server will return timestamp events containing word-level timing information. */
|
|
13
15
|
addTimestamps?: boolean;
|
|
16
|
+
/** Whether to return phoneme-level timestamps. If `false` (default), no phoneme timestamps will be produced - if `add_timestamps` is `true`, the produced timestamps will be word timestamps instead. If `true`, the server will return timestamp events containing phoneme-level timing information. */
|
|
14
17
|
addPhonemeTimestamps?: boolean;
|
|
15
|
-
|
|
18
|
+
useNormalizedTimestamps?: boolean;
|
|
16
19
|
continue?: boolean;
|
|
17
20
|
contextId?: string;
|
|
18
21
|
maxBufferDelayMs?: number;
|
|
@@ -19,9 +19,13 @@ export * from "./WebSocketRawOutputFormat";
|
|
|
19
19
|
export * from "./WebSocketRequest";
|
|
20
20
|
export * from "./WebSocketTtsRequest";
|
|
21
21
|
export * from "./TtsRequest";
|
|
22
|
+
export * from "./TtssseRequest";
|
|
22
23
|
export * from "./SupportedLanguage";
|
|
24
|
+
export * from "./GenerationConfig";
|
|
25
|
+
export * from "./Emotion";
|
|
23
26
|
export * from "./OutputFormat";
|
|
24
27
|
export * from "./RawOutputFormat";
|
|
28
|
+
export * from "./SseOutputFormat";
|
|
25
29
|
export * from "./RawEncoding";
|
|
26
30
|
export * from "./WavOutputFormat";
|
|
27
31
|
export * from "./Mp3OutputFormat";
|
|
@@ -32,4 +36,4 @@ export * from "./Controls";
|
|
|
32
36
|
export * from "./Speed";
|
|
33
37
|
export * from "./NumericalSpecifier";
|
|
34
38
|
export * from "./NaturalSpecifier";
|
|
35
|
-
export * from "./
|
|
39
|
+
export * from "./EmotionDeprecated";
|
|
@@ -35,9 +35,13 @@ __exportStar(require("./WebSocketRawOutputFormat"), exports);
|
|
|
35
35
|
__exportStar(require("./WebSocketRequest"), exports);
|
|
36
36
|
__exportStar(require("./WebSocketTtsRequest"), exports);
|
|
37
37
|
__exportStar(require("./TtsRequest"), exports);
|
|
38
|
+
__exportStar(require("./TtssseRequest"), exports);
|
|
38
39
|
__exportStar(require("./SupportedLanguage"), exports);
|
|
40
|
+
__exportStar(require("./GenerationConfig"), exports);
|
|
41
|
+
__exportStar(require("./Emotion"), exports);
|
|
39
42
|
__exportStar(require("./OutputFormat"), exports);
|
|
40
43
|
__exportStar(require("./RawOutputFormat"), exports);
|
|
44
|
+
__exportStar(require("./SseOutputFormat"), exports);
|
|
41
45
|
__exportStar(require("./RawEncoding"), exports);
|
|
42
46
|
__exportStar(require("./WavOutputFormat"), exports);
|
|
43
47
|
__exportStar(require("./Mp3OutputFormat"), exports);
|
|
@@ -48,4 +52,4 @@ __exportStar(require("./Controls"), exports);
|
|
|
48
52
|
__exportStar(require("./Speed"), exports);
|
|
49
53
|
__exportStar(require("./NumericalSpecifier"), exports);
|
|
50
54
|
__exportStar(require("./NaturalSpecifier"), exports);
|
|
51
|
-
__exportStar(require("./
|
|
55
|
+
__exportStar(require("./EmotionDeprecated"), exports);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import { Blob } from "buffer";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import * as core from "../../../../core";
|
|
7
4
|
import * as environments from "../../../../environments";
|
|
5
|
+
import * as core from "../../../../core";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import { Blob } from "buffer";
|
|
8
8
|
import * as Cartesia from "../../../index";
|
|
9
|
+
import * as stream from "stream";
|
|
9
10
|
export declare namespace VoiceChanger {
|
|
10
11
|
interface Options {
|
|
11
12
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
13
|
+
/** Specify a custom URL to connect the client to. */
|
|
14
|
+
baseUrl?: core.Supplier<string>;
|
|
12
15
|
apiKey?: core.Supplier<string | undefined>;
|
|
13
16
|
/** Override the Cartesia-Version header */
|
|
14
17
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -23,6 +26,8 @@ export declare namespace VoiceChanger {
|
|
|
23
26
|
abortSignal?: AbortSignal;
|
|
24
27
|
/** Override the Cartesia-Version header */
|
|
25
28
|
cartesiaVersion?: "2024-06-10";
|
|
29
|
+
/** Additional headers to include in the request. */
|
|
30
|
+
headers?: Record<string, string>;
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
export declare class VoiceChanger {
|
|
@@ -33,7 +38,7 @@ export declare class VoiceChanger {
|
|
|
33
38
|
*
|
|
34
39
|
* This endpoint is priced at 15 characters per second of input audio.
|
|
35
40
|
*/
|
|
36
|
-
bytes(clip: File | fs.ReadStream | Blob, request: Cartesia.VoiceChangerBytesRequest, requestOptions?: VoiceChanger.RequestOptions): Promise<
|
|
41
|
+
bytes(clip: File | fs.ReadStream | Blob, request: Cartesia.VoiceChangerBytesRequest, requestOptions?: VoiceChanger.RequestOptions): Promise<stream.Readable>;
|
|
37
42
|
sse(clip: File | fs.ReadStream | Blob, request: Cartesia.VoiceChangerSseRequest, requestOptions?: VoiceChanger.RequestOptions): Promise<core.Stream<Cartesia.StreamingResponse>>;
|
|
38
43
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
39
44
|
"X-API-Key": string | undefined;
|
|
@@ -49,11 +49,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.VoiceChanger = void 0;
|
|
52
|
-
const url_join_1 = __importDefault(require("url-join"));
|
|
53
|
-
const core = __importStar(require("../../../../core"));
|
|
54
52
|
const environments = __importStar(require("../../../../environments"));
|
|
55
|
-
const
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
56
54
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
55
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
57
57
|
class VoiceChanger {
|
|
58
58
|
constructor(_options = {}) {
|
|
59
59
|
this._options = _options;
|
|
@@ -65,27 +65,29 @@ class VoiceChanger {
|
|
|
65
65
|
*/
|
|
66
66
|
bytes(clip, request, requestOptions) {
|
|
67
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
var _a, _b, _c, _d, _e;
|
|
68
|
+
var _a, _b, _c, _d, _e, _f;
|
|
69
69
|
const _request = yield core.newFormData();
|
|
70
70
|
yield _request.appendFile("clip", clip);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
_request.append("voice[id]", request.voiceId);
|
|
72
|
+
_request.append("output_format[container]", serializers.OutputFormatContainer.jsonOrThrow(request.outputFormatContainer, {
|
|
73
|
+
unrecognizedObjectKeys: "strip",
|
|
74
|
+
}));
|
|
75
|
+
_request.append("output_format[sample_rate]", request.outputFormatSampleRate.toString());
|
|
74
76
|
if (request.outputFormatEncoding != null) {
|
|
75
|
-
|
|
77
|
+
_request.append("output_format[encoding]", serializers.RawEncoding.jsonOrThrow(request.outputFormatEncoding, { unrecognizedObjectKeys: "strip" }));
|
|
76
78
|
}
|
|
77
79
|
if (request.outputFormatBitRate != null) {
|
|
78
|
-
|
|
80
|
+
_request.append("output_format[bit_rate]", request.outputFormatBitRate.toString());
|
|
79
81
|
}
|
|
80
82
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
81
83
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
84
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voice-changer/bytes"),
|
|
83
85
|
method: "POST",
|
|
84
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (
|
|
86
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.7", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
85
87
|
requestType: "file",
|
|
86
88
|
duplex: _maybeEncodedRequest.duplex,
|
|
87
89
|
body: _maybeEncodedRequest.body,
|
|
88
|
-
responseType: "
|
|
90
|
+
responseType: "streaming",
|
|
89
91
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
90
92
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
91
93
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -116,23 +118,25 @@ class VoiceChanger {
|
|
|
116
118
|
}
|
|
117
119
|
sse(clip, request, requestOptions) {
|
|
118
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
var _a, _b, _c, _d, _e;
|
|
121
|
+
var _a, _b, _c, _d, _e, _f;
|
|
120
122
|
const _request = yield core.newFormData();
|
|
121
123
|
yield _request.appendFile("clip", clip);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
_request.append("voice[id]", request.voiceId);
|
|
125
|
+
_request.append("output_format[container]", serializers.OutputFormatContainer.jsonOrThrow(request.outputFormatContainer, {
|
|
126
|
+
unrecognizedObjectKeys: "strip",
|
|
127
|
+
}));
|
|
128
|
+
_request.append("output_format[sample_rate]", request.outputFormatSampleRate.toString());
|
|
125
129
|
if (request.outputFormatEncoding != null) {
|
|
126
|
-
|
|
130
|
+
_request.append("output_format[encoding]", serializers.RawEncoding.jsonOrThrow(request.outputFormatEncoding, { unrecognizedObjectKeys: "strip" }));
|
|
127
131
|
}
|
|
128
132
|
if (request.outputFormatBitRate != null) {
|
|
129
|
-
|
|
133
|
+
_request.append("output_format[bit_rate]", request.outputFormatBitRate.toString());
|
|
130
134
|
}
|
|
131
135
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
132
136
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
133
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
137
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voice-changer/sse"),
|
|
134
138
|
method: "POST",
|
|
135
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (
|
|
139
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.7", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
136
140
|
requestType: "file",
|
|
137
141
|
duplex: _maybeEncodedRequest.duplex,
|
|
138
142
|
body: _maybeEncodedRequest.body,
|