Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cartesia/cartesia-js

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cartesia/cartesia-js - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0-alpha.0

dist/chunk-5SBAQNWQ.js

3

dist/index.d.ts
export { Cartesia, Cartesia as default } from './lib/index.js';
export { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, 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, 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';

@@ -8,4 +8,5 @@ export { default as Source } from './tts/source.js';

import './lib/client.js';
import './voice-changer/index.js';
import './voices/index.js';
import 'emittery';
import 'partysocket';

@@ -1,20 +0,21 @@

import "./chunk-FXPGR372.js";
import {
Player
} from "./chunk-CSOXALSC.js";
import {
Cartesia
} from "./chunk-4GEDAGVY.js";
import "./chunk-CWIJUBG6.js";
import "./chunk-MUPVAEL7.js";
} from "./chunk-YUGIYUMT.js";
import "./chunk-EYRYHK3X.js";
import {
WebSocket
} from "./chunk-L3OMQKWL.js";
import "./chunk-6PWLZAMS.js";
import "./chunk-2BFEKY3F.js";
} from "./chunk-HQOC2S6C.js";
import "./chunk-5SBAQNWQ.js";
import {
Player
} from "./chunk-MNOPO7G6.js";
import "./chunk-VCZESWYA.js";
import {
Source
} from "./chunk-VVDJR3OA.js";
import "./chunk-WIFMLPT5.js";
} from "./chunk-I5YVYTNK.js";
import "./chunk-RJICGVPL.js";
import "./chunk-FXPGR372.js";
import "./chunk-WLEVU3HN.js";
import "./chunk-FLWYXP5Z.js";
import "./chunk-2BFEKY3F.js";
import "./chunk-NJDRWDQ3.js";
export {

@@ -21,0 +22,0 @@ Cartesia,

import {
Client
} from "../chunk-6PWLZAMS.js";
} from "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {
Client
};

@@ -6,3 +6,3 @@ import {

} from "../chunk-2BFEKY3F.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {

@@ -9,0 +9,0 @@ BASE_URL,

import TTS from '../tts/index.js';
import { ClientOptions } from '../types/index.js';
import VoiceChanger from '../voice-changer/index.js';
import Voices from '../voices/index.js';

@@ -13,2 +14,3 @@ import { Client } from './client.js';

voices: Voices;
voiceChanger: VoiceChanger;
constructor(options?: ClientOptions);

@@ -15,0 +17,0 @@ }

import {
Cartesia
} from "../chunk-4GEDAGVY.js";
import "../chunk-CWIJUBG6.js";
import "../chunk-MUPVAEL7.js";
import "../chunk-L3OMQKWL.js";
import "../chunk-6PWLZAMS.js";
} from "../chunk-YUGIYUMT.js";
import "../chunk-EYRYHK3X.js";
import "../chunk-HQOC2S6C.js";
import "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-RJICGVPL.js";
import "../chunk-WLEVU3HN.js";
import "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {
Cartesia
};
import {
Player
} from "../chunk-CSOXALSC.js";
import {
Cartesia
} from "../chunk-4GEDAGVY.js";
import "../chunk-CWIJUBG6.js";
} from "../chunk-YUGIYUMT.js";
import "../chunk-EYRYHK3X.js";
import "../chunk-HQOC2S6C.js";
import "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-RJICGVPL.js";
import {
pingServer
} from "../chunk-3FL2SNIR.js";
import "../chunk-MUPVAEL7.js";
import "../chunk-L3OMQKWL.js";
import "../chunk-6PWLZAMS.js";
} from "../chunk-LKKWJLUG.js";
import "../chunk-WLEVU3HN.js";
import "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import {
Player
} from "../chunk-MNOPO7G6.js";
import "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import {
__async
} from "../chunk-WIFMLPT5.js";
} from "../chunk-NJDRWDQ3.js";

@@ -21,0 +22,0 @@ // src/react/index.ts

import {
pingServer
} from "../chunk-3FL2SNIR.js";
import "../chunk-WIFMLPT5.js";
} from "../chunk-LKKWJLUG.js";
import "../chunk-NJDRWDQ3.js";
export {
pingServer
};
import { Client } from '../lib/client.js';
import { WebSocketOptions } from '../types/index.js';
import { WebSocketOptions, BytesRequest } from '../types/index.js';
import WebSocket from './websocket.js';

@@ -15,4 +15,11 @@ import 'emittery';

websocket(options: WebSocketOptions): WebSocket;
/**
* Generate audio bytes from text.
*
* @param options - The options for the request.
* @returns {Promise<ArrayBuffer>} A promise that resolves to an ArrayBuffer containing the audio bytes.
*/
bytes(options: BytesRequest): Promise<ArrayBuffer>;
}
export { TTS as default };
import {
TTS
} from "../chunk-MUPVAEL7.js";
import "../chunk-L3OMQKWL.js";
import "../chunk-6PWLZAMS.js";
} from "../chunk-EYRYHK3X.js";
import "../chunk-HQOC2S6C.js";
import "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {
TTS as default
};
import {
Player
} from "../chunk-MNOPO7G6.js";
import "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
} from "../chunk-CSOXALSC.js";
import "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-NJDRWDQ3.js";
export {
Player as default
};
import {
ENCODING_MAP,
Source
} from "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
} from "../chunk-I5YVYTNK.js";
import "../chunk-NJDRWDQ3.js";
export {

@@ -7,0 +7,0 @@ ENCODING_MAP,

@@ -10,5 +10,5 @@ import {

playAudioBuffer
} from "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
} from "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-NJDRWDQ3.js";
export {

@@ -15,0 +15,0 @@ base64ToArray,

@@ -36,14 +36,14 @@ import * as emittery from 'emittery';

} & emittery.OmnipresentEventData)[Name]) => void | Promise<void>) => emittery.UnsubscribeFunction;
off: <Name_1 extends "timestamps" | keyof emittery.OmnipresentEventData | "message">(eventName: Name_1 | readonly Name_1[], listener: (eventData: ({
off: <Name extends "timestamps" | keyof emittery.OmnipresentEventData | "message">(eventName: Name | readonly Name[], listener: (eventData: ({
message: string;
timestamps: WordTimestamps;
} & emittery.OmnipresentEventData)[Name_1]) => void | Promise<void>) => void;
once: <Name_2 extends "timestamps" | keyof emittery.OmnipresentEventData | "message">(eventName: Name_2 | readonly Name_2[]) => emittery.EmitteryOncePromise<({
} & emittery.OmnipresentEventData)[Name]) => void | Promise<void>) => void;
once: <Name extends "timestamps" | keyof emittery.OmnipresentEventData | "message">(eventName: Name | readonly Name[]) => emittery.EmitteryOncePromise<({
message: string;
timestamps: WordTimestamps;
} & emittery.OmnipresentEventData)[Name_2]>;
events: <Name_3 extends "timestamps" | "message">(eventName: Name_3 | readonly Name_3[]) => AsyncIterableIterator<{
} & emittery.OmnipresentEventData)[Name]>;
events: <Name extends "timestamps" | "message">(eventName: Name | readonly Name[]) => AsyncIterableIterator<{
message: string;
timestamps: WordTimestamps;
}[Name_3]>;
}[Name]>;
source: Source;

@@ -50,0 +50,0 @@ };

import {
WebSocket
} from "../chunk-L3OMQKWL.js";
import "../chunk-6PWLZAMS.js";
} from "../chunk-HQOC2S6C.js";
import "../chunk-5SBAQNWQ.js";
import "../chunk-I5YVYTNK.js";
import "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import "../chunk-VCZESWYA.js";
import "../chunk-VVDJR3OA.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {
WebSocket as default
};

@@ -44,2 +44,3 @@ import emittery__default from 'emittery';

};
type BytesRequest = Omit<StreamRequest, "continue" | "add_timestamps" | "context_id">;
type ContinueRequest = StreamRequest & {

@@ -91,2 +92,22 @@ context_id: string;

};
type VoiceChangerOptions = {
clip: File;
voice: {
id: string;
};
output_format: {
container: "mp3";
bit_rate: number;
sample_rate: number;
} | {
container: "wav";
encoding: Encoding;
sample_rate: number;
bit_rate: number;
} | {
container: "raw";
encoding: Encoding;
sample_rate: number;
};
};
type LocalizeOptions = {

@@ -123,2 +144,5 @@ mode: "embedding";

};
type VoiceChangerBytesResponse = {
buffer: ArrayBuffer;
};
type LocalizeResponse = {

@@ -144,2 +168,2 @@ embedding: number[];

export type { Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
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 };
import {
Voices
} from "../chunk-CWIJUBG6.js";
import "../chunk-6PWLZAMS.js";
} from "../chunk-RJICGVPL.js";
import "../chunk-FLWYXP5Z.js";
import "../chunk-2BFEKY3F.js";
import "../chunk-WIFMLPT5.js";
import "../chunk-NJDRWDQ3.js";
export {
Voices as default
};

@@ -7,3 +7,3 @@ {

},
"version": "1.1.0",
"version": "1.2.0-alpha.0",
"description": "Client for the Cartesia API.",

@@ -31,3 +31,4 @@ "type": "module",

"human-id": "^4.1.1",
"partysocket": "^1.0.1"
"partysocket": "^1.0.1",
"react": "^18.3.1"
},

@@ -39,20 +40,12 @@ "publishConfig": {

"build": "tsup src/ --format cjs,esm --dts",
"dev": "bun run build -- --watch"
"dev": "bun run build -- --watch",
"release": "rm -rf dist && bun run build && bun publish"
},
"peerDependencies": {
"react": "^18.2.0",
"@types/react": "^18.2.58"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"@types/react": {
"optional": true
}
},
"devDependencies": {
"@repo/config-typescript": "workspace:*",
"tsup": "^8.0.2"
"@biomejs/biome": "^1.9.4",
"@types/node": "^22.7.9",
"@types/react": "^18.3.12",
"tsup": "^8.0.2",
"typescript": "^5.6.3"
}
}
import TTS from "../tts";
import type { ClientOptions } from "../types";
import VoiceChanger from "../voice-changer";
import Voices from "../voices";

@@ -9,2 +10,3 @@ import { Client } from "./client";

voices: Voices;
voiceChanger: VoiceChanger;

@@ -16,3 +18,4 @@ constructor(options: ClientOptions = {}) {

this.voices = new Voices(options);
this.voiceChanger = new VoiceChanger(options);
}
}
import { Client } from "../lib/client";
import type { WebSocketOptions } from "../types";
import type { BytesRequest, WebSocketOptions } from "../types";
import WebSocket from "./websocket";

@@ -17,2 +17,17 @@

}
/**
* Generate audio bytes from text.
*
* @param options - The options for the request.
* @returns {Promise<ArrayBuffer>} A promise that resolves to an ArrayBuffer containing the audio bytes.
*/
async bytes(options: BytesRequest): Promise<ArrayBuffer> {
const response = await this._fetch("/tts/bytes", {
method: "POST",
body: JSON.stringify(options),
});
return response.arrayBuffer();
}
}

@@ -59,2 +59,7 @@ import type Emittery from "emittery";

export type BytesRequest = Omit<
StreamRequest,
"continue" | "add_timestamps" | "context_id"
>;
export type ContinueRequest = StreamRequest & {

@@ -130,2 +135,24 @@ context_id: string;

export type VoiceChangerOptions = {
clip: File;
voice: { id: string }; // match VoiceSpecifier shape, but only id is supported for now
output_format:
| {
container: "mp3";
bit_rate: number;
sample_rate: number;
}
| {
container: "wav";
encoding: Encoding;
sample_rate: number;
bit_rate: number;
}
| {
container: "raw";
encoding: Encoding;
sample_rate: number;
};
};
export type LocalizeOptions = {

@@ -172,2 +199,6 @@ mode: "embedding";

export type VoiceChangerBytesResponse = {
buffer: ArrayBuffer;
};
export type LocalizeResponse = {

@@ -174,0 +205,0 @@ embedding: number[];

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc