Text to speech

Hello, I’m thinking about making a Text to speech C++ plugin for my dialog system.

I’ve found this link : Text-to-Speech Tutorial (SAPI 5.3) : Text-to-Speech Tutorial (SAPI 5.3) | Microsoft Docs

Is there anybody having experience of this (or another Text to speech api) with Unreal Engine ?

Thanks !

I’ve finally implemented another api here:

But I’m still thinking implementing Microsoft API. Anyone else interested ?

It is interesting yes, I was actually searching for something like this and I’ve read a few notes on that since 2014. To the best of my knowledge, there is only one “competitor” on this () but the result may be of unsufficient quality (basically he created a dictionary of text word → speech word) to emulate TTS.

And in fact, most people will use even simpler approach: recording messages with a great TTS in .wav and then simply launching the file at the appropriate time.

So the real question is more if you want to invest time in this ? If yes, I am pretty sure many people will be interested. If not, there are workarounds like the .wav files, although limited in terms of true interactivity.


PS: beware of cross platform compatibility too !

Well, the idea behind having such a plugin is to have more freedom for making voices for a game (even if it’s a bit robotic), in particular if you are working alone or in a small team. I’m particularely looking for english us/uk and french voices. It could also be connected to a speech recognition system to have more freedom in adventure games for example.

CMU Flite TTS is cross plateform but at the moment I’ve made it work outside Unreal Engine in Win32 and not as a plugin. There are free tools to make your own voices (on MacOsX) but unfortunately for me no french voices.
I’ve spent time to make this first version Visual 2015 compatible, and prepare the plugin architecture, but as it is my first plugin I need help. That’s why I’ve released the sources on github.

On the other side, there is the Microsoft SAPI. It looks more "standard " in TTS world but it is not cross plateform. I’m going to invest time to make a plugin with this other api (at the moment I don’t know how to create more voices, as again, there are only one or two voices available for free in French).

I implement SAPI-based plugin for UE 4.21. See GitHub - yar3333/text-to-speech-ue4: Text-to-speech UE4 plugin for Windows (SAPI). Tested on UE 4.21

I tried your solution, great plugin!
However when packaging the project (x64) I get the packaging error below. Can you help me how to fix this?

UATHelper: Packaging (Windows (64-bit)):   C:\MyProject\Plugins\text-to-speech-ue4-master\Source\TextToSpeechRuntime\TextToSpeechRuntime.Build.cs: warning: Modules must specify an explicit precompiled header (eg. PrivatePCHHeaderFile = "Private/TextToSpeechRuntimePrivatePCH.h") from UE 4.21 onwards.
UATHelper: Packaging (Windows (64-bit)):   C:\MyProject\Plugins\text-to-speech-ue4-master\Source\TextToSpeechRuntime\TextToSpeechRuntime.Build.cs: warning: Referenced directory 'C:\MyProject\Plugins\text-to-speech-ue4-master\Source\FMRTTSLib' does not exist.
PackagingResults: Warning: Modules must specify an explicit precompiled header (eg. PrivatePCHHeaderFile = "Private/TextToSpeechRuntimePrivatePCH.h") from UE 4.21 onwards.
PackagingResults: Warning: Referenced directory 'C:\MyProject\Plugins\text-to-speech-ue4-master\Source\FMRTTSLib' does not exist.
UATHelper: Packaging (Windows (64-bit)):   Writing manifest to C:\MyProject\Intermediate\Build\Manifest.xml
UATHelper: Packaging (Windows (64-bit)):   Building 1 action with 8 processes...
UATHelper: Packaging (Windows (64-bit)):     [1/1] MyProject-Win64-Shipping.exe
UATHelper: Packaging (Windows (64-bit)):     FMRTTSLib.lib(FMRTTSLib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
UATHelper: Packaging (Windows (64-bit)):     fatal error C1047: The object or library file 'C:\Program Files\Epic Games\UE_4.21\Engine\Plugins\Media\WebMMedia\Source\ThirdParty\libWebM\libvpx\lib\Win64\VS2015\vpxmd.lib' was created with an older compiler than other objects; rebuild old objects and libraries
UATHelper: Packaging (Windows (64-bit)):     LINK : fatal error LNK1257: code generation failed

Sorry, I not a professional in UE4, so I can’t help. I test plugin only in editor.

Done. To compile FMRTTSLib in future you can just open TextToSpeech\ThirdParty\FMRTTSLib\src\FMRTTSLibrary.sln in Visual Studio and build for win32 or x64.

Is it possible for you to rebuild the FMRTTSLib with newer Visual Studio or Windows SDK and push it to the repo please?
I think that would solve it.

Thank you very much, now it works properly in packed build!
You are the best!

hummmm…tried to compile…atlbase.h…and other missing…any clue ? thanks

oups…better with ATL under VS2017…but packaging error…

Hi, can you please update it to 4.22? Thanks

You can use this plugin for UE4 4.24 and onwards(4.25,4.26,…) to use native offline Text-To-Speech (TTS) for Windows, Windows VR, Android, iOS.
Universal Native TTS Text-To-Speech Offline (Windows / Android / iOS) in Code Plugins - UE Marketplace