Upcoming – RetroArch 1.7.8 – AI Service (Machine Translation / OCR / Text-To-Speech)

Written by Barry Rowe

What is the AI Service?

The AI Service lets you translate games, or add automated voice-overs capability in real time.  Instead of using a ROM patch, this is done by RetroArch taking a screenshot and then sending it to the AI Service listed in your config, which will do OCR (optical character recognition), machine translation, and/or text-to-speech.  The service will then return the result and will either be displayed on the screen, or played through the audio output of RetroArch.  As is the nature with AI though, accuracy can be an issue.  However, machine translation can give a good gist of what’s being said, especially for some language pairs, and text-to-speech can be of great benefit for accessibility.

How to set it up

See https://docs.libretro.com/guides/ai-service/ for a more detailed guide about how to setup the AI Service for your use case (translation or voice-over).  Any core using the RGB565 or RGB8888 pixel formats should work.  Cores using a hardware buffer however are not yet supported.  If you’re unsure if your core is supported, see the above documentation on how to check.  The main supported service is the vgtranslate project

Supported Services: VGTranslate, ZTranslate Service

VGTranslate ( https://gitlab.com/spherebeaker/vgtranslate ) is a lightweight server that you can run on windows or linux.  With it running, your RetroArch device can send its screen captures over your home network and the service will translate it and send it back to RetroArch.  This makes it possible to run the computationally expensive AI code off-device, so you can run translation on a Raspberry Pi or other device.  Local only translation is still in an experimental state, so using a Google Cloud key with VGTranslate is currently suggested.
It’s also possible to use an external service instead of running VGTranslate yourself.  ZTranslate.net has such a service listed in its documentation.

Caveats

Certain text will be easier to OCR than others.  Logos/title screens or very stylized text can be difficult for OCR engines to deal with, and some language pairs are easier to translate between than others.  Japanese-to-English in particular seems to be the most difficult use case, since OCR engines can have difficulty with Japanese pixel fonts on textboxes with transparent backgrounds.  Many games will work fine, but some may not work that well, depending on how the game draws the text.  Future developments will help improve this and expand the number of playable games with this feature.