You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

tts-ai

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tts-ai

A project template to bootstrap NPM package with Typescript

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
1
-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

tts-ai

Build states Coverage

Description

The Text-to-Speech Library provides a simple unified interface for generating high-quality speech audio using top text-to-speech providers like OpenAI, Google Cloud, and ElevenLabs.

With just a few lines of code, you can produce natural human-like voice audio for your applications and products.

Features

  • Unified API for multiple TTS providers
  • Generate audio from text with speak() method
  • Split long text into chunks automatically
  • Switch voices and models easily
  • Save generated audio to file
  • Seamlessly concatenate audio fragments
  • Handles provider authentication
  • MIT license

Getting Started

Install

pnpm add tts-ai

Usage

Without .env file

import { TtsOpenAI } from 'tts-ai';

const uploadToS3 = (audio: ArrayBuffer) => {
  // upload
};
const tts = new TtsOpenAI({
  apiKey: 'YOUR_API_KEY',
  uploadHandler: uploadToS3,
});

await tts.speak('Hello world');
await tts.upload();

With .env file

OpenAi_TTS_API_KEY = YOUR_API_KEY

import { TtsOpenAI } from 'tts-ai';

const tts = new TtsOpenAI();

await tts.speak('Hello world');
await tts.save();

See documentation for full usage details.

Providers

The library supports the following text-to-speech providers:

  • OpenAI
  • Google Cloud
  • ElevenLabs

Contributing

Contributions are welcome!

License

This project is licensed under the MIT license.

Keywords

text-to-speech

FAQs

Package last updated on 21 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts