Text To Speech in CommCare

CommCare 2.51 introduces Text-To-Speech(TTS) functionality. It uses the device’s default TTS engine to speak text in different languages. Mobile users can enable this functionality from the CommCare settings menu. 
Once enabled, CommCare will add a button next to each question for TTS(it converts the question text to speech). App builder can also specify a different text for TTS by adding a tts field to the questions in the Add Other Content section in HQ form builder.  

Default TTS engine

There are many TTS engines in the market these days and some brands are now shipping devices with more that one, when that’s the case, it’s important to make sure that the one set as default meets our expectations. CommCare TTS feature was develop with the Google TTS engine in mind, so the functionality described here follows that implementation. To confirm and/or change the default TTS engine, go to Settings → Accessibility → Text-to-speech output → Preferred engine (if the path is not applicable, just search in the Settings search box for "text-to-speech”):

tts_preferred_engine.jpeg


Language Support

Each TTS engine supports a set of languages. You can find out the available TTS languages for the default engine by going to android settings → text to speech output → language. It'll display a list of languages that's supported by the TTS engine. 

CommCare will try to use the current language of the CommCare app for the TTS output. But if that language isn't supported by the TTS engine, then CommCare will try to use the device's default language. But if the default language is also not supported by the TTS engine then CommCare will default to en_US(English) language. And if that also isn't supported, then it simply will display a toast message that Text-To-Speech feature won't work. 

There are situations, however, where the android TTS engine supports a specific language but lacks the language's voice data. In this case and depending on the default TTS engine CommCare will display a dialog asking user to download voice data for that particular language. It'll take the user to the Android's setting app where they can download voice data for the language. Once the data is downloaded they can come back to CommCare and start using the TTS feature.