How to add text to speech to a Unity project?

Am I looking for System.speech to work in unity? Is there a way to incorporate this DLL into unity and MonoDevelop ?.

Because I'm trying to make audio text into speech without spending money from an asset store. If the System.Speech library of the DLL can handle this, why not. How to make it work with unity 5.3.5?

Also I already tried speechLib.dll . This is a job in the editor, but when Build to APK is a mistake and it cannot be built.

Any help Thanks in Advanced!

Dennis

+5
source share
2 answers

Dlls files do not work on Android or iOS if it is an unmanaged DLL file without the API specified in Windows. If it is a Windows API or a managed dll, then it will not work on Android or iOS.

You have two options: buy a plugin or make your own. If you focus only on Android and iOS, go to this Easy TTS, which costs $ 5.

If you want to do it yourself, this process is very similar to my speech text. The only difference is the classes used. Making one yourself is easy. The only drawback is that it takes a lot of time for each platform.

Android

TextToSpeech class.

IOS

AVSpeechSynthesizer class

MacOS

NSSpeechSynthesizer class

Window

class ISpVoice

There are many examples of how to use them on the Internet. You must make a plugin for the Android class using Java, Objective-C for the iOS classes and MacOs. C ++ for the Windows class.

To put them together, you need to use the Unity directive.

class TextToSpeech { #if UNITY_ANDROID Use TextToSpeech class #endif #if UNITY_IOS Use AVSpeechSynthesizer class #endif #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX Use NSSpeechSynthesizer class #endif #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN Use ISpVoice class #endif } 
+3
source

Another option: Klattersynth TTS for Unity

http://strobotnik.com/unity/klattersynth/

Small fully integrated speech synthesizer, works on all platforms.

0
source

Source: https://habr.com/ru/post/1264971/


All Articles