Este é um pacote de nodejs de código aberto para o texto do Elevenlabs.io para a API de fala. Você pode encontrar o documento oficial da API aqui: https://api.elevenlabs.io/docs
Se você gosta deste projeto, considere estrelado . As estrelas são uma maneira de mostrar apreço e interesse neste projeto. E quem sabe, posso estar mais inclinado a melhorá -lo ainda mais.
Se você usa este projeto, aprendeu algo com ele ou apenas assim, considere apoiá-lo comprando um café para mim, para que eu possa dedicar mais tempo em projetos de código aberto como este :)
| Método | Parâmetros | Endpoint | Método HTTP |
|---|---|---|---|
textToSpeech() | voiceId , text , modelId , voiceSettings | /v1/text-to-speech/{voice_id}/stream | PUBLICAR |
getModels() | N / D | /v1/models | PEGAR |
getVoices() | N / D | /v1/voices | PEGAR |
getDefaultVoiceSettings() | N / D | /v1/voices/settings/default | PEGAR |
getVoiceSettings() | voiceId | /v1/voices/{voiceId}/settings | PEGAR |
getVoice() | voiceId , withSettings | /v1/voices/{voiceId} | PEGAR |
deleteVoice() | voiceId | /v1/voices/{voiceId} | EXCLUIR |
editVoiceSettings() | voiceId , voiceSettings | /v1/voices/{voiceId}/settings/edit | PUBLICAR |
getUserSubscription() | N / D | /v1/user/subscription | PEGAR |
getUser() | N / D | /v1/user | PEGAR |
| Parâmetro | Tipo | Descrição | Obrigatório | Padrão |
|---|---|---|---|---|
| VoiceID | Corda | O ID da voz para usar. Você pode obter uma lista de vozes disponíveis usando getVoices() . | Sim | N / D |
| texto | Corda | O texto para converter para a fala. | Sim | N / D |
| ModelId | Corda | O ID do modelo a ser usado. Você pode obter uma lista de modelos disponíveis usando getModels() . | Não | eleven_multilingual_v2 |
| Voicesettings | Objeto | As configurações a serem usadas para a voz. | Não | {stability: 0.95, similarity_boost: 0.75, style: 0.06, use_speaker_boost: true} |
| Parâmetro | Tipo | Descrição | Padrão |
|---|---|---|---|
| estabilidade | Flutuador | A estabilidade da voz. | 0,95 |
| similarity_boost | Flutuador | O aumento da similaridade da voz. | 0,75 |
| estilo | Flutuador | O estilo da voz. | 0,06 |
| use_speaker_boost | Booleano | Se deve usar o aumento do alto -falante ou não. | verdadeiro |
npm i elevenlabs-js .const elevenLabs = require('elevenlabs-js') .elevenLabs.setApiKey('YOUR_API_KEY') .Gerar um arquivo de texto para o arquivo de áudio de fala. Você pode salvar o arquivo ou obter o tubo e fazer o que quiser com ele.
const elevenLabs = require ( 'elevenlabs-js' ) ;
const fs = require ( "fs" ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . textToSpeech ( "YOUR_VOICE_ID" , "Hello World!" , "elevenlabs_multilingual_v2" , {
stability : 0.95 ,
similarity_boost : 0.75 ,
style : 0.06 ,
use_speaker_boost : true
} ) . then ( async ( res ) => {
// You can save the file
await res . saveFile ( "test.mp3" )
// Or get the pipe and do whatever you want with it (like streaming it to the client)
const pipe = await res . pipe ;
pipe ( fs . createWriteStream ( "test-with-pipe.mp3" ) ) ;
} ) ;Obtenha uma lista de modelos disponíveis.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getModels ( ) . then ( ( res ) => {
console . log ( "models" , res ) ;
} ) ;Obtenha uma lista de vozes disponíveis.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoices ( ) . then ( ( res ) => {
console . log ( "voices" , res ) ;
} ) ;Obtenha as configurações de voz padrão.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getDefaultVoiceSettings ( ) . then ( ( res ) => {
console . log ( "default voice settings" , res ) ;
} ) ;Obtenha as configurações de voz de uma voz.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoiceSettings ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice settings" , res ) ;
} ) ;Obtenha uma voz.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoice ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice" , res ) ;
} ) ;Exclua uma voz.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . deleteVoice ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice" , res ) ;
} ) ;Edite as configurações de voz de uma voz.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . editVoiceSettings ( "YOUR_VOICE_ID" , {
stability : 0.95 ,
similarity_boost : 0.75 ,
style : 0.06 ,
use_speaker_boost : true
} ) . then ( ( res ) => {
console . log ( "voice settings" , res ) ;
} ) ;Obtenha as informações de assinatura do usuário.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getUserSubscription ( ) . then ( ( res ) => {
console . log ( "user subscription" , res ) ;
} ) ;Obtenha as informações do usuário.
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getUser ( ) . then ( ( res ) => {
console . log ( "user" , res ) ;
} ) ; Além disso, você pode encontrar os outros idiomas deste pacote aqui:
Este projeto está licenciado sob a licença do MIT - consulte o arquivo de licença para obter detalhes.