Simplify ElevenLabs payload and set Rachel as default voice
This commit is contained in:
@@ -57,16 +57,26 @@ echo "\n--- Generating Speech with ElevenLabs ---\n";
|
||||
$testText = "مرحباً بك! أنا مساعدك الذكي من نبيه، كيف يمكنني مساعدتك اليوم؟";
|
||||
echo "Text to generate: \"{$testText}\"\n";
|
||||
|
||||
// Test general authentication by querying ElevenLabs models list
|
||||
echo "\n--- Testing ElevenLabs General Authentication (/v1/models) ---\n";
|
||||
$modelsUrl = 'https://api.elevenlabs.io/v1/models';
|
||||
$chModels = curl_init($modelsUrl);
|
||||
curl_setopt($chModels, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($chModels, CURLOPT_HTTPHEADER, [
|
||||
'xi-api-key: ' . $elApiKey
|
||||
]);
|
||||
$modelsResponse = curl_exec($chModels);
|
||||
$modelsHttpCode = curl_getinfo($chModels, CURLINFO_HTTP_CODE);
|
||||
curl_close($chModels);
|
||||
|
||||
echo "Models API HTTP Status Code: {$modelsHttpCode}\n";
|
||||
echo "Models API Response: " . substr($modelsResponse, 0, 300) . "\n\n";
|
||||
|
||||
// Execute ElevenLabs TTS directly in this test script to get detailed error logs
|
||||
$url = 'https://api.elevenlabs.io/v1/text-to-speech/' . $elVoiceId;
|
||||
|
||||
$payload = json_encode([
|
||||
'text' => $testText,
|
||||
'model_id' => 'eleven_multilingual_v2',
|
||||
'voice_settings' => [
|
||||
'stability' => 0.5,
|
||||
'similarity_boost' => 0.8
|
||||
]
|
||||
'text' => $testText
|
||||
]);
|
||||
|
||||
echo "Sending API request to: {$url}...\n";
|
||||
|
||||
Reference in New Issue
Block a user