07-09-2025 , 16-09-2025
واجهة برمجة التطبيقات متاحة فقط بعد تمويل حسابك.
أصوات واجهة برمجة التطبيقات JSON https://speechgen.io/index.php?r=api/voices.
هناك خياران لتعليق صوتي للنص متاحان عبر واجهة برمجة التطبيقات:
الخيار الأول - تعليق صوتي سريع للنصوص القصيرة.
الخيار الثاني - ضبط مهمة تعليق صوتي.
اكتشف كيف يمكنك تبسيط إنشاء المحتوى الصوتي من خلال دمج SpeechGen.io مع خدمة الأتمتة MAKE. يغطي هذا الدليل أتمتة عمليات تحويل النص إلى كلام، مما يجعل إنشاء المحتوى الصوتي لتطبيقات مختلفة أسهل وأكثر كفاءة.
عنوان URL للخيار الأول: https://speechgen.io/index.php?r=api/text
هذا الخيار له حد أقصى يبلغ 2000 حرف. وأيضًا حد أقصى لتغييرين في الصوت. إذا تجاوزت الحدود، ستحصل على خطأ (الحالة = -1).
$data = [
'token'=>'SekretKeyInYourProfile',
'email'=>'yourMail@gmail.com',
'voice'=>'John',
'text'=>"Text for text to Speech",
'format'=>'mp3',
'speed'=>1.1,
'pitch'=>0.8,
'emotion'=>'good',
'pause_sentence'=>300,
'pause_paragraph'=>400,
'bitrate'=>48000,
];
'token' - 'SekretKeyInYourProfile'
'email' - 'yourMail@gmail.com'
'voice' - 'الصوت'
'text' - 'نص لتحويله إلى كلام'
'format' - تنسيق الملف الناتج، الافتراضي = mp3، القيم الممكنة ('mp3', 'wav', 'ogg')
'speed' - سرعة التشغيل، الافتراضي 1، (النطاق من 0.1 إلى 2.0)
'pitch'- نبرة الصوت، الافتراضي 0، (النطاق من -20 إلى 20)
'emotion' - عاطفة الصوت، الافتراضي 'جيد'، القيم الممكنة ('جيد'، 'شرير'، 'محايد').
'pause_sentence' - حجم التوقف بين الجمل بالمللي ثانية.
'pause_paragraph' - حجم التوقف بين الفقرات بالمللي ثانية.
'bitrate'=>48000 - معدل البت من 8000 إلى 192000 هرتز.
العاطفة غير متاحة لجميع الأصوات، ابحث هنا.
{
"id":"4153594",
"status":"0",
"file":"result.mp3",
"file_cors":"result_cors.mp3",
"parts":"5",
"parts_done":"2",
"duration":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.06"
}
"id" - معرف صوتي فريد
"status" - حالة التعليق الصوتي الحالية. متاحة من 3 قيم:
0 - قيد المعالجة
1 - مكتمل بنجاح
-1 - خطأ
"file" - مسار ملف الصوت، متاح إذا كانت الحالة = 1
"file_cors" - مسار ملف الصوت CORS
"error" - نص الخطأ، في حالة حدوث خطأ، إذا كانت الحالة = -1
"parts" - عدد مقاطع التعليق الصوتي
"parts_done" - عدد المقاطع المكتملة
"duration" - مدة ملف الصوت بالثواني، متاحة إذا كانت الحالة = 1
"format" - تنسيق ملف الصوت
"balans" - رصيد الحد المتبقي
"cost" - تكاليف التعليق الصوتي. (تزداد مع دبلجة أجزاء الصوت)
$data = [
'token' => '123456',
'email' => 'mail@mail.com',
'voice' => 'John',
'text' => "Text",
'format' => 'mp3',
'speed' => 1.1,
'pitch' => 0,
'emotion' => 'good',
];
$url = "https://speechgen.io/index.php?r=api/text";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
var_dump($response);
$response = json_decode($response, true);
if (curl_errno($ch)) {
var_dump("Connection error with text recognition server, " . curl_error($ch));
} else {
var_dump($response);
if ($response["status"] == 1) {
//Copy
echo " ok " . $response["file"];
copy($response["file"], 'Filename.' . $response["format"]);
} else {
//Error, no voiceover possible
echo $response["error"];
}
}
curl_close($ch);
الخطوة 1: يتم إرسال النص إلى واجهة برمجة التطبيقات والحصول على معرف صوتي فريد (id).
الخطوة 2: طلب نتيجة الدبلجة عن طريق إرسال معرف الدبلجة (id).
هذه الطريقة ليس لها قيود وتسمح بدبلجة النصوص حتى 1,000,000 حرف. تتم الدبلجة حسب الأولوية (من يأتي أولاً يُخدم أولاً) ويمكن أن تستغرق من دقيقة إلى عدة دقائق، اعتمادًا على طول النص.
$data = [
'token'=>'SekretKeyInYourProfile',
'email'=>'yourMail@gmail.com',
'voice'=>'John',
'text'=>"Text",
'format'=>'mp3',
'speed'=>1.1,
'pitch'=>0.8,
'emotion'=>'good',
'pause_sentence'=>300,
'pause_paragraph'=>400,
'bitrate'=>48000,
];
'token' - 'SekretKeyInYourProfile'
'email' - 'yourMail@gmail.com'
'voice' - 'الصوت'
'text' - 'النص'
'format' - تنسيق الملف الناتج، الافتراضي = mp3، القيم الممكنة ('mp3', 'wav', 'ogg')
'speed' - السرعة، الافتراضي 1، (النطاق من 0.1 إلى 2.0)
'pitch'- نبرة الصوت، الافتراضي 0، (النطاق من -20 إلى 20)
'emotion' - التلوين العاطفي، الافتراضي 'جيد'، القيم الممكنة ('جيد'، 'شرير'، 'محايد').
'pause_sentence' - حجم التوقف بين الجمل بالمللي ثانية.
'pause_paragraph' - حجم التوقف بين الفقرات بالمللي ثانية.
'bitrate'=>48000 - معدل البت من 8000 إلى 192000 هرتز.
غير متاح لجميع الأصوات، ابحث هنا.
{
"id":"4153594",
"status":"0",
"parts":"5",
"parts_done":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.00"
}
"id" - معرف صوتي فريد
"status" - حالة التعليق الصوتي الحالية. متاحة من قيمتين:
1 - تمت إضافة المهمة بنجاح
-1 - خطأ
"error" - نص الخطأ، في حالة حدوث خطأ، إذا كانت الحالة = -1
"parts" - عدد مقاطع التعليق الصوتي
"parts_done" - عدد المقاطع المكتملة
"format" - تنسيق ملف الصوت
"balans" - رصيد حدود الحساب
"cost" - تكاليف التعليق الصوتي. (تزداد مع دبلجة أجزاء الصوت)
الخطوة 2. بعد إنشاء مهمة والحصول على معرف (id)، يجب إرسال طلب إلى https://speechgen.io/index.php?r=api/result، لمعرفة النتيجة.
$data = [
'token'=>'SekretKeyInYourProfile',
'email'=>'yourMail@gmail.com',
'id'=>4153594,
];
'token' - SekretKeyInYourProfile
'email' - yourMail@gmail.com
'id' - معرف صوتي فريد تم الحصول عليه في الخطوة 1
{
"id":"4153594",
"status":"0",
"file":"result.mp3",
"cuts":["result_1.mp3","result_2.mp3",...],
"parts":"5",
"parts_done":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.00"
}
"id" - معرف صوتي فريد
"status" - حالة التعليق الصوتي الحالية. متاحة من 3 قيم:
0 - قيد التنفيذ
1 - مكتمل بنجاح
-1 - خطأ
"file" - مسار ملف الصوت، متاح إذا كانت الحالة = 1
"error" - نص الخطأ، في حالة حدوث خطأ، إذا كانت الحالة = -1
"parts" - عدد مقاطع التعليق الصوتي
"parts_done" - عدد المقاطع المكتملة
"duration" - مدة ملف الصوت بالثواني، متاحة إذا كانت الحالة = 1
"format" - تنسيق ملف الصوت
"balans" - رصيد حدود الحساب
"cost" - تكاليف التعليق الصوتي. (تزداد مع دبلجة أجزاء الصوت)
"cuts" - مصفوفة من الأجزاء، إذا تم استخدام الوسم "cut" في النص
//STEP 1
$data = [
'token' => '123456',
'email' => 'mail@mail.com',
'voice' => 'John',
'text' => "Text",
'format' => 'mp3',
'speed' => 1.1,
'pitch' => 0,
'emotion' => 'good',
];
$url = "https://speechgen.io/index.php?r=api/longtext";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
var_dump($response);
$response = json_decode($response, true);
$resultId = 0;
if (curl_errno($ch)) {
var_dump("Error in connecting to the text recognition server, " . curl_error($ch));
} else {
var_dump($response);
if ($response["status"] == 1) {
//Copy
echo " ok " . $response["file"];
copy($response["file"], 'FileName.' . $response["format"]);
} elseif ($response["status"] == 0) {
//Remember the voice ID, and ask for the result later
$resultId = $response["id"];
} else {
//Error, no voiceover possible
echo $response["error"];
}
}
curl_close($ch);
//STEP 2
// Every minute we make a query-check of the result
if($resultId){
$data = [
'token'=>'123456',
'email'=>'mail@mail.com',
'id'=>$resultId,
];
$url = "https://speechgen.io/index.php?r=api/result";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
var_dump($response);
$response = json_decode($response,true);
if (curl_errno($ch)) {
var_dump("Error in connecting to the text recognition server, ".curl_error($ch));
}else{
var_dump($response);
if($response["status"] == 1){
//Copy
echo " ok ".$response["file"];
copy($response["file"], 'FileMane.' . $response["format"]);
}elseif($response["status"] == 0){
//Not ready yet, we will ask for the result later
echo "In process...";
}else{
//Error, no voiceover possible
echo $response["error"];
}
}
curl_close($ch);
}
الدردشة الدولية في Telegram @speechgen
الدعم الشخصي في تيليجرام @speechgen_alex