@cartesia/cartesia-js
Advanced tools
Comparing version 1.2.1 to 1.2.2-alpha.0
export { Cartesia, Cartesia as default } from './lib/index.js'; | ||
export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js'; | ||
export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js'; | ||
export { default as WebPlayer } from './tts/player.js'; | ||
@@ -4,0 +4,0 @@ export { default as Source } from './tts/source.js'; |
@@ -6,3 +6,3 @@ import { | ||
Cartesia | ||
} from "./chunk-YUGIYUMT.js"; | ||
} from "./chunk-MGVQHO25.js"; | ||
import "./chunk-EYRYHK3X.js"; | ||
@@ -16,3 +16,3 @@ import { | ||
} from "./chunk-I5YVYTNK.js"; | ||
import "./chunk-RJICGVPL.js"; | ||
import "./chunk-62LXGS65.js"; | ||
import "./chunk-FXPGR372.js"; | ||
@@ -19,0 +19,0 @@ import "./chunk-WLEVU3HN.js"; |
import { | ||
Cartesia | ||
} from "../chunk-YUGIYUMT.js"; | ||
} from "../chunk-MGVQHO25.js"; | ||
import "../chunk-EYRYHK3X.js"; | ||
@@ -8,3 +8,3 @@ import "../chunk-HQOC2S6C.js"; | ||
import "../chunk-I5YVYTNK.js"; | ||
import "../chunk-RJICGVPL.js"; | ||
import "../chunk-62LXGS65.js"; | ||
import "../chunk-WLEVU3HN.js"; | ||
@@ -11,0 +11,0 @@ import "../chunk-FLWYXP5Z.js"; |
@@ -5,4 +5,7 @@ import { | ||
import { | ||
pingServer | ||
} from "../chunk-LKKWJLUG.js"; | ||
import { | ||
Cartesia | ||
} from "../chunk-YUGIYUMT.js"; | ||
} from "../chunk-MGVQHO25.js"; | ||
import "../chunk-EYRYHK3X.js"; | ||
@@ -12,6 +15,3 @@ import "../chunk-HQOC2S6C.js"; | ||
import "../chunk-I5YVYTNK.js"; | ||
import "../chunk-RJICGVPL.js"; | ||
import { | ||
pingServer | ||
} from "../chunk-LKKWJLUG.js"; | ||
import "../chunk-62LXGS65.js"; | ||
import "../chunk-WLEVU3HN.js"; | ||
@@ -18,0 +18,0 @@ import "../chunk-FLWYXP5Z.js"; |
@@ -91,2 +91,10 @@ import emittery__default from 'emittery'; | ||
}; | ||
type HifiCloneOptions = CloneOptions & { | ||
name: string; | ||
description: string; | ||
language: Language; | ||
model_id: string; | ||
transcript?: string; | ||
base_voice_id?: string; | ||
}; | ||
type VoiceChangerOptions = { | ||
@@ -166,2 +174,2 @@ clip: File; | ||
export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps }; | ||
export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps }; |
import { Client } from '../lib/client.js'; | ||
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.js'; | ||
import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, HifiCloneOptions, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.js'; | ||
import 'emittery'; | ||
@@ -11,2 +11,3 @@ | ||
clone(options: CloneOptions): Promise<CloneResponse>; | ||
hifiClone(options: HifiCloneOptions): Promise<Voice>; | ||
mix(options: MixVoicesOptions): Promise<MixVoicesResponse>; | ||
@@ -13,0 +14,0 @@ localize(options: LocalizeOptions): Promise<LocalizeResponse>; |
import { | ||
Voices | ||
} from "../chunk-RJICGVPL.js"; | ||
} from "../chunk-62LXGS65.js"; | ||
import "../chunk-FLWYXP5Z.js"; | ||
@@ -5,0 +5,0 @@ import "../chunk-2BFEKY3F.js"; |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.2.1", | ||
"version": "1.2.2-alpha.0", | ||
"description": "Client for the Cartesia API.", | ||
@@ -10,0 +10,0 @@ "type": "module", |
@@ -134,2 +134,11 @@ import type Emittery from "emittery"; | ||
export type HifiCloneOptions = CloneOptions & { | ||
name: string; | ||
description: string; | ||
language: Language; | ||
model_id: string; | ||
transcript?: string; | ||
base_voice_id?: string; | ||
}; | ||
export type VoiceChangerOptions = { | ||
@@ -136,0 +145,0 @@ clip: File; |
@@ -6,2 +6,3 @@ import { Client } from "../lib/client"; | ||
CreateVoice, | ||
HifiCloneOptions, | ||
LocalizeOptions, | ||
@@ -60,2 +61,41 @@ LocalizeResponse, | ||
async hifiClone(options: HifiCloneOptions): Promise<Voice> { | ||
if (options.mode !== "clip") { | ||
throw new Error("Invalid mode for hifiClone()"); | ||
} | ||
const formData = new FormData(); | ||
formData.append("clip", options.clip); | ||
formData.append("name", options.name); | ||
formData.append("description", options.description); | ||
formData.append("language", options.language); | ||
formData.append("model_id", options.model_id); | ||
if (options.enhance !== undefined) { | ||
formData.append("enhance", options.enhance.toString()); | ||
} | ||
if (options.transcript) { | ||
formData.append("transcript", options.transcript); | ||
} | ||
if (options.base_voice_id) { | ||
formData.append("base_voice_id", options.base_voice_id); | ||
} | ||
const response = await this._fetch("/voices/clone/hifi", { | ||
method: "POST", | ||
body: formData, | ||
}); | ||
if (!response.ok) { | ||
if (response.headers.get("content-type")?.includes("application/json")) { | ||
const errorData = await response.json(); | ||
throw new Error(errorData.message || "HiFi clone failed"); | ||
} | ||
const errorText = await response.text(); | ||
throw new Error(errorText || "HiFi clone failed"); | ||
} | ||
const data = await response.json(); | ||
return data as Voice; | ||
} | ||
async mix(options: MixVoicesOptions): Promise<MixVoicesResponse> { | ||
@@ -62,0 +102,0 @@ const response = await this._fetch("/voices/mix", { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309618
8531
2
9
1