werd / ivona-speechcloud-sdk-php
IVONA SpeechCloud SDK for PHP
Installs: 2 098
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 3
Forks: 11
Open Issues: 0
Requires
- php: >=5.5
- aws/aws-sdk-php: ^3.8
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2024-11-09 19:22:07 UTC
README
IVONA SpeechCloud SDK for PHP
Installation
Through Composer:
$ composer require werd/ivona-speechcloud-sdk-php
Usage
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();