05-09-2024 , 05-09-2024
API는 계정을 충전한 후에만 사용할 수 있습니다.
JSON API 음성 https://speechgen.io/index.php?r=api/voices.
API를 통해 사용할 수 있는 2가지 텍스트 음성 변환 옵션이 있습니다:
1 옵션 - 짧은 텍스트의 빠른 음성 변환.
2 옵션 - 음성 변환 작업 설정.
SpeechGen.io와 자동화 서비스 MAKE를 통합하여 음성 콘텐츠 제작을 간소화하는 방법을 알아보세요. 이 가이드는 텍스트-음성 변환 프로세스의 자동화에 대해 다루며, 다양한 애플리케이션에 대한 음성 콘텐츠 생성을 더 간편하고 효율적으로 만듭니다.
변형 1에 대한 URL: https://speechgen.io/index.php?r=api/text
이 옵션은 최대 2000자의 문자 제한이 있습니다. 또한 최대 2개의 음성 변화를 허용합니다. 제한을 초과하면 오류가 발생합니다(상태 = -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' - 'Voice'
'text' - 'Text for 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.
모든 음성에 대해 감정이 지원되지 않습니다, 여기에서 확인하세요.
{
"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" - unique voice ID
"status" - current voiceover status. Available from 3 values:
0 - process
1 - completed successfully
-1 - error
"file" - audio file path, available if status= 1
"file_cors" - audio file path CORS
"error" - error text, in the event of, if status = -1
"parts" - number of voiceovers
"parts_done" - number of pieces completed
"duration" - audio file duration in seconds, available if status = 1
"format" - audio file format
"balans" - limit balance
"cost" - voiceover costs. (is increased as the voice parts are dubbed)
$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단계: 텍스트를 API로 전송하고 고유한 음성 ID(id)를 얻습니다.
2단계: 더빙 식별자(id)를 보내 결과를 요청합니다.
이 방법은 제한이 없으며 최대 1,000,000자의 텍스트 더빙을 허용합니다. 더빙은 우선 순위에 따라 처리되며(선착순), 텍스트의 길이에 따라 1분에서 몇 분까지 소요될 수 있습니다.
$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' - 'Voice'
'text' - 'Text'
'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.
모든 음성에 대해 사용할 수 없습니다, 여기에서 확인하세요.
{
"id":"4153594",
"status":"0",
"parts":"5",
"parts_done":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.00"
}
"id" - unique voice ID
"status" - current voiceover status. Available from 2 values:
1 - task added successfully
-1 - error
"error" - error text, in case of, if status = -1
"parts" - number of voiceovers
"parts_done" - number of pieces completed
"format" - audio file format
"balans" - the balance of the account limits
"cost" - voiceover costs. ( is increased as the voice parts are dubbed)
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' - Unique voice ID obtained in step 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" - unique voice ID
"status" - current voiceover status. Available from 3 values:
0 - in the midst of
1 - completed successfully
-1 - error
"file" - audio file path, available if status = 1
"error" - error text, in case of, if status = -1
"parts" - number of voiceovers
"parts_done" - number of pieces completed
"duration" - audio file duration in seconds, available if status = 1
"format" - audio file format
"balans" - the balance of the account limits
"cost" - voiceover costs. ( is increased as the voice parts are dubbed)
"cuts" - Array of fragments, if the "cut" tag is used in the text
//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);
}