[go: up one dir, main page]

Skip to content

pathrom/elevenlabs-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eleven Labs

Eleven Labs Node

Eleven Labs NodeJS package for converting text to speech!

GitHub Contributors Issues GitHub pull requests

Report Bug · Request Feature

Drop us a ⭐ on GitHub to help the project improve!

Stars

About

This is an open source Eleven Labs NodeJS package for converting text to speech using the Eleven Labs API.

Features

Function
Parameters Endpoint
textToSpeech (apiKey, voiceID, fileName, textInput, stability, similarityBoost, modelId) /v1/text-to-speech/{voice_id}
textToSpeechStream (apiKey, voiceID, textInput, stability, similarityBoost, modelId) /v1/text-to-speech/{voice_id}/stream
getVoices (apiKey) /v1/voices
getDefaultVoiceSettings N/A /v1/voices/settings/default
getVoiceSettings (apiKey, voiceID) /v1/voices/{voice_id}/settings
getVoice (apiKey, voiceID) /v1/voices/{voice_id}
deleteVoice (apiKey, voiceID) /v1/voices/{voice_id}
editVoiceSettings (apiKey, voiceID, stability, similarityBoost) /v1/voices/{voice_id}/settings/edit

Requirements

Get Started

To install the Elevenlabs package, run the following command:

npm install elevenlabs-node

Usage

Getting voice details.

const voice = require("elevenlabs-node");

const apiKey = "0e2c037kl8561005671b1de345s8765c"; // Your API key from Elevenlabs
const voiceID = "pNInz6obpgDQGcFmaJgB"; // The ID of the voice you want to get

const voiceResponse = voice.getVoice(apiKey, voiceID).then((res) => {
  console.log(res);
});

Generating an audio file from text

const voice = require("elevenlabs-node");
const fs = require("fs-extra");

const apiKey = "0e2c037kl8561005671b1de345s8765c"; // Your API key from Elevenlabs
const voiceID = "pNInz6obpgDQGcFmaJgB"; // The ID of the voice you want to get
const fileName = "audio.mp3"; // The name of your audio file
const textInput = "mozzy is cool"; // The text you wish to convert to speech

voice.textToSpeech(apiKey, voiceID, fileName, textInput).then((res) => {
  console.log(res);
});

Generating an audio stream from text

const voice = require("elevenlabs-node");
const fs = require("fs-extra");

const apiKey = "0e2c037kl8561005671b1de345s8765c"; // Your API key from Elevenlabs
const voiceID = "pNInz6obpgDQGcFmaJgB"; // The ID of the voice you want to get
const fileName = "audio.mp3"; // The name of your audio file
const textInput = "mozzy is cool"; // The text you wish to convert to speech

voice.textToSpeechStream(apiKey, voiceID, textInput).then((res) => {
  res.pipe(fs.createWriteStream(fileName));
});

Contributing

Contributions are welcome :)

Read our CONTRIBUTING.md to learn more.

About

Eleven Labs text to speech package for NodeJS.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%