Generate TTS Using Your Terminal

It’s not a new hack but it will work well if you have short texts (1-3 sentences) that you wish to convert to speech.

After all, when returning a response to the Google Assistant, you can use a subset of the Speech Synthesis Markup Language (SSML).


Because you can make your agent’s responses seem more life-like experience.


Open your terminal and try something like this:

curl "" -o aog-rock-hack.mp3

That’s it.

If you want to use SSML and get fancy, it’s also support it in the request:<speak>Hey<prosody%20rate="slow">how+are+you+doing+this+morning</prosody></speak>

Later you can use it in your Action on Google like that:

Here are <say-as interpret-as="characters">SSML</say-as> samples.
I can pause <break time="3s"/>.
I can play a sound
<audio src="">
didn't get your MP3 audio file
I can speak in cardinals. Your number is
<say-as interpret-as="cardinal">
Or I can speak in ordinals. You are
<say-as interpret-as="ordinal">
</say-as> in line.
Or I can even speak in digits. The digits for ten are
<say-as interpret-as="characters">
I can also substitute phrases, like the
<sub alias="World Wide Web Consortium">
Finally, I can speak a paragraph with two sentences.
<s>This is sentence one.</s>
<s>This is sentence two.</s>

For more hack and tips, check these slides on VUI Design or the official docs on SSML.


One thought on “Generate TTS Using Your Terminal

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s