PHP code example of werd / ivona-speechcloud-sdk-php
1. Go to this page and download the library: Download werd/ivona-speechcloud-sdk-php 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/ */
werd / ivona-speechcloud-sdk-php example snippets
use Werd\Ivona\SpeechCloud;
use Werd\Ivona\Models\Input;
use Werd\Ivona\Models\OutputFormat;
use Werd\Ivona\Models\Parameters;
use Werd\Ivona\Models\Voice;
use Werd\Ivona\Models\Lexicon;
$speechCloud = new SpeechCloud([
'access_key' => '<your-key>',
'secret_key' => '<your-secret-key>',
'region' => '<region>' // E.g. eu-west-1
]);
// CreateSpeech
$data = $speechCloud->createSpeech(new Input([
Input::DATA => 'The word or sentence You want to synthesize'
]), new OutputFormat(), new Parameters(), new Voice());
header('Content-Type: audio/mpeg');
echo $data; // Audio stream - use it as You please
$data = $speechCloud->createSpeech(new Input([
Input::DATA => 'Je Suis Charlie'
]), new OutputFormat(), new Parameters(), new Voice([
Voice::NAME => 'Celine',
Voice::LANGUAGE => 'fr-FR'
]));
// ListVoices
$data = $speechCloud->listVoices(new Voice());
$data = $speechCloud->listVoices(new Voice([
Voice::LANGUAGE => 'en-US',
Voice::GENDER => Voice::GENDER_MALE
])); // Filter American English male voices etc.
// PutLexicon
$data = $speechCloud->putLexicon(new Lexicon([
Lexicon::NAME => 'Test',
Lexicon::CONTENTS => '<PLS>'
]));
// GetLexicon
$data = $speechCloud->getLexicon('Test');
// DeleteLexicon
$data = $speechCloud->deleteLexicon('Test');
// ListLexicons
$data = $speechCloud->listLexicons();
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.