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.
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.
Earlier this month we showed you RetroArch’s world first text to speech implementation for emulators. You can read that previous article here.
Since then, this feature has been immeasurably improved. Onscreen character recognition and live text to speech translation is now done at the press of a button. You bind the AI Service key to a button or key of your choice, and as soon as you press it, a scan of the image will be taken in real-time. Any characters that were recognized as text will then be translated from text to speech.
In this video, we are running a local instance of vgtranslate on the same computer. This cuts down a lot on the latency you could perceive in the previous video. The other big difference is that the core no longer has to be paused manually and then unpaused to do the OCR scan – you now press a hotkey and the game continues running without any interruption. This provides for a much more smooth and seamless experience.
Shown in this video is a test run of several cores and games: Quake 1 with the Tyrquake core, Mega Man 4 with a NES emulator core, Trials of Mana/Seiken Densetsu 3 with a SNES emulator core, and finally Castlevania 3 with a NES emulator core. The OCR/text to speech system works with ANY libretro core that does not use hardware acceleration right now. So any core that doesn’t rely on OpenGL/Vulkan/Direct3D in order to function should be good to go.