Here's a "fix" for the existing & totally broken festival speech
synthesis interface. The new implementation isn't part of the ATC
subsystem any more, but resides in the Sound/ dir. It can be called
via FGVoiceMgr::say(string), or simply by writing to property
/sim/sound/speech, and is so available for Nasal/telnet/http/...
(Tutorials/Instructor voice, Copilot hints, warnings, ATC, ...)

ATC doesn't use it by default, but a simple Nasal instruction can
forward ATC messages to the synthesizer:

    setlistener("/sim/messages/atc", func {
        var msg = cmdarg().getValue();
        setprop("/sim/sound/speech", msg);
        screen.log.write(msg);
        print("ATC: " ~ msg);
    });

Of course you can also set /sim/sound/speech in the property
browser. And, of course, you need to install and start the festival
speech synthesizer[1], which is cross platform and open source:

  $ nice festival --server &

On the fgfs side:

  1) apply the attached patch "basedir.diff" in your fgfs dir
  2) copy these two files to src/Sound/:
     http://members.aon.at/mfranz/voice.cxx  [2.5 kB]
     http://members.aon.at/mfranz/voice.hxx  [2 kB]
  3) configure && make

Currently, you get a harmless error message if the festival server
isn't found on localhost:1314. You can set a different host and port
under /sim/presets/voice/{host,port}.

The old code was apparently never in broad use (it has a hard-coded
and unusable host address, uses a non-default port, uses wrong/obsolete
commands, doesn't use sg socket code, doesn't use threads, does only
work for ATC, ...)

Please test and complain.

m.

[1] http://www.cstr.ed.ac.uk/projects/festival/
Index: src/Main/fg_init.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Main/fg_init.cxx,v
retrieving revision 1.150
diff -u -p -r1.150 fg_init.cxx
--- src/Main/fg_init.cxx	30 Jan 2006 13:29:50 -0000	1.150
+++ src/Main/fg_init.cxx	5 Feb 2006 16:38:38 -0000
@@ -106,6 +106,7 @@
 #include <Sound/fg_fx.hxx>
 #include <Sound/beacon.hxx>
 #include <Sound/morse.hxx>
+#include <Sound/voice.hxx>
 #include <Systems/system_mgr.hxx>
 #include <Time/light.hxx>
 #include <Time/sunsolver.hxx>
@@ -1677,6 +1678,7 @@ bool fgInitSubsystems() {
     ////////////////////////////////////////////////////////////////////
 
     globals->add_subsystem("fx", new FGFX);
+    globals->add_subsystem("voice", new FGVoiceMgr());
     
 #endif
 
Index: src/Sound/Makefile.am
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Sound/Makefile.am,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.am
--- src/Sound/Makefile.am	9 May 2003 18:44:35 -0000	1.2
+++ src/Sound/Makefile.am	5 Feb 2006 16:38:38 -0000
@@ -3,6 +3,7 @@ noinst_LIBRARIES = libSound.a
 libSound_a_SOURCES = \
 	beacon.cxx beacon.hxx \
 	fg_fx.cxx fg_fx.hxx \
-	morse.cxx morse.hxx
+	morse.cxx morse.hxx \
+	voice.cxx voice.hxx
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

Reply via email to