Google Cloud Text-to-Speech on Rails supports Select TEXT or SSML, Speech Rate Modification, and three conversion formats:
- MP3 (MPEG Audio Layer III)
- WAV (LINEAR16)
- OGG (OGG_OPUS).
Languages Google Cloud Text-to-Speech Rails supports:
- Arabic (multi-region)
- Català (Espanya)
- Dansk (Danmark)
- Deutsch (Deutschland)
- English (Australia)
- English (Great Britain)
- English (India)
- English (United States)
- Español (España)
- Español (US)
- Français (Canada)
- Français (France)
- Italiano (Italia)
- Japanese (Japan)
- Latviešu (latviešu)
- Magyar (Magyarország)
- Nederlands (Nederland)
- Norsk bokmål (Norge)
- Polski (Polska)
- Português (Brasil)
- Português (Portugal)
- Română (România)
- Suomi (Suomi)
- Íslenska (Ísland)
- Čeština (Česká republika)
- Ελληνικά (Ελλάδα)
- Български (България)
- Русский (Россия)
- Українська (Україна)
- हिन्दी (भारत)
Extended version Google Cloud Text to Speech Rails (Ruby on Rails 6, Webpacker, Bootstrap 5, Ajax Flash Messages) allows some improvements: set the title of the sound file, upload and store audio files to Amazon S3, Google Cloud Storage or Microsoft Azure Storage, translate (API Google Translate) text on the fly.
In order to deploy to Heroku, you need to have an account with them. If you haven't, click here to sign up. Before you can deploy to Heroku, Git and Heroku toolbelt should have already installed.
Now you need to get a JSON file that contains your key to access API Google Cloud Text-to-Speech.
Follow these instructions.
Then:
git clone https://github.com/cmirnow/Google-Cloud-TTS-Rails.git
cd Google-Cloud-TTS-Rails
or
git clone https://github.com/cmirnow/Google-Cloud-Text-to-Speech-Pro.git
cd Google-Cloud-Text-to-Speech-Pro
Ok, put YOUR_KEY_NAME.json (Google JSON credentials) into the root of the directory Google-Cloud-TTS-Rails now. Be careful, the service account key for Pro version must contain access to Google Cloud Translate API and Google Cloud Text to Speech API.
Next:
git add .
git commit -m "my first commit"
heroku create
git push heroku master
heroku run rake db:migrate
Attention! If you get an error Command "webpack" not found - read this forum message.
Go to Heroku.com administration panel, YOUR_NEW_APPLICATION -> 'Settings' -> 'Reveal Config Vars' and add a new key/value lines:
key: GOOGLE_APPLICATION_CREDENTIALS
value: YOUR_KEY_NAME.json
key: DOMAIN_NAME
value: YOUR_HEROKU_DOMAIN ### i.e 'https://***************.herokuapp.com' without quotes.
key: GMAIL_USER_NAME
value: YOUR_GMAIL_LOGIN
key: GMAIL_PASSWORD
value: YOUR_GMAIL_PASSWORD ### (An App Password is a 16-digit passcode that gives an app or device restricted access to your Google Account without having to divulge your personal password and complete access to your Google Account).
Pro version Text to Speech onRails requires these environment variables:
DOMAIN_NAME: '****************'
#Gmail
GMAIL_USER_NAME: '**************'
GMAIL_PASSWORD: '***************'
# AWS
AWS_ACCESS_KEY_ID: '******************'
AWS_SECRET_ACCESS_KEY: '******************'
REGION: "us-east-2" #for example
BUCKET: "your_project_name"
# Use Google Cloud Translate API across RapidAPI (REST):
# RAPIDAPI_KEY: '**************************'
# or directly:
CLOUD_PROJECT_ID: '*******************'
GOOGLE_APPLICATION_CREDENTIALS: "key.json"
Everything working? Great. Now open your new application in a browser and click 'Sign Up'. Register and you can start converting text to sound.
Комментарии в блоге