Skip to main content
POST
/
api
/
v2
/
voice-clones
/
preview
Generate Voice Preview
curl --request POST \
  --url https://api.buena.ai/api/v2/voice-clones/preview \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "voiceId": "<string>",
  "text": "<string>"
}'
Content-Type: audio/mpeg
Content-Length: 99328
Content-Disposition: attachment; filename="preview.mp3"
Generate a preview audio sample using one of your voice clones. This allows you to test voice quality and settings before using the voice clone in LinkedIn messages or other applications.
Requires the voice:preview permission.

Request

Authorization
string
required
Bearer token with your API key that has voice:preview permission (e.g., “Bearer bna-your-api-key”)
Content-Type
string
required
Must be application/json

Body Parameters

voiceId
string
required
The ID of the voice clone to use for preview generation
text
string
required
Text to synthesize into speech (1-500 characters)

Examples

Basic Voice Preview

curl -X POST "https://api.buena.ai/api/v2/voice-clones/preview" \
  -H "Authorization: Bearer bna-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "voiceId": "pNInz6obpgDQGcFmaJgB",
    "text": "Hello! This is a test of my voice clone. How does it sound?"
  }' \
  --output preview.mp3

Advanced Preview with Custom Settings

curl -X POST "https://api.buena.ai/api/v2/voice-clones/preview" \
  -H "Authorization: Bearer bna-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "voiceId": "pNInz6obpgDQGcFmaJgB",
    "text": "This is a test with my voice clone for maximum clarity and stability."
  }' \
  --output preview.mp3

Response

The response is the audio file binary data with Content-Type: audio/mpeg No JSON response is returned - the endpoint streams the audio file directly for immediate playback or download.
Content-Type: audio/mpeg
Content-Length: 99328
Content-Disposition: attachment; filename="preview.mp3"

Preview Guidelines

Text Recommendations

  • Short test: 10-30 words for quick quality check
  • Medium test: 50-100 words for comprehensive evaluation
  • Full test: 100-500 words for complete voice assessment
  • Avoid: Very short texts (under 5 words) may not showcase voice quality
For LinkedIn Outreach:
"Hi [Name], I hope you're having a great week! I came across your profile and was impressed by your experience in [industry]. I'd love to connect and share some insights that might be valuable for your work."
For General Testing:
"This is a test of my voice clone quality. I'm checking for naturalness, clarity, and overall sound. The voice should sound smooth and professional."
For Emotional Range:
"I'm excited to share this opportunity with you! It's been an amazing journey, and I believe this could be incredibly valuable. What do you think?"
Listen for:
  • Naturalness: Does it sound human and conversational?
  • Clarity: Are words pronounced clearly?
  • Consistency: Is the voice stable throughout?
  • Emotion: Does it convey the intended tone?
  • Similarity: Does it match your original voice?

Voice Settings Optimization

SettingLow (0.0-0.3)Medium (0.4-0.7)High (0.8-1.0)
StabilityMore expressive, variableBalanced expressionVery consistent, robotic
ClarityMore natural, may varyGood balanceMaximum similarity, clear
Speaker BoostDisabled-Enabled
{
  "linkedin_professional": {
    "stability": 0.6,
    "clarity": 0.8,
    "use_speaker_boost": true
  },
  "sales_energetic": {
    "stability": 0.4,
    "clarity": 0.7,
    "use_speaker_boost": true
  },
  "casual_friendly": {
    "stability": 0.5,
    "clarity": 0.6,
    "use_speaker_boost": false
  }
}

Error Responses

Voice Clone Not Found (404)

{
  "success": false,
  "error": "Voice not found or not accessible",
  "details": "The specified voice ID does not exist or you don't have access to it"
}

Text Too Long (400)

{
  "success": false,
  "error": "Text too long",
  "details": "Text exceeds maximum length of 500 characters"
}

Voice Generation Failed (500)

{
  "success": false,
  "error": "Voice generation failed",
  "details": "Failed to generate voice preview. Please try again."
}

Integration Examples

Voice Quality Testing Workflow

async function testVoiceQuality(voiceId) {
  const testTexts = [
    "Hello, this is a quick test.",
    "Hi there! I hope you're having a fantastic day. I wanted to reach out because I saw your impressive work at your company.",
    "I'm excited about this opportunity and would love to discuss it further. When might be a good time to chat?",
  ];

  const results = [];

  for (const text of testTexts) {
    try {
      const response = await fetch(
        "https://api.buena.ai/api/v2/voice-clones/preview",
        {
          method: "POST",
          headers: {
            Authorization: "Bearer bna-your-api-key",
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            voiceId: voiceId,
            text: text,
          }),
        }
      );

      const audioBlob = await response.blob();
      const audioUrl = URL.createObjectURL(audioBlob);

      results.push({
        text: text,
        audioUrl: audioUrl,
        size: audioBlob.size,
      });

      console.log(`✅ Generated preview for: "${text.substring(0, 30)}..."`);
    } catch (error) {
      console.error(`❌ Failed to generate preview: ${error.message}`);
    }
  }

  return results;
}

Next Steps

I