100% found this document useful (1 vote)
220 views

Text To Speech PHP SDK Documentation

The Voice RSS Text-to-Speech PHP SDK allows developers to integrate text-to-speech functionality into their PHP applications using the Voice RSS API. The SDK provides methods to convert text to speech as a binary array or Base64 string. Developers can get started by including the voicerss_tts.php file and using the SDK's speech method to convert text and return the audio data.

Uploaded by

shoxpam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
220 views

Text To Speech PHP SDK Documentation

The Voice RSS Text-to-Speech PHP SDK allows developers to integrate text-to-speech functionality into their PHP applications using the Voice RSS API. The SDK provides methods to convert text to speech as a binary array or Base64 string. Developers can get started by including the voicerss_tts.php file and using the SDK's speech method to convert text and return the audio data.

Uploaded by

shoxpam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Text-to-speech PHP SDK

The Voice RSS Text-to-Speech PHP SDK wraps Voice RSS Text-to-Speech API.
The Voice RSS Text-to-Speech PHP SDKs will help to make integration with our Tex
t-to-Speech API faster and easer.
If you have any questions or suggestions please feel free to contact us via e-ma
il.

Documentation
To integrate an application with the Voice RSS Text-to-Speech PHP SDK it needs t
o add reference to the package voicerss_tts. The Voice RSS Text-to-Speech PHP SD
K provides possibility to get speech in binary or Base64 string formats.
Convert text-to-speech as a binary array
The following example demonstraits synchronous converting text-to-speech as a bi
nary array and prints result array:
<?php
require_once('voicerss_tts.php');
$tts = new VoiceRSS;
$voice = $tts->speech([
'key' => '<API key>',
'hl' => 'en-us',
'src' => 'Hello, world!',
'r' => '0',
'c' => 'mp3',
'f' => '44khz_16bit_stereo',
'ssml' => 'false',
'b64' => 'false'
]);
print_r($voice);
?>

Convert text-to-speech as a Base64 string


The following example demonstraits synchronous converting text-to-speech as a Ba
se64 string and plays it in an internet browser:
<?php
require_once('voicerss_tts.php');
$tts = new VoiceRSS;
$voice = $tts->speech([
'key' => '<API key>',
'hl' => 'en-us',
'src' => 'Hello, world!',
'r' => '0',
'c' => 'mp3',
'f' => '44khz_16bit_stereo',
'ssml' => 'false',
'b64' => 'true'
]);
echo '<audio src="' . $voice['response'] . '" autoplay="autoplay"></audio>';
?>

You might also like