#how to add voice library voices using node js?

1 messages · Page 1 of 1 (latest)

pale estuaryBOT
#
AI-generated Answer for darkdare_devil

To add voices from the Voice Library using Node.js, you can use the ElevenLabs API. Here's a basic example of how you can retrieve and add voices using the ElevenLabs client in Node.js:

const { ElevenLabsClient } = require("elevenlabs");

const client = new ElevenLabsClient({
  apiKey: "YOUR_API_KEY"
});

async function addVoiceFromLibrary(voiceId) {
  try {
    // Retrieve the voice details from the library
    const voice = await client.voices.get(voiceId);
    console.log('Voice Details:', voice);

    // Add the voice to your account
    await client.voices.addToMyVoices(voiceId);
    console.log('Voice added to My Voices');
  } catch (error) {
    console.error('Error adding voice:', error);
  }
}

// Replace 'VOICE_ID' with the actual ID of the voice you want to add
addVoiceFromLibrary('VOICE_ID');

Make sure to replace "YOUR_API_KEY" with your actual API key and 'VOICE_ID' with the ID of the voice you want to add from the Voice Library. This script retrieves the voice details and adds it to your "My Voices" section.

halcyon chasm
#

umm it says
S G:\Elevenlabs Api> node index.js
Error adding voice: ElevenLabsError: Status code: 400
Body: {
"detail": {
"status": "voice_not_found",
"message": "A voice for the voice_id 90ipbRoKi4CpHXvKVtl0 was not found."
}
}
at Voices.<anonymous> (G:\Elevenlabs Api\node_modules\elevenlabs\api\resources\voices\client\Client.js:258:31)
at Generator.next (<anonymous>)
at fulfilled (G:\Elevenlabs Api\node_modules\elevenlabs\api\resources\voices\client\Client.js:31:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
statusCode: 400,
body: {
detail: {
status: 'voice_not_found',
message: 'A voice for the voice_id 90ipbRoKi4CpHXvKVtl0 was not found.'
}
}
}
but it exists

pale estuaryBOT
#
AI-generated Answer for darkdare_devil

The error message "voice_not_found" indicates that the voice ID you are using is incorrect or not recognized by the system. Here are a few steps you can take to resolve this issue:

  1. Verify the Voice ID: Double-check the voice ID you are using to ensure it is correct. You can list available voices using the API to confirm the voice ID.

  2. Check My Voices: Make sure the voice is added to your account under "My Voices." If it's a community or custom voice, it needs to be added to your account first.

  3. Use a Default Voice ID: If you're unsure about the voice ID, try using a default voice ID like 'EXAVITQu4vr4xnSDxMaL' to see if the issue persists.

  4. API Key and Account: Ensure your API key is correctly set up and linked to your account. You can verify this by generating a short sentence using the text-to-speech endpoint and checking if it appears in your account's history tab.

If the problem continues, you might want to review your code or reach out for further assistance.

halcyon chasm
#

i want to add community voice to my own lab. how can i?