Text to Speech(TTS) in Golang.

Iamkochukulam
2 min readFeb 7, 2021

Text to speech (TTS) is a process by which you convert your text to a speech. Whatever you enter as Text, the same is converted into an audio file containing the written contents. Such programs are generally referred as TTS.

There are different API’s available for TTS. Google too offers API’s, pertaining to TTS. You can play such output audio files on VLC player.

This small code converts text to speech.

package main

import "github.com/hegedustibor/htgo-tts"

func main() {
speech := htgotts.Speech{Folder: "audio", Language: "en"}
speech.Speak("Flying to the moon")
}

Tibor Hegedűs has written a package which helps the text to speech functionality. The package talks to the google server and get’s the audio file to the local path.

There is a next part to this article which will be coming soon, in which we can understand what are the import packages, methods and signatures used and how all this orchestrates the TTS functionality.

Gopher Mascot : credits to MariaLetta

Like how The Jade palace in the Movie Kung-fu Panda has Master Shifu who transforms his students for the greater good, in Go world we have our own Master Shiju (Shiju Varghese) who guides aspiring Gophers.

I thank Master Shiju and the pack of Gophers(other folks) with whom we try to unlearn, learn and re-learn in the world of Go and outside too.

Thank you all to Reading. I hope you liked and learned it.

--

--