tetsuwo/voicetext-api

for VoiceText Web API

dev-master 2014-07-28 15:26 UTC

This package is not auto-updated.

Last update: 2024-04-23 00:32:45 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

The unofficial PHP client for the VoiceText Web API.

Demonstration

Installation

Install Composer.

Add below in require property on composer.json.

{
    "require": {
        "tetsuwo/voicetext-api": "dev-master"
    }
}

Execute below command.

$ php composer.phar install

Usage

At first, set up client.

$client = new Tetsuwo\VoiceText\API\Client('{API_KEY}', '{API_PASSWORD}');

Method of Speech synthesis (Text-to-speech)

Execute PHP code below to get the Speech synthesis data of specified text.
And there are binary data of WAV format in $response.

$response = $client->getTts(array(
    'text'    => 'こんばんは、モヤモヤさ◯ぁ~ずです。',
    'speaker' => show'
));

Returns the data string for WAV format.

echo 'data:audio/wav;base64,', base64_encode($response);

Execute the JavaScript code below to play.

var audio = new Audio('data:audio/wav;base64,~~~~~~~~~~~');
audio.play();

See official website more details.

LICENSE

This software is released under the MIT License, see LICENSE.

SEE ALSO