texttospeech implements a Google Cloud Text to Speech API client.
API Documentation · GitHub Repo
Add this to your application's .nimble file:
requires "texttospeech"
or to install globally run:
nimble install texttospeech
Follow the "Before you begin" steps in this document:
https://cloud.google.com/text-to-speech/docs/quickstart-protocol. Ensure that
the gcloud
utility is in your PATH.
You may then compile and run the following:
import os, options
import texttospeech
# Initialise the client:
let client = newTextToSpeechClient()
# Synthesize a some text:
let filename = client.synthesizeToFolder("Hello World!", os.getCurrentDir())
echo("Saved in ", filename) # Open the file in your favourite music player.
# Modifying the options:
echo client.synthesizeToFolder(
"Nim is the best programming language!",
os.getCurrentDir(),
voice=initVoiceSelectionParams(name=some("en-GB-Wavenet-A")),
audioConfig=initAudioConfig(audioEncoding=OGG_OPUS, pitch = -5)
)
- Fork it ( https://github.com/dom96/texttospeech/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
MIT