Package Exports
- elevenlabs-node
- elevenlabs-node/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (elevenlabs-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Eleven Labs Node
Eleven Labs NodeJS package for converting text to speech!
Drop us a ⭐ on GitHub to help the project improve!
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');
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');
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.