Create an account

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Speech to text, or almost voice chat

I describe how to chat while playing, by speaking (not typing), without the necessity of the recipients installing additional software. As it is a kludge, you may want to change the details.

First install some speech to text software, such as nerd-dictation. Remember to download models for one or more languages.

As far I know, for security Xonotic can not execute external programs. So we'll have a script for executing nerd-dictation when some specific files in the .xonotic directory get changed.

Consider the following script (depending on inotify tools), which you may need to adapt, as it presupposes some directory names and that the models you have are named model-en and model-pt.


set -eu


diagn() {
  printf "%s\n" "$1" >> /dev/stderr

main() {
  cd "$xondir"


  while true ; do
    diagn "Waiting signal..."
    # Change the languages here:
    file=$(inotifywait --format %w -e modify en pt)
    diagn "Received start signal: $file"
    echo -n > "$file"
      res=$("$nerddic" begin --numbers-as-digits --vosk-model="$model" --output STDOUT | tr '\n' ' ')
      diagn "Writing text...: $res"
      printf "set nerddic_text \"%s\"" "$res" > "$outfile"
    } &
    diagn "Waiting stop signal..."
    inotifywait -e modify voicestop
    diagn "Received stop signal"
    echo -n > voicestop
    "$nerddic" "end";


Inside the .xonotic/data/ directory create the empty files: voiceout, voicestop, en and pt.

Add the following (or similar) to .xonotic/data/autoexec.cfg:

set nerddic_text "<unitialized>"

set lang en

alias voiceask "condump $lang"

alias voicestop "condump voicestop"

alias voicerecstart "cprint Recording voice... ($lang); voiceask"

alias voiceexecres "exec voiceout"

alias voicerecend "voicestop; cprint Processing, wait how much I do not know"

alias voicesayres_ "say ${nerddic_text}"

alias voicesayres "voiceexecres; voicesayres_"

alias voiceshowres_ "cprint ${nerddic_text}"

alias voiceshowres "voiceexecres; voiceshowres_"

alias voiceteamsayres_ "say_team ${nerddic_text}"

alias voiceteamsayres "voiceexecres; voiceteamsayres_"

Then start the bash script, and run Xonotic.

Note that some files are modified with condump, which writes the entire console history, a bit inefficient. Anyway, speech to text demands more power and time.

You may change the language with the Xonotic console command lang pt. You may bind some of these commands to some key presses; the command voiceshowres shows the interpreted text before publishing.

You may want to change the code to automatically send the text after recording; caution with race conditions.

It seems to be slightly practical (not much in phrenetic games). I couldn't test it rigorously because I'm not a fluent anglophone, nor I have a quality microphone.

Thanks for the attention. Suggestions? Also, I'm grateful for this marvelous game.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Chat color question Molnija 0 2,384 11-14-2018, 02:26 AM
Last Post: Molnija
  Remove color font from scoreboard and drag notify, but not chat Molnija 6 5,332 09-14-2018, 10:28 PM
Last Post: Molnija
  I want to implement voice chat lamefun 3 5,159 12-22-2013, 08:00 PM
Last Post: unfa
Rainbow Colorful in-game chat Melanosuchus 13 15,979 09-05-2013, 12:49 PM
Last Post: Mr. Bougo
Question Text right to left (xonotic menu) kariminf 5 7,040 07-08-2013, 06:00 AM
Last Post: Mr. Bougo
Brick Weapons defined in text files / de-harding weapons [feature debate] MirceaKitsune 41 45,433 10-10-2012, 03:59 PM
Last Post: hutty
  Game key bindings working while typing text AviyaL 3 5,440 09-23-2012, 05:35 AM
Last Post: Mr. Bougo
  Chat / taunt HUD portraits (need help from other coders!) MirceaKitsune 12 16,868 03-26-2011, 11:04 PM
Last Post: Lee_Stricklin

Forum Jump:

Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-