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

Multi-voice Text to Speech setup (Linux)

6 posts, 403 views
Post comment
Filter:    Player:  
sort

13 months ago
In this thread: Slightly ridiculous but working setup for ally chat TTS on Linux with different voices for different players.

This uses Larynx, the free TTS system with which I've had best results so far, but it should work with any system that supports SSML and streaming I/O.

1. Install Larynx in one of the ways described there.

2. Install this widget as usual. All it does is to write chat messages to the file /path/to/zero-k/text_to_speech.ssml, with SSML <voice> tags to select different voices. The voice is determined by the player's Lobby ID (thx unknownrankShaman) modulo the number of voices, so the voice assignment will be persistent unless you add/remove voices.

3. Start playing or specing a match with the widget enabled so the file gets created.

4. Run this in a terminal (after adjusting the path to Zero-K):

tail -f /path/to/zero-k/text_to_speech.ssml -n1 | tee >(larynx --stdin-format=lines --interactive --play-command 'play -v 0.2 -' --ssml)


Larynx will automatically download each voice the first time it's used (they're pretty big, about 220 MB each).

The "-v 0.2" is the volume, from 0 to 1.

It will continue running independently of ZK until you Ctrl+C it.

Optional: Voice configuration



Voice samples are available here; you can also get a list by running `larynx --list`. Just add the names of the ones you like to the "voices" array near the top of the widget.




Possible future improvement: Turn common acronyms like "aa" into uppercase so Larynx spells them out instead of just making an "ah" sound.

Why couldn't I use/extend the existing TTS widget: It forwards a message to Chobby, which invokes the `spd-say` program from speech-dispatcher, but unfortunately, at that point the player information is already lost, and I can't readily modify Chobby. Additionally, I didn't find a Larynx backend for speech-dispatcher, though you could just put your own fake `spd-say` command on the path I suppose.
+7 / -0
This is a great idea! I often miss chat messages and some people think I'm trolling or AFK.

Problem is, I'm struggling to install larynx (on Ubuntu 22.04).

I tried installing .deb package, but larynx wouldn't run because it can't find modules, similar to this issue.

Then I tried pip3 install, but both the command provided on larynx homepage, and simple "pip3 install larynx", installed v.0.5.0 instead of 1.1, so for example --ssml switch isn't recognized.

Installing from source with setup.py also failed as there are many dependencies with hard-coded exact version numbers.

Any ideas how to install it?

Edit: nvm, I installed mimic3 and it works out of the box, just need to adjust the widget a bit.
+0 / -0

12 months ago
Lovin' everything about this. Great stuff!
+0 / -0

12 months ago
This is super fun! I have more than 100 voices! I also added the "tail ..." command to the ZK launcher, so the setup is fully automatic.

Pity is that in German Mimic3 has some unusual voices, like "drunk", "angry" or "Angela Merkel", but in English the voices are more standard. I know a few players I'd personally ascribe to them some of those voices...

I also added a few text processing lines:

    -- remove all characters which are not alphanumeric/punctuation/spaces
    txt = string.gsub(txt, "[^%w%p%s]", '')

    -- convert to lower case, because TTS thinks that capslock words are abbreviations and spell them by letters
    txt = string.lower(txt)

    -- decipher some ZK/internet slang
    txt = string.gsub(txt, "%w+", dict)


where 'dict' is a table like

local dict = {
    aa = 'anti air',
    bb = 'Big Bertha',
    con = 'constructor',
    cs = 'chainsaw',
    drp = 'DRP',
    e = 'energy',
    fac = 'factory',
    emp = 'EMP',
    gs = 'gunships',
    gg = 'GG',
    m = 'metal',
    lol = 'hahaha',
    ok = 'okay',
    gj = 'good job',
    fw = 'fire walker',
    tb = 'Thunderbird',
    btw = 'by the way',
}
+0 / -0
12 months ago
quote:
gg = 'GG'

LOL. I guess ppl IRL will soon start saying that after, say, chess matches.
+0 / -0

12 months ago
they do already sometimes.
+0 / -0