08-09-2025 , 16-09-2025
계정에 자금을 충전한 후에만 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' - '프로필의 비밀 키'
'email' - 'yourMail@gmail.com'
'voice' - '음성'
'text' - '텍스트 음성 변환을 위한 텍스트'
'format' - 결과 파일 형식, 기본값 = mp3, 가능한 값 ('mp3', 'wav', 'ogg')
'speed' - 재생 속도, 기본값 1, (0.1 ~ 2.0 범위)
'pitch'- 음성 높낮이, 기본값 0, (-20 ~ 20 범위)
'emotion' - 음성 감정, 기본값 'good', 가능한 값 ('good', 'evil', 'neutral').
'pause_sentence' - 문장 간 일시 중지 크기(밀리초).
'pause_paragraph' - 단락 간 일시 중지 크기(밀리초).
'bitrate'=>48000 - 비트 전송률 8000 ~ 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" - 고유 음성 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단계: 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' - '프로필의 비밀 키'
'email' - 'yourMail@gmail.com'
'voice' - '음성'
'text' - '텍스트'
'format' - 결과 파일 형식, 기본값 = mp3, 가능한 값 ('mp3', 'wav', 'ogg')
'speed' - 속도, 기본값 1, (0.1 ~ 2.0 범위)
'pitch'- 음성 높낮이, 기본값 0, (-20 ~ 20 범위)
'emotion' - 감정 색채, 기본값 'good', 가능한 값 ('good', 'evil', 'neutral').
'pause_sentence' - 문장 간 일시 중지 크기(밀리초).
'pause_paragraph' - 단락 간 일시 중지 크기(밀리초).
'bitrate'=>48000 - 비트 전송률 8000 ~ 192000 Hz.
모든 음성에서 사용할 수 있는 것은 아닙니다. 여기에서 확인하세요.
{
"id":"4153594",
"status":"0",
"parts":"5",
"parts_done":"0",
"format":"mp3",
"error":"",
"balans":"3331.2720000314",
"cost":"0.00"
}
"id" - 고유 음성 ID
"status" - 현재 음성 변환 상태. 2가지 값 사용 가능:
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' - 프로필의 비밀 키
'email' - yourMail@gmail.com
'id' - 1단계에서 얻은 고유 음성 ID
{
"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" - 고유 음성 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);
}