PRICE: US$0.00005 per character in the text to speech
Our TTS API gives you access to the TTS Engine.
Speech, process the text to audio
URL:
https://voip-communications.net/api-v2/index.php/tts/speech
Method:
POST
Authentication:
Basic
Parameters:
- voice (required): possible values:
Code Gender Language en-US_AllisonVoice female en-US de-DE_BirgitVoice female de-DE de-DE_DieterVoice male de-DE ja-JP_EmiVoice female ja-JP es-ES_EnriqueVoice male es-ES it-IT_FrancescaVoice female it-IT pt-BR_IsabelaVoice female pt-BR en-GB_KateVoice female en-GB es-ES_LauraVoice female es-ES en-US_LisaVoice female en-US en-US_MichaelVoice male en-US fr-FR_ReneeVoice female fr-FR es-LA_SofiaVoice female es-LA es-US_SofiaVoice female es-US - text (required): text to be processed by out TTS Engine
- audio_format (required): possible values:
- Ogg: Ogg format with the opus codec, default sample rate 48000 Hz
- WAV: Waveform Audio File Format, default sample rate 22050 Hz
- FLAC: Free Lossless Audio Codec, default sample rate 22050 Hz
- MP3: Mp3 audio format with 22050 Hz sample rate
- sample_rate (optional): if you want the audio file to be generated with a different sample rate from it defaults, just indicate the new sample rate as a integer number.
- return_type (required): possible values:
- URL: return the URL of the generated file
- FILE: return the audio file
HTTP Response Codes:
- 200: Success
- 400: Invalid request data
- 402: Insufficient funds
- 401: Invalid api credentials
- 405: Invalid request method
Response data:
if return_type was URL, you will get the next json object:
{ "file_url": "https://voip-communications.net/tts_files/20171004161656-17-338.WAV", "voice": "en-US_AllisonVoice", "audio_format": "WAV", "sample_rate": "8000" }
if return_type was FILE, you will get the generated file (binary)
Curl Example:
curl -u YOUR_API_KEY:YOUR_API_PASSWORD --data"voice=VOICECODE&text=TEXT_TO_SPEECH&audio_format=AUDIO_FORMAT&return_type=FILE" --output OUTPUT_FILE_NAME https://voip-communications.net/API/index.php/tts/speech
PHP Example:
$service_url = "https://voip-communications.net/api-v2/index.php/tts/speech"; $curl = curl_init($service_url); curl_setopt($curl, CURLOPT_USERPWD, "YOUR_API_KEY:YOUR_API_PASSWORD"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $post_fields = array("voice" => "VOICE_CODE", "audio_format" => "WAV", "text" => "TEXT TO SPEECH", "return_type" => "URL"); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_fields)); $curl_response = curl_exec($curl); if ($curl_response !== false) { $http_code = curl_getinfo($curl,CURLINFO_HTTP_CODE); if ($http_code == "200") { $result = json_decode($curl_response,true); $audio_file = $result["file_url"]; } } curl_close($curl);