PHP code example of omerfdmrl / tts
1. Go to this page and download the library: Download omerfdmrl/tts library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omerfdmrl / tts example snippets
use Omerfdmrl\Tts\Tts;
$tts = new Tts;
// Set Google Api Code
$tts->setApi('Api_Code');
// Set Text
$tts->setText('Hello World!');
// Send request to Google and save voice
$tts->get();
use Omerfdmrl\Tts\Tts;
$tts = new Tts;
// Set Google Api Code
$tts->setApi('Api_Code');
// Set Text
$tts->setText('Hello World!');
// Set Save Path
// Default is ./tts.mp3
$tts->setSavePath('tts.mp3');
// Set Language Code
// Default is en-US
$tts->setLanguageCode('en-US');
// Set Voice Name
// Default is en-US-Wavenet-F
$tts->setVoiceName('en-US-Wavenet-F');
// Set Encoding Type
// Default is MP3
$tts->setEncoding('MP3');
// Set Pitch
// Default is 0.00
$tts->setPitch(0.00);
// Set Speaking Rate
// Default is 1.00
$tts->setSpeakingRate(1.00);
// Send request to Google and save voice
$tts->get();
// Get error if exist
echo $tts->error();