-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create README.md PHP_EOL change package type 1.0.0 Update README.md fix composer
- Loading branch information
Showing
7 changed files
with
185 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 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(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
namespace Talker\Talker\Response; | ||
|
||
|
||
class AudioFile | ||
interface AudioFile | ||
{ | ||
|
||
public function getContent(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
namespace Talker\Talker\Response; | ||
|
||
|
||
class Mp3File | ||
interface Mp3File extends AudioFile | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters