Browse Source

Merge branch 'master' into android

master
Reece H. Dunn 11 years ago
parent
commit
b82375ffab
10 changed files with 103 additions and 46 deletions
  1. 28
    9
      Makefile.am
  2. 54
    0
      configure.ac
  3. 2
    4
      src/espeak_command.cpp
  4. 2
    6
      src/event.cpp
  5. 2
    6
      src/fifo.cpp
  6. 1
    5
      src/klatt.cpp
  7. 1
    3
      src/mbrowrap.cpp
  8. 0
    2
      src/sonic.cpp
  9. 12
    1
      src/spectseq.cpp
  10. 1
    10
      src/speech.h

+ 28
- 9
Makefile.am View File

libespeak_include_HEADERS = \ libespeak_include_HEADERS = \
src/speak_lib.h src/speak_lib.h


common_FLAGS =
common_SOURCE = \ common_SOURCE = \
src/compiledict.cpp \ src/compiledict.cpp \
src/dictionary.cpp \ src/dictionary.cpp \
src/intonation.cpp \ src/intonation.cpp \
src/klatt.cpp \
src/mbrowrap.cpp \
src/numbers.cpp \ src/numbers.cpp \
src/readclause.cpp \ src/readclause.cpp \
src/phonemelist.cpp \ src/phonemelist.cpp \
src/setlengths.cpp \ src/setlengths.cpp \
src/sonic.cpp \
src/synthdata.cpp \ src/synthdata.cpp \
src/synthesize.cpp \ src/synthesize.cpp \
src/synth_mbrola.cpp \ src/synth_mbrola.cpp \
src/voices.cpp \ src/voices.cpp \
src/wavegen.cpp src/wavegen.cpp


libespeak_FLAGS =
libespeak_SOURCE = \ libespeak_SOURCE = \
src/speak_lib.cpp \ src/speak_lib.cpp \
src/espeak_command.cpp \
src/event.cpp \
src/fifo.cpp \
src/debug.cpp src/debug.cpp


espeakedit_SOURCE = \ espeakedit_SOURCE = \
src/voicedlg.cpp \ src/voicedlg.cpp \
src/vowelchart.cpp src/vowelchart.cpp


if OPT_KLATT
common_FLAGS += -DINCLUDE_KLATT
common_SOURCE += src/klatt.cpp
endif

if OPT_MBROLA
common_FLAGS += -DINCLUDE_MBROLA
common_SOURCE += src/mbrowrap.cpp
endif

if OPT_SONIC
common_FLAGS += -DINCLUDE_SONIC
common_SOURCE += src/sonic.cpp
endif

if OPT_ASYNC
libespeak_FLAGS += -DUSE_ASYNC
libespeak_SOURCE += \
src/espeak_command.cpp \
src/event.cpp \
src/fifo.cpp
endif

if AUDIO_RUNTIME if AUDIO_RUNTIME
wave_SOURCE = src/wave.cpp src/wave_pulse.cpp wave_SOURCE = src/wave.cpp src/wave_pulse.cpp
wave_LIBS = -lpulse -lpulse-simple -lportaudio wave_LIBS = -lpulse -lpulse-simple -lportaudio
lib_LTLIBRARIES += src/libespeak.la lib_LTLIBRARIES += src/libespeak.la


src_libespeak_la_LDFLAGS = -version-info $(SHARED_VERSION) $(wave_LIBS) -lpthread src_libespeak_la_LDFLAGS = -version-info $(SHARED_VERSION) $(wave_LIBS) -lpthread
src_libespeak_la_CXXFLAGS = $(wave_FLAGS) \
src_libespeak_la_CXXFLAGS = $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-fpic -fvisibility=hidden -D LIBRARY \ -fpic -fvisibility=hidden -D LIBRARY \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE) src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE)
bin_PROGRAMS += src/speak bin_PROGRAMS += src/speak


src_speak_LDFLAGS = $(wave_LIBS) -lpthread src_speak_LDFLAGS = $(wave_LIBS) -lpthread
src_speak_CXXFLAGS = $(wave_FLAGS)
src_speak_CXXFLAGS = $(common_FLAGS) $(wave_FLAGS)
src_speak_SOURCES = src/speak.cpp $(common_SOURCE) $(wave_SOURCE) src_speak_SOURCES = src/speak.cpp $(common_SOURCE) $(wave_SOURCE)


bin_PROGRAMS += src/espeak bin_PROGRAMS += src/espeak
bin_PROGRAMS += src/espeakedit bin_PROGRAMS += src/espeakedit


src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS} src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS}
src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(wave_FLAGS) \
src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE) src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE)



+ 54
- 0
configure.ac View File

AM_CONDITIONAL(AUDIO_PORTAUDIO, [test x"$AUDIO" = xportaudio]) AM_CONDITIONAL(AUDIO_PORTAUDIO, [test x"$AUDIO" = xportaudio])
AM_CONDITIONAL(AUDIO_SADA, [test x"$AUDIO" = xsada]) AM_CONDITIONAL(AUDIO_SADA, [test x"$AUDIO" = xsada])


dnl ================================================================
dnl Optional compilation checks.
dnl ================================================================

AC_ARG_WITH([klatt],
[AS_HELP_STRING([--with-klatt], [enable the Klatt formant synthesizer @<:@default=yes@:>@])],
[])

if test "$with_klatt" = "no" ; then
have_klatt=no
else
have_klatt=yes
fi

AC_ARG_WITH([mbrola],
[AS_HELP_STRING([--with-mbrola], [enable the MBROLA speech synthesizer @<:@default=yes@:>@])],
[])

if test "$with_mbrola" = "no" ; then
have_mbrola=no
else
have_mbrola=yes
fi

AC_ARG_WITH([sonic],
[AS_HELP_STRING([--with-sonic], [enable the sonic library to speed up the audio @<:@default=yes@:>@])],
[])

if test "$with_sonic" = "no" ; then
have_sonic=no
else
have_sonic=yes
fi

AC_ARG_WITH([async],
[AS_HELP_STRING([--with-async], [enable support for async command processing @<:@default=yes@:>@])],
[])

if test "$with_async" = "no" ; then
have_async=no
else
have_async=yes
fi

AM_CONDITIONAL(OPT_KLATT, [test x"$have_klatt" = xyes])
AM_CONDITIONAL(OPT_MBROLA, [test x"$have_mbrola" = xyes])
AM_CONDITIONAL(OPT_SONIC, [test x"$have_sonic" = xyes])
AM_CONDITIONAL(OPT_ASYNC, [test x"$have_async" = xyes])

dnl ================================================================ dnl ================================================================
dnl wxWidgets checks. dnl wxWidgets checks.
dnl ================================================================ dnl ================================================================
portaudio: ${have_portaudio} portaudio: ${have_portaudio}
sada: ${have_sada} sada: ${have_sada}
audio configuration: ${AUDIO} audio configuration: ${AUDIO}

Klatt: ${have_klatt}
MBROLA: ${have_mbrola}
Sonic: ${have_sonic}
Async: ${have_async}
]) ])

+ 2
- 4
src/espeak_command.cpp View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "speech.h"


#ifdef USE_ASYNC
// This source file is only used for asynchronious modes // This source file is only used for asynchronious modes


#include "speech.h"
#include "espeak_command.h" #include "espeak_command.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
} }
#endif #endif
} }

#endif
//> //>

+ 2
- 6
src/event.cpp View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/


#include "speech.h"

#ifdef USE_ASYNC
// This source file is only used for asynchronious modes // This source file is only used for asynchronious modes




#include <sys/time.h> #include <sys/time.h>
#include <errno.h> #include <errno.h>


#include "speech.h"
#include "speak_lib.h" #include "speak_lib.h"
#include "event.h" #include "event.h"
#include "wave.h" #include "wave.h"
init(); // purge event init(); // purge event
} }
} }

#endif
//> //>


+ 2
- 6
src/fifo.cpp View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "speech.h"


#ifdef USE_ASYNC
// This source file is only used for asynchronious modes // This source file is only used for asynchronious modes



//<includes //<includes


#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>


#include "speech.h"
#include "fifo.h" #include "fifo.h"
#include "wave.h" #include "wave.h"
#include "debug.h" #include "debug.h"


init(0); // purge fifo init(0); // purge fifo
} }

#endif
//> //>


+ 1
- 5
src/klatt.cpp View File


/*************************************************************************** /***************************************************************************
* Copyright (C) 2008 by Jonathan Duddington * * Copyright (C) 2008 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* Based on a re-implementation by: * * Based on a re-implementation by: *
* (c) 1993,94 Jon Iles and Nick Ing-Simmons * * (c) 1993,94 Jon Iles and Nick Ing-Simmons *
#include "synthesize.h" #include "synthesize.h"
#include "voice.h" #include "voice.h"


#ifdef INCLUDE_KLATT // conditional compilation for the whole file

extern unsigned char *out_ptr; // **JSD extern unsigned char *out_ptr; // **JSD
extern unsigned char *out_start; extern unsigned char *out_start;
extern unsigned char *out_end; extern unsigned char *out_end;
kt_frame.AVpdb = 0; kt_frame.AVpdb = 0;
kt_frame.Gain0 = 62; // 60 kt_frame.Gain0 = 62; // 60
} // end of KlattInit } // end of KlattInit

#endif // INCLUDE_KLATT

+ 1
- 3
src/mbrowrap.cpp View File

* providing a subset of the API from the Windows mbrola DLL. * providing a subset of the API from the Windows mbrola DLL.
* *
* Copyright (C) 2010 by Nicolas Pitre <[email protected]> * Copyright (C) 2010 by Nicolas Pitre <[email protected]>
* Copyright (C) 2013 Reece H. Dunn
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
*/ */


#include "speech.h" #include "speech.h"
#ifdef INCLUDE_MBROLA


#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
{ {
mbr_errorbuf[0] = 0; mbr_errorbuf[0] = 0;
} }

#endif // INCLUDE_MBROLA

+ 0
- 2
src/sonic.cpp View File



#include "speech.h" #include "speech.h"
#include "sonic.h" #include "sonic.h"
#ifdef INCLUDE_SONIC


struct sonicStreamStruct { struct sonicStreamStruct {
short *inputBuffer; short *inputBuffer;
sonicDestroyStream(stream); sonicDestroyStream(stream);
return numSamples; return numSamples;
} }
#endif // INCLUDE_SONIC

+ 12
- 1
src/spectseq.cpp View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington * * Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough #define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough




#ifdef INCLUDE_KLATT
extern void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control); extern void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control);
extern int Wavegen_Klatt(int resume); extern int Wavegen_Klatt(int resume);
extern void KlattReset(int control);
#endif


extern void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v); extern void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v);
extern int Wavegen(); extern int Wavegen();
extern void CloseWaveFile2(); extern void CloseWaveFile2();
extern void KlattReset(int control);
extern FILE *f_wave; extern FILE *f_wave;


static int frame_width; static int frame_width;
out_ptr = out_start = wav_outbuf; out_ptr = out_start = wav_outbuf;
out_end = &wav_outbuf[sizeof(wav_outbuf)]; out_end = &wav_outbuf[sizeof(wav_outbuf)];


#ifdef INCLUDE_KLATT
if(synthesis_method == 1) if(synthesis_method == 1)
result = Wavegen_Klatt(resume); result = Wavegen_Klatt(resume);
else else
#endif
result = Wavegen(); result = Wavegen();


if(f_wave != NULL) if(f_wave != NULL)


if(voice->klattv[0]) if(voice->klattv[0])
{ {
#ifdef INCLUDE_KLATT
SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples
#endif
} }
else else
{ {
if(voice->klattv[0]) if(voice->klattv[0])
{ {
synthesizer_type = 1; synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2); KlattReset(2);
#endif
} }


SpeakNextClause(NULL,NULL,2); // stop speaking file SpeakNextClause(NULL,NULL,2); // stop speaking file
if(voice->klattv[0]) if(voice->klattv[0])
{ {
synthesizer_type = 1; synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2); KlattReset(2);
#endif
} }


SpeakNextClause(NULL,NULL,2); // stop speaking file SpeakNextClause(NULL,NULL,2); // stop speaking file

+ 1
- 10
src/speech.h View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington * * Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *


#include <sys/types.h> #include <sys/types.h>


// conditional compilation options
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC

#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
#define ARCH_BIG #define ARCH_BIG
#endif #endif
#define __cdecl #define __cdecl
//#define ESPEAK_API extern "C" //#define ESPEAK_API extern "C"


#ifdef LIBRARY
#define USE_ASYNC
#endif

#ifdef _ESPEAKEDIT #ifdef _ESPEAKEDIT
#define USE_ASYNC
#define LOG_FRAMES // write keyframe info to log-espeakedit #define LOG_FRAMES // write keyframe info to log-espeakedit
#endif #endif



Loading…
Cancel
Save