Воскресенье, 14 июня 2020 12:07

Deploying Google-Cloud-TTS-Rails with Heroku

Оцените материал
(0 голосов)

Deploying Google-Cloud-TTS-Rails with Heroku.



Google Cloud Text-to-Speech on Rails supports Select TEXT or SSML, Speech Rate Modification, and three conversion formats:

  1. MP3 (MPEG Audio Layer III)
  2. WAV (LINEAR16)
  3. 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)
  • Français (Canada)
  • Français (France)
  • Italiano (Italia)
  • 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.


git clone https://github.com/cmirnow/Google-Cloud-TTS-Rails.git
cd Google-Cloud-TTS-Rails


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.


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:

value: YOUR_KEY_NAME.json

value: YOUR_HEROKU_DOMAIN ### i.e 'https://***************.herokuapp.com' without quotes.


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_USER_NAME: '**************'
GMAIL_PASSWORD: '***************'
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: '*******************'

Everything working? Great. Now open your new application in a browser and click 'Sign Up'. Register and you can start converting text to sound.


Paid support service

This article contains a comprehensive list of steps required to deploy Google-Cloud-TTS-Rails to Heroku. However, if you fail, I can do it for you.

The cost of the service is 5€. Please transfer this amount to me, also send:

  • Access to your Heroku account.
  • JSON file that contains your key to access API Google Cloud Text-to-Speech.
  • Your email.

Thank you for your interest!
Yours truly,

Deploying Google-Cloud-TTS-Rails with Heroku. Paid support service 

Последнее изменение Среда, 25 января 2023 03:22

Оставить комментарий

Добавьте ваш комментарий

Poker onRails

Text To Speech

Комментарии в блоге

Заказать сайт

Веб-разработка. Заказать сайт

Вы можете заказать сайт-визитку, блог, корпоративный сайт, интернет-магазин или коммерческий web-портал.