 Valdis Vitolins
					
					9 years ago
						Valdis Vitolins
					
					9 years ago
				| $(MKDIR) $(DESTDIR)$(DATADIR) | $(MKDIR) $(DESTDIR)$(DATADIR) | ||||
| cp -prf espeak-data/* $(DESTDIR)$(DATADIR) | cp -prf espeak-data/* $(DESTDIR)$(DATADIR) | ||||
| install-exec-hook: | |||||
| cd $(DESTDIR)$(BINDIR) && rm -f espeak && $(LN_S) espeak-ng espeak | |||||
| cd $(DESTDIR)$(BINDIR) && rm -f speak && $(LN_S) speak-ng speak | |||||
| cd $(DESTDIR)$(LIBDIR) && rm -f libespeak.la && $(LN_S) libespeak-ng.la libespeak.la | |||||
| clean-local: | clean-local: | ||||
| cd src && rm -f *.o *~ && cd .. | cd src && rm -f *.o *~ && cd .. | ||||
| ##### build targets: | ##### build targets: | ||||
| libespeak_ng_includedir = $(includedir)/espeak-ng | |||||
| libespeak_ng_include_HEADERS = \ | |||||
| src/include/espeak-ng/speak_lib.h | |||||
| espeak_includedir = $(includedir)/espeak | |||||
| espeak_include_HEADERS = \ | |||||
| src/include/espeak/speak_lib.h | |||||
| espeak_ng_includedir = $(includedir)/espeak-ng | |||||
| espeak_ng_include_HEADERS = \ | |||||
| src/include/espeak-ng/espeak_ng.h | |||||
| lib_LTLIBRARIES += src/libespeak-ng.la | lib_LTLIBRARIES += src/libespeak-ng.la | ||||
| src_libespeak_ng_la_LDFLAGS = -version-info $(SHARED_VERSION) -lpthread -lm | src_libespeak_ng_la_LDFLAGS = -version-info $(SHARED_VERSION) -lpthread -lm | ||||
| src_libespeak_ng_la_CFLAGS = -Isrc/include/espeak-ng \ | |||||
| src_libespeak_ng_la_CFLAGS = -Isrc/include \ | |||||
| -fPIC -fvisibility=hidden -D _BSD_SOURCE -D _POSIX_C_SOURCE=200112L \ | -fPIC -fvisibility=hidden -D _BSD_SOURCE -D _POSIX_C_SOURCE=200112L \ | ||||
| -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" | -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" | ||||
| src_libespeak_ng_la_SOURCES = \ | src_libespeak_ng_la_SOURCES = \ | ||||
| src_speak_ng_LDADD = src/libespeak-ng.la | src_speak_ng_LDADD = src/libespeak-ng.la | ||||
| src_speak_ng_LDFLAGS = -static | src_speak_ng_LDFLAGS = -static | ||||
| src_speak_ng_CFLAGS = -Isrc/libespeak-ng -Isrc/include/espeak-ng -D _POSIX_C_SOURCE=200112L | |||||
| src_speak_ng_CFLAGS = -Isrc/libespeak-ng -Isrc/include -D _POSIX_C_SOURCE=200112L | |||||
| src_speak_ng_SOURCES = src/speak-ng.c | src_speak_ng_SOURCES = src/speak-ng.c | ||||
| bin_PROGRAMS += src/espeak-ng | bin_PROGRAMS += src/espeak-ng | ||||
| endif | endif | ||||
| src_espeak_ng_LDADD = src/libespeak-ng.la | src_espeak_ng_LDADD = src/libespeak-ng.la | ||||
| src_espeak_ng_CFLAGS = -Isrc/include/espeak-ng | |||||
| src_espeak_ng_CFLAGS = -Isrc/include | |||||
| src_espeak_ng_SOURCES = src/espeak-ng.c | src_espeak_ng_SOURCES = src/espeak-ng.c | ||||
| ##### phoneme data: | ##### phoneme data: | 
| AC_PROG_CC | AC_PROG_CC | ||||
| AC_PROG_MAKE_SET | AC_PROG_MAKE_SET | ||||
| AC_PROG_LIBTOOL | AC_PROG_LIBTOOL | ||||
| AC_PROG_LN_S | |||||
| dnl ================================================================ | dnl ================================================================ | ||||
| dnl C99 compiler checks. | dnl C99 compiler checks. | 
| # Adding or Improving a Language | # Adding or Improving a Language | ||||
| # Table of contents | |||||
| - [Language Code](#language-code) | - [Language Code](#language-code) | ||||
| - [Language Files](#language-files) | - [Language Files](#language-files) | ||||
| - [Voice File](#voice-file) | - [Voice File](#voice-file) | ||||
| - [Phoneme Definition File](#phoneme-definition-file) | - [Phoneme Definition File](#phoneme-definition-file) | ||||
| - [Dictionary Files](#dictionary-files) | - [Dictionary Files](#dictionary-files) | ||||
| - [Program Code](#program-code) | - [Program Code](#program-code) | ||||
| - [Compiling rules file for debugging](#compiling-rules-file-for-debugging) | |||||
| - [Compiling Rules File for Debugging](#compiling-rules-file-for-debugging) | |||||
| - [Improving a Language](#improving-a-language) | - [Improving a Language](#improving-a-language) | ||||
| ---------- | ---------- | ||||
| during testing because most of the options can also be set in the voice | during testing because most of the options can also be set in the voice | ||||
| file in espeak-data/voices (see [Voice Files](voices.md)). | file in espeak-data/voices (see [Voice Files](voices.md)). | ||||
| ## Compiling rules file for debugging | |||||
| ## Compiling Rules File for Debugging | |||||
| When `espeak-ng` is invoked with `-X` parameter, it shows more detailed trace of | When `espeak-ng` is invoked with `-X` parameter, it shows more detailed trace of | ||||
| chosen language rules for pronunciation. This trace can show line numbers also, | chosen language rules for pronunciation. This trace can show line numbers also, | ||||
| To do this, go to `espeak-ng` project root folder, then: | To do this, go to `espeak-ng` project root folder, then: | ||||
| cd dictsource/ | |||||
| ../src/espeak-ng --compile-debug=en | |||||
| cd dictsource | |||||
| ../src/espeak-ng --compile-debug=en | |||||
| When invoked in following way: | When invoked in following way: | ||||
| es -ven -X "Test." | |||||
| espeak-ng -ven -X "Test." | |||||
| It will show: | It will show: | ||||
| -------------- | |||||
| Translate 'test' | |||||
| 1 5965: t [t] | |||||
| 1 2104: e [E] | |||||
| 1 5725: s [s] | |||||
| 1 5965: t [t] | |||||
| t'Est | |||||
| Translate 'test' | |||||
| 1 5965: t [t] | |||||
| 1 2104: e [E] | |||||
| 1 5725: s [s] | |||||
| 1 5965: t [t] | |||||
| t'Est | |||||
| ## Improving a Language | ## Improving a Language | ||||
| During the first phase of phoneme interpretation, an instruction which | During the first phase of phoneme interpretation, an instruction which | ||||
| causes a change to a different phoneme will terminate the instructions. | causes a change to a different phoneme will terminate the instructions. | ||||
| During the second phase, FMT() and WAV() instructions will terminate the | |||||
| During the second phase, `FMT()` and `WAV()` instructions will terminate the | |||||
| instructions. | instructions. | ||||
| ### length | ### length | ||||
| length <length> | length <length> | ||||
| The relative length of the phoneme, typically about 140 for a short vowel and | |||||
| from 200 to 300 for a long vowel or diphong. A `length()` instruction is | |||||
| needed for vowels. It is optional for consonants. | |||||
| The relative length of the phoneme in miliseconds. Typical values are about | |||||
| 140 for a short vowel and from 200 to 300 for a long vowel or diphong. | |||||
| A `length()` instruction is needed for vowels. It is optional for consonants. | |||||
| ### ipa | ### ipa | ||||
| \<amplitude\> is optional. It is a percentage change to the amplitude of the | \<amplitude\> is optional. It is a percentage change to the amplitude of the | ||||
| WAV file. So, `WAV(ufric/s, 50)` means: play file 'ufric/s.wav' at 50% amplitude. | WAV file. So, `WAV(ufric/s, 50)` means: play file 'ufric/s.wav' at 50% amplitude. | ||||
| Default value is 100. | |||||
| ### FMT | ### FMT | ||||
| \<vowel file\> is a path to a file (within `phsource/`) which defines how to | \<vowel file\> is a path to a file (within `phsource/`) which defines how to | ||||
| generate the sound (a vowel or voiced consonant) from a sequence of formant | generate the sound (a vowel or voiced consonant) from a sequence of formant | ||||
| values. Vowel files are made using the espeakedit program. | |||||
| values. Vowel files are made using the `espeakedit` program which is not part | |||||
| of this project. | |||||
| \<amplitude\> is optional. It is a percentage change to the amplitude of the | \<amplitude\> is optional. It is a percentage change to the amplitude of the | ||||
| sound which is synthesized from the `FMT()` instruction. | |||||
| sound which is synthesized from the `FMT()` instruction. Default value is 100. | |||||
| FMT(<vowel file>, <amplitude>) addWav(<wav file>, <amplitude>) | FMT(<vowel file>, <amplitude>) addWav(<wav file>, <amplitude>) | ||||
| VowelStart(<vowel file>, <length adjust>) | VowelStart(<vowel file>, <length adjust>) | ||||
| This is used to modify the start of a vowel when it follows a sonorant consonant | |||||
| This is used to modify the start of a vowel when it follows after a sonorant consonant | |||||
| (such as `[l]` or `[j]`). It replaces the first frame of the \<vowel file\> which | (such as `[l]` or `[j]`). It replaces the first frame of the \<vowel file\> which | ||||
| is specified in a `FMT()` instruction by this \<vowel file\>, and adjusts the | is specified in a `FMT()` instruction by this \<vowel file\>, and adjusts the | ||||
| length of the original by a signed value \<length adjust\>. The `VowelStart()` | length of the original by a signed value \<length adjust\>. The `VowelStart()` | ||||
| Vowelin <vowel transition data> | Vowelin <vowel transition data> | ||||
| (C) Specifies the effects of this consonant on the formants of a following | (C) Specifies the effects of this consonant on the formants of a following | ||||
| vowel. See "vowel transitions", below. | |||||
| vowel. See [vowel transitions](#vowel-transitions). | |||||
| ### Vowelout | ### Vowelout | ||||
| Vowelout <vowel transition data> | Vowelout <vowel transition data> | ||||
| (C) Specifies the effects of this consonant on the formants of a preceding | (C) Specifies the effects of this consonant on the formants of a preceding | ||||
| vowel. See "vowel transitions", below. | |||||
| vowel. See [vowel transitions](#vowel-transitions). | |||||
| ### ChangePhoneme | ### ChangePhoneme | ||||
| IfNextVowelAppend(<phoneme>) | IfNextVowelAppend(<phoneme>) | ||||
| If the following phoneme is a vowel then this additional phoneme will be | If the following phoneme is a vowel then this additional phoneme will be | ||||
| inserted before it. | |||||
| inserted before it. Usually it is short pause to distinguish two vowels from | |||||
| diphthongs. | |||||
| ### RETURN | ### RETURN | ||||
| There are three ways to produce sounds: | There are three ways to produce sounds: | ||||
| * Playing a WAV file, by using a `WAV()` instruction. This is used for unvoiced | * Playing a WAV file, by using a `WAV()` instruction. This is used for unvoiced | ||||
| consonants such as `[p]`, `[t]` and [s]`. | |||||
| consonants such as `[p]`, `[t]` and `[s]`. | |||||
| * Generating a wave from a sequence of formant parameters, by using a `FMT()` | * Generating a wave from a sequence of formant parameters, by using a `FMT()` | ||||
| instruction. This is used for vowels and also for sonorants such as ``[l]`, | |||||
| instruction. This is used for vowels and also for sonorants such as `[l]`, | |||||
| `[j]` and `[n]`. | `[j]` and `[n]`. | ||||
| * A mixture of these. A stored `WAV` file is mixed with a wave generated from | * A mixture of these. A stored `WAV` file is mixed with a wave generated from | ||||
| formant parameters. Use a `FMT()` instruction followed by `addWav()`. This is | formant parameters. Use a `FMT()` instruction followed by `addWav()`. This is | ||||
| len=<integer> | len=<integer> | ||||
| Nominal length of the transition in mS. If omitted a default value is used. | |||||
| Nominal length of the transition in miliseconds. If omitted a default value is used. | |||||
| rms=<integer> | rms=<integer> | ||||
| f3=<change> <amplitude> | f3=<change> <amplitude> | ||||
| \<change\>: Signed integer (Hz). Frequence change of f3, f4, and f5 formants. | |||||
| \<change\>: Signed integer (Hz). Frequency change of f3, f4, and f5 formants. | |||||
| \<amplitude\>: Amplitude of the f3, f4, and f5 formants at the end of the | \<amplitude\>: Amplitude of the f3, f4, and f5 formants at the end of the | ||||
| transition. 100 = no change. | transition. 100 = no change. | 
| #include <time.h> | #include <time.h> | ||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||
| #include "speak_lib.h" | |||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| extern void strncpy0(char *to, const char *from, int size); | extern void strncpy0(char *to, const char *from, int size); | ||||
| extern int utf8_in(int *c, const char *buf); | extern int utf8_in(int *c, const char *buf); | 
| #ifndef ESPEAK_NG_H | #ifndef ESPEAK_NG_H | ||||
| #define ESPEAK_NG_H | #define ESPEAK_NG_H | ||||
| #include "speak_lib.h" | |||||
| #include <espeak/speak_lib.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "speak_lib.h" | |||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "error.h" | #include "error.h" | ||||
| #include "speech.h" | #include "speech.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "error.h" | #include "error.h" | ||||
| #include "speech.h" | #include "speech.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "speak_lib.h" | |||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "error.h" | #include "error.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <wctype.h> | #include <wctype.h> | ||||
| #include <wchar.h> | #include <wchar.h> | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <string.h> | #include <string.h> | ||||
| #include <malloc.h> | #include <malloc.h> | ||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include "error.h" | #include "error.h" | ||||
| #include "speech.h" | #include "speech.h" | 
| #include "config.h" | #include "config.h" | ||||
| #include "speak_lib.h" | |||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #if HAVE_STDINT_H | #if HAVE_STDINT_H | 
| #include "config.h" | #include "config.h" | ||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "espeak_command.h" | #include "espeak_command.h" | 
| #ifndef PLATFORM_WINDOWS | #ifndef PLATFORM_WINDOWS | ||||
| #include <unistd.h> | #include <unistd.h> | ||||
| #endif | #endif | ||||
| #include "speak_lib.h" | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | 
| #include <errno.h> | #include <errno.h> | ||||
| #include <stdbool.h> | #include <stdbool.h> | ||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include "event.h" | #include "event.h" | ||||
| #include "wave.h" | #include "wave.h" | ||||
| */ | */ | ||||
| #include "speak_lib.h" | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | ||||
| { | { | 
| #include <sys/time.h> | #include <sys/time.h> | ||||
| #include <time.h> | #include <time.h> | ||||
| #include "espeak_ng.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "fifo.h" | #include "fifo.h" | 
| // and run them asynchronously. | // and run them asynchronously. | ||||
| #include "espeak_command.h" | #include "espeak_command.h" | ||||
| #include "speak_lib.h" | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "klatt.h" | #include "klatt.h" | 
| #include <wctype.h> | #include <wctype.h> | ||||
| #include <wchar.h> | #include <wchar.h> | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <unistd.h> | #include <unistd.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "phoneme.h" | #include "phoneme.h" | ||||
| #include "synthesize.h" | #include "synthesize.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "error.h" | #include "error.h" | ||||
| #include "speech.h" | #include "speech.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <wctype.h> | #include <wctype.h> | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <wctype.h> | #include <wctype.h> | ||||
| #include <wchar.h> | #include <wchar.h> | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include "dirent.h" | #include "dirent.h" | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "phoneme.h" | #include "phoneme.h" | ||||
| #include "synthesize.h" | #include "synthesize.h" | 
| #include <stdint.h> | #include <stdint.h> | ||||
| #endif | #endif | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "speech.h" | #include "speech.h" | ||||
| #include "phoneme.h" | #include "phoneme.h" | 
| #include <locale.h> | #include <locale.h> | ||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||
| #include "espeak_ng.h" | |||||
| #include "speak_lib.h" | |||||
| #include <espeak-ng/espeak_ng.h> | |||||
| #include <espeak/speak_lib.h> | |||||
| #include "phoneme.h" | #include "phoneme.h" | ||||
| #include "synthesize.h" | #include "synthesize.h" |