Commit 49b9228e authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #471 from thomasgubler/espeak

linux speech synthesis: switch to eSpeak
parents d8212e3a 604752c6
......@@ -523,7 +523,7 @@ MacBuild {
##
# [OPTIONAL] Speech synthesis library support.
# Can be forcibly disabled by adding a `DEFINES+=DISABLE_SPEECH` argument to qmake.
# Linux support requires the Festival Lite speech synthesis engine (flite).
# Linux support requires the eSpeak speech synthesizer (espeak).
# Mac support is provided in Snow Leopard and newer (10.6+)
# Windows is supported as of Windows 7
#
......@@ -534,18 +534,11 @@ contains (DEFINES, DISABLE_SPEECH) {
} else:infile(user_config.pri, DEFINES, DISABLE_SPEECH) {
message("Skipping support for speech output (manual override from user_config.pri)")
} else:LinuxBuild {
exists(/usr/include/flite) | exists(/usr/local/include/flite) {
exists(/usr/include/espeak) | exists(/usr/local/include/espeak) {
message("Including support for speech output")
DEFINES += QGC_SPEECH_ENABLED
LIBS += \
-lflite_cmu_us_kal \
-lflite_usenglish \
-lflite_cmulex \
-lflite
# We need to add the alsa asound library as well for some Linux platforms
# (like Arch)
LIBS += -lasound
-lespeak
} else {
warning("Skipping support for speech output (missing libraries, see README)")
}
......
......@@ -44,7 +44,7 @@ An add-on is available for QGC that provides a UI for generating MAVLink dialect
Integration with Opal-RT's RT-LAB simulator can be enabled on Windows by installing RT-LAB 7.2.4. This allows vehicles to be simulated in RT-LAB and communicate directly with QGC on the same computer as if the UAS was actually deployed. This support is enabled by default once the requisite RT-LAB software is installed. Disabling this can be done by adding `DISABLE_RTLAB` to the `DEFINES` variable.
### Speech syntehsis
QGroundcontrol can notify the controller of information via speech synthesis. This requires the `flite` library on Linux. On Mac and Windows support is built in to the OS as of OS X 10.6 (Snow Leopard) and Windows Vista. This support is enabled by default on all platforms if the dependencies are met. Disabling this functionality can be done by adding `DISABLE_SPEECH` to the `DEFINES` variable.
QGroundcontrol can notify the controller of information via speech synthesis. This requires the `espeak` library on Linux. On Mac and Windows support is built in to the OS as of OS X 10.6 (Snow Leopard) and Windows Vista. This support is enabled by default on all platforms if the dependencies are met. Disabling this functionality can be done by adding `DISABLE_SPEECH` to the `DEFINES` variable.
### 3D view
The OpenSceneGraph libraries provide 3D rendering to the map overlays that QGC can provide.
......@@ -92,9 +92,10 @@ To build on Linux:
* For Fedora: `sudo yum install qt qt-creator qt-webkit-devel SDL-devel SDL-static systemd-devel`
2. **[OPTIONAL]** Install additional libraries
* For text-to-speech (flite)
* For Ubuntu: `sudo apt-get install libflite1 flite1-dev`
* For Fedora: `sudo yum install flite-devel`
* For text-to-speech (espeak)
* For Ubuntu: `sudo apt-get install espeak libespeak-dev`
* For Fedora: `sudo yum install espeak espeak-devel`
* For Arch Linux: `pacman -Sy espeak`
* For 3D flight view (openscenegraph)
* For Ubuntu: `sudo apt-get install libopenscenegraph-dev`
* For Fedora: `sudo yum install OpenSceneGraph-qt-devel`
......
......@@ -26,6 +26,7 @@ This file is part of the QGROUNDCONTROL project
* @brief Implementation of audio output
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Thomas Gubler <thomasgubler@gmail.com>
*
*/
......@@ -51,10 +52,8 @@ This file is part of the QGROUNDCONTROL project
#endif
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
extern "C" {
#include <flite/flite.h>
cst_voice *register_cmu_us_kal(const char *voxdir);
};
// Using eSpeak for speech synthesis: following https://github.com/mondhs/espeak-sample/blob/master/sampleSpeak.cpp
#include <espeak/speak_lib.h>
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
......@@ -97,7 +96,12 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
flite_init();
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 500, NULL, 0); // initialize for playback with 500ms buffer and no options (see speak_lib.h)
espeak_VOICE espeak_voice = {};
espeak_voice.languages = "en-uk"; // Default to British English
espeak_voice.name = "klatt"; // espeak voice name
espeak_voice.gender = 2; // Female
espeak_SetVoiceByProperties(&espeak_voice);
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
......@@ -206,20 +210,8 @@ bool GAudioOutput::say(QString text, int severity)
#endif
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav");
if (file.open())
{
cst_voice *v = register_cmu_us_kal(NULL);
cst_wave *wav = flite_text_to_wave(text.toStdString().c_str(), v);
// file.fileName() returns the unique file name
cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff");
m_media->setCurrentSource(Phonon::MediaSource(QUrl::fromLocalFile(file.fileName().toStdString().c_str())));
m_media->play();
res = true;
}
unsigned int espeak_size = strlen(text.toStdString().c_str());
espeak_Synth(text.toStdString().c_str(), espeak_size, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL);
#endif
#if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
......
......@@ -40,9 +40,6 @@ This file is part of the PIXHAWK project
#include <AudioOutput>
#endif
#ifdef Q_OS_LINUX
#if defined QGC_SPEECH_ENABLED
//#include <flite/flite.h>
#endif
#include <phonon/MediaObject>
#include <phonon/AudioOutput>
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment