08-09-2025 , 08-09-2025
Ang API ay magagamit lamang pagkatapos mong pondohan ang iyong account.
Mga boses ng JSON API https://speechgen.io/index.php?r=api/voices.
Mayroong 2 pagpipilian sa voiceover ng teksto na magagamit sa pamamagitan ng API:
1 pagpipilian - mabilis na voice-over ng maiikling teksto.
2 pagpipilian - pagtatakda ng isang voice-over task.
Tuklasin kung paano pasimplehin ang paglikha ng nilalaman ng boses sa pamamagitan ng pagsasama ng SpeechGen.io sa automation service na MAKE. Saklaw ng gabay na ito ang automation ng mga proseso ng text-to-speech, na ginagawang mas simple at mas mahusay ang pagbuo ng nilalaman ng boses para sa iba't ibang mga aplikasyon.
URL para sa variant 1: https://speechgen.io/index.php?r=api/text
Ang pagpipiliang ito ay may maximum na limitasyon na 2000 character. At gayundin ang maximum na 2 pagbabago ng boses. Kung lumampas sa mga limitasyon, makakakuha ka ng error (status = -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' - 'Boses'
'text' - 'Teksto para sa text to Speech'
'format' - format of the resulting file, by default = mp3, possible values ( 'mp3', 'wav', 'ogg')
'speed' - playback speed, by default 1, (range from 0.1 to 2.0)
'pitch'- voice pitch, by default 0, (range from -20 to 20)
'emotion' - emotion of voice , by default 'good', possible values ( 'good', 'evil', 'neutral').
'pause_sentence' - The size of the pause between sentences in milliseconds.
'pause_paragraph' - The size of the pause between paragraphs in milliseconds.
'bitrate'=>48000 - Bitrate from 8000 to 192000 Hz.
Emosyon Hindi magagamit para sa lahat ng mga boses, tingnan dito.
{
"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" - natatanging boses ID
"status" - kasalukuyang status ng voiceover. Magagamit mula sa 3 halaga:
0 - proseso
1 - matagumpay na nakumpleto
-1 - error
"file" - landas ng audio file, magagamit kung status= 1
"file_cors" - landas ng audio file CORS
"error" - teksto ng error, kung sakali, kung status = -1
"parts" - bilang ng mga voiceover
"parts_done" - bilang ng mga piraso na nakumpleto
"duration" - tagal ng audio file sa segundo, magagamit kung status = 1
"format" - format ng audio file
"balans" - limitasyon ng balanse
"cost" - mga gastos sa voiceover. (ay nadadagdagan habang ang mga bahagi ng boses ay na-dub)
$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);
Hakbang 1: Ang teksto ay ipinapadala sa API at nakakakuha ng isang natatanging voice ID(id).
Hakbang 2: Humiling ng resulta ng dubbing sa pamamagitan ng pagpapadala ng dubbing identifier (id).
Ang pamamaraang ito ay walang mga limitasyon at nagpapahintulot sa pag-dub ng teksto hanggang sa 1,000,000 character. Ang pag-dub ay nagaganap ayon sa priyoridad (unang dumating, unang nagsilbi) at maaaring tumagal mula 1 hang ilang minuto, depende sa haba ng teksto.
$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' - 'Boses'
'text' - 'Teksto'
'format' - format of the resulting file, by default = mp3, possible values( 'mp3', 'wav', 'ogg')
'speed' - speed, by default 1, (range from 0.1 to 2.0)
'pitch'- voice pitch, by default 0, (range from -20 to 20)
'emotion' - emotional coloration, by default 'good', possible values ( 'good', 'evil', 'neutral').
'pause_sentence' - The size of the pause between sentences in milliseconds.
'pause_paragraph' - The size of the pause between paragraphs in milliseconds.
'bitrate'=>48000 - Bitrate from 8000 to 192000 Hz.
Hindi magagamit para sa lahat ng mga boses, tingnan dito.
{
"id":"4153594",
"status":"0",
"parts":"5",
"parts_done":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.00"
}
"id" - natatanging boses ID
"status" - kasalukuyang status ng voiceover. Magagamit mula sa 2 halaga:
1 - matagumpay na naidagdag ang task
-1 - error
"error" - teksto ng error, kung sakali, kung status = -1
"parts" - bilang ng mga voiceover
"parts_done" - bilang ng mga piraso na nakumpleto
"format" - format ng audio file
"balans" - ang balanse ng mga limitasyon ng account
"cost" - mga gastos sa voiceover. (ay nadadagdagan habang ang mga bahagi ng boses ay na-dub)
Hakbang 2. Pagkatapos lumikha ng isang task at makakuha ng isang identifier (id), isang kahilingan ang dapat ipadala sa https://speechgen.io/index.php?r=api/result, upang malaman ang resulta.
$data = [
'token'=>'SekretKeyInYourProfile',
'email'=>'yourMail@gmail.com',
'id'=>4153594,
];
'token' - SekretKeyInYourProfile
'email' - yourMail@gmail.com
'id' - Natatanging boses ID na nakuha sa hakbang 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" - natatanging boses ID
"status" - kasalukuyang status ng voiceover. Magagamit mula sa 3 halaga:
0 - nasa proseso
1 - matagumpay na nakumpleto
-1 - error
"file" - landas ng audio file, magagamit kung status = 1
"error" - teksto ng error, kung sakali, kung status = -1
"parts" - bilang ng mga voiceover
"parts_done" - bilang ng mga piraso na nakumpleto
"duration" - tagal ng audio file sa segundo, magagamit kung status = 1
"format" - format ng audio file
"balans" - ang balanse ng mga limitasyon ng account
"cost" - mga gastos sa voiceover. (ay nadadagdagan habang ang mga bahagi ng boses ay na-dub)
"cuts" - Array ng mga fragment, kung ang "cut" tag ay ginamit sa teksto
//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);
}