Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: themaddin on January 15, 2021, 06:41:00 am
-
Hi,
I'd like to try and wire up FS to a free speech synthesizer, probably Festival.
Since the game engine itself is a little to complex for me, I'd like to do most of the work outside.
What support I require within the engine would be the following:
a) Check for the existence of a UNIX socket file data/voice/tts.socket OR
b) add a command line argument to pass any path to such a file
AND
for every message write/cat/netcat/...
the following to it:
1. (fs-persona <here goes Message Persona as per FRED>)
2. (fs-say <Here Goes Message Text>)
3. flush socket .
I hope this can be implemented without too much work.
-
You could probably add the necessary code with a Lua script yourself. There are hooks for when a message is sent and there should be API functions for interacting with files. Hopefully, those API also work with UNIX sockets...
-
Thanks for the advice, I'll look into what scripting can do here. Using a socket was only my first and most simple idea, there are certain to be other, maybe even more portable ways to talk to Festival.
-
Unfortunately, I find myself unable to write to a file using the scripting system.
Could you point me to an example how this is accomplished, or how CFile is used
in general?
The ability to write to a network port from a script would be a useful alternative.
-
You can use the standard Lua IO library (https://www.lua.org/manual/5.1/manual.html#5.7) to write to files. That is still available in FSO Lua scripts.
General purpose networking is not something that is generally usable so it will probably not be included into the FSO API. You can still use external libraries though to get the required functions. For example, LuaSocket (https://github.com/diegonehab/luasocket).
-
Ok, I thought there was only the restricted support available for security reasons. I'll try out what works best.
-
Alpha finished: here it is https://www.hard-light.net/forums/index.php?topic=97279