gcp-tts
Google Cloud - Text-To-Speech
Unofficial Google Cloud TTS API client.
Installation
-
Add the dependency to your
shard.yml
:dependencies: gcp-tts: github: krthr/gcp-tts.cr
-
Run
shards install
Usage
First of all, you need to authenticate client with the service user credentials .json file
require "gcp-tts"
TTS.authenticate "./credentials.json"
Get a list of Voice supported for synthesis.
puts TTS::Voice.list
puts TTS::Voice.list "en" # using language tag
Get a Base64 representation of a .MP3 file
result = TTS::Text.synthesize(
{
text: "I'm in love with Crystal"
#ssml: "" # or using ssml
},
"en" # lang code
)
puts result.audioContent # Base64 result
Save an .MP3 file with the result
TTS.to_file("¡Hola!", "es", "./audio.mp3")
Development :D
Contributing
- Fork it (https://github.com/krthr/gcp-tts.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- krthr - creator and maintainer