Tutorial for using Google TTS API on Node.js project

Create a Google Cloud Project.

refer ‘Creating a service account’ section on this official guide

But, you don’t need the other part.

If you have done to make a new project and downloaded the credential file, store as secure.

I had located the file to here.


Install Libraries what you need

We need these modules


So, execute this

npm i @google-cloud/text-to-speech dotenv lodash

Set the .env file

write a credential location into the .env file.


Write and try the main code

original reference: https://www.woolha.com/tutorials/node-js-google-cloud-text-to-speech-api-examples

So, you could get a listenable mp3 file

Dropout from Physics, self-taught and worked on the IT industry as a Dev/Design/Planning for 8 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧