Loading...
  OR  Zero-K Name:    Password:   

Codex QOL

13 posts, 376 views
Post comment
Filter:    Player:  
sort
4 years ago
I was just looking at the Codex. Lots of text... So, just a couple of quality-of-life ideas:
  • A way to change the text language on the fly.
  • A play/pause button to have TTS read it back.


I wonder if this is even doable though. At least on the widget level, TTS gets only A through Z and a couple of punctuation marks, not even commas or periods and definitely not numbers. I wish I knew where text was so thoroughly sanitized and why.

Does anyone else think that implementing these things might be a worthwhile endeavor?
+1 / -0


4 years ago
  • There isn't even a system for translating the lobby, although I have seen something being work on in this area.
  • TTS could read it. The quality of the TTS will depend on your operating system as I am fairly sure there is just an API for widgets to send the wrapper text that is passed on to the OS.
+0 / -0
4 years ago
Thanks for the info.

That TTS part would be nice. I have several voices installed and at least two different TTS engines, and they all exhibit this behavior, so the problem is with the way game processes strings before passing them to the speech engine. What I'd like to know is where the filtering occurs.
+1 / -0


4 years ago
If it occurs in the widget then it is easy to fix. That would be worth checking.
+0 / -0
4 years ago
String is sent as a message. I got lost trying to trace what happens to it. Here's a line from snd_text_to_speech.lua:

Spring.SendLuaMenuMsg("textToSpeechSay_" .. (playerName or "unknown") .. " " .. (caption or "")
+1 / -0
4 years ago
I thought I saw reference to the TTS the other day... the actual sanitizing (including filtering out numbers) appears to happen here:

https://github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/dfd8b8ba23ce964e441ba24369924f7b5795fce2/ChobbyLauncher/TextToSpeechBase.cs
+0 / -0
4 years ago
I have nothing to do I would be willing to read the codex of units : ^)
+0 / -0
Wow, thanks. Didn't expect it to be part of infra, never would have looked there.
        protected static string Sanitize(string input)
        {
            if (string.IsNullOrEmpty(input)) return input;
            return
                new string(
                    input.ToCharArray()
                        .Where(c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c ==' ' || (c == '-') || (c == '?') || (c == '!'))
                        .ToArray());
        }

What would be the danger of changing the whole thing to just
        protected static string Sanitize(string input)
        {
            return input;
        }
..? I mean, yeah, remove it altogether.

Being that it's TTS-specific, I really don't understand the purpose of not allowing everything and the kitchen sink to be passed to the TTS engine. Do I need to open a ticket for Licho to look at it or something?

ROrankAnagram: Recorded voice always sounds better, IMO. Especially if you have a cute accent...
+0 / -0
4 years ago
Looks like Sanitize makes the text safe enough to be used as a command-line parameter on Linux, so without it there might be ways for people to abuse the full character set and break things. Seems to serve a purpose, even if it's a bit restrictive in what it can say at the moment.
+0 / -0
>cute accent
I'll have you know that I totally do not have a retarded accent which is a mix of like 5 others

PS pls give me a good free noise cancellation software
+0 / -0
4 years ago
quote:
...safe enough to be used as a command-line parameter...

That's what I thought at first, but then... Single-quoting the string and maybe removing pipe, back/fw slashes, and apostrophes would have done the trick, wouldn't it?
+0 / -0
It seems overkill but this does catch any edge cases. You can guarantee that no one's gonna be able to rm -rf their teammates when your character set is a minimal whitelist (though I don't think there's any real danger of that with how it's being called)

Oddly, it looks like the TTS used to accept digits, but they were removed from the list. From the commit, it's hard to tell why they were removed though.

Edit: There was an issue closed around the time of the commit where non-english languages were removed from TTS. Perhaps the numbers 0-9 were just lost in translation?
+0 / -0
4 years ago
Possibly to prevent something like "-r -100" from having any chance of succeeding? Though it would seem more logical to remove the dash and leave numbers alone if this was a concern.
+0 / -0