sursolar/voicetext-api

for VoiceText Web API

dev-master 2017-09-28 07:05 UTC

This package is not auto-updated.

Last update: 2024-12-22 06:34:47 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": {
        "sursolar/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