An open API service indexing awesome lists of open source software.

https://github.com/421p/talker

text to speech using google tts
https://github.com/421p/talker

google-text-to-speech tts tts-api tts-engine

Last synced: 11 months ago
JSON representation

text to speech using google tts

Awesome Lists containing this project

README

          

# Talker
Text to speech using Google TTS

## Installing

```
composer require 421p/talker
```

## Usage

```php
use React\EventLoop\Factory;
use Talker\Talker\GoogleSpeechTalker;
use Talker\Talker\Response\Mp3File;

require __DIR__.'/vendor/autoload.php';

$loop = Factory::create();

$talker = new GoogleSpeechTalker($loop);

[$hours, $minutes] = explode(':', date('H:i'));

$time = sprintf(
'Current time is %d hours %d minutes', $hours, $minutes
);

$talker->say($time, GoogleSpeechTalker::LOCALE_EN_US)->then(function (Mp3File $file) {
file_put_contents(__DIR__.'/test.mp3', $file->getContent());
});

$loop->run();
```