Getting Google Assistant to speak in unsupported language

0
49


Lukas Novak

In Czech Republic, we really loves the voice assistants. Many members from GDG groups across the country took much effort to spread voice assistant topic to people living here. In Olomouc, we organized the first voice hackathon with nearly 40 attendees last year. This year, Martin Krcek organized the first global voice hackathon with 85 cities across the world involved.

Sadly, voice assistants are still domain of geeks and tech enthusiasts here. This is because Google Assistant can’t speak Czech language and until Google supports it, voice assistants will not be common in Czech homes. Back in May 2018 at I/O, Google told us the Google Assistant will speak Czech soon, but nothing happened yet. There are many of us, who tries to get more info from Google, including me, when I was on Google I/O this year, but with no success. Although there are some mysterious signs (1, 2, 3), no official statement is known.

Source: cnews.cz (in Czech)

As I was involved in organizing voice assistant events and developing voice actions, I’ve decided to make an experiment to get to Google Assistant speak in Czech. For this, I chose favorite weather forecast service called Alojz.cz as a base. This service processes data from yr.no and for every city in Czech Republic generates fancy forecast in natural language. Every forecast includes short information what to wear today or recommendation to take an umbrella so it’s a little more useful than standard Google Assistant forecast.

My idea was to get forecast text from Alojz, then somehow generate speech and pass it on to Google Assistant as an audio through SSML (Speech Synthesis Markup Language). After many attempts and versions I’ve built ready to use voice action Weather in Czech Republic, which is now public in Assistant Directory.

Voice interface in English and in “Czech”

You can invoke action with voice command: “Talk to Weather in Czech Republic” and then start asking for forecast with these parameters:

  • day: today or tomorrow

Default behavior is to talk in English, but with one simple command: “Change language to Czech” the magic comes. As you might assume, I didn’t hacked the Google and this does not change the whole voice interface into English. We must still wait for the full Czech support implemented by Google. However, the main purpose of this action, forecast, will be spoken in Czech. This is the steps how I’ve achieved this:

  1. Get text forecast for the particular day and city from Alojz.cz API.

In the first version of Alojz, I’ve used perfect SoundOfText service to get speech from the Google Translate API, but then replaced with Google Cloud Text-to-Speech API, because speech is much more natural (it uses WaveNet algorithm).

If you are curious about how I’ve achieved this, you can look at the source code of Weather in Czech Republic on GitHub.

The whole project was build with help of my Actions on Google Typescript template, which you can use for building your actions. It’s a simple template with all the boilerplate you should need to build your Action on Google with Typescript, Dialogflow and Firebase Functions. There is a thorough guide in the repository with explained steps you need to perform to build custom action on top of that template.

If you found any bug in one of the repositories, please fill the issue in GitHub or send there a pull request. I’ll be happy if my experiment helps you with building your voice action.





Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here