The speech synthesis needs to be initializated with the voice identifier of a voice of the browser. Whose nomenclature doesn't seems to be standard.


Since artyom v1.0.3, the speech synthesis language can be changed in mobile devices with the default code languages (en_US, en-US etc). If it still with the native voice, then you will need to change the voice variables in the source code.

If you've already worked with Artyom in a mobile device, you probably noticed that the Voice synthesis in Chrome for mobile doesn't work in the same way it does in Google Chrome for desktop. The reason is simple, however not the solution and that's why Artyom only works as expected in Google Chrome for desktop and till the date there's no plan to fix it.

Why it won't work as expected in chrome for mobile?

If you retrieve the voices in Google Chrome for desktop with Artyom using the following code for example:


You will find the following voice names e.g:

Google US English, Google Deutsch, Google español

The name will be always the same in all the languages in the Desktop, however if you do the same on different mobile devices you will find instead as names things like:

english USA, german GERMANY, español ESPAÑA 

or in other devices it will be displayed instead as:

en_US, de_DE, es_ES

theoretically, we would just need to try to cover those code languages and the browser codes too and it should work as expected (simple, theoretically till this point). However, that would just work with devices in English, for example in devices in German, the output of the available voices will be different:

englisch Vereinigte Staaten, deutsch Deutschland, Spanisch Spanien

And to provide support for some of the, trying to guess which name identifier to use according to the language of the device to set the voice, would make the size of artyom too big (besides it won't neither work as expected).

If you try to provide support for specifical devices as you know that in those devices a specifical language code (and the language of the device) will be obtained, feel free to fork Artyom.js and edit the language codes in the artyomLanguages variable providing the name of the voice in the device instead the name of the voice in the desktop (maybe in future versions we'll add a method to set custom voice name identifiers instead of creating your own version of artyom).

Does this happens with the command recognition too?

No, the Speech Recognition has specifical code languages (en_GB, es_ES etc) and they don't depend of the browser as this information is sent to the Google Servers and there will be processed, not on your computer.