* : ; b C d f g | * : ; b C d f g | ||||
h j k l m n N n^ | h j k l m n N n^ | ||||
p Q r s S S; t tS | p Q r s S t tS v | ||||
v v2 w x z | v2 w x z | ||||
Dictionary no_dict | Dictionary no_dict | ||||
l- l: o o: oU r- r: u | l- l: o o: oU r- r: u | ||||
u: | u: | ||||
* ; b c d d; dZ f | * ; b d d; dZ f g | ||||
g h j k l l^ m n | h j k l l^ m n N | ||||
N n^ p r R R^ R^/ s | n^ p r R R^ R^/ s S | ||||
S t t; tS ts v x z | t t; tS ts v x z Z | ||||
Z | |||||
Dictionary sv_dict | Dictionary sv_dict | ||||
Dictionary zhy_dict | Dictionary zhy_dict | ||||
a aa aai aang aau ai au e | a aa aai aan aau ai au e | ||||
ei eo eoi eu i iu o oe | ei eo eoi eu i iu o oe | ||||
oi ong ou u ui yu | oi ong ou u ui yu | ||||
: f j k kh l m n | : f j k kh l m n | ||||
N p ph r R s s. S; | N p ph r R s s. S; | ||||
t th ts ts. ts.h tS; tS;h tsh | t th ts ts. ts. tS; tS; tsh | ||||
v w x z z. | v w x z z. | ||||
// ?8 Use full vowel, not schwa in some word endings | // ?8 Use full vowel, not schwa in some word endings | ||||
.replace | .replace | ||||
ff f // ligature | ff ff // ligature | ||||
fi fi | fi fi | ||||
fl fl | fl fl | ||||
_s Es | _s Es | ||||
_t te: | _t te: | ||||
_cap k'a:pita:l | _cap h'o:fdlEt@r | ||||
_?A l'Et@r | _?A l'Et@r | ||||
_?? s'imbo:l | _?? s'imbo:l | ||||
// punctuation | // punctuation | ||||
_. p8nt | _. p8nt | ||||
_, k'Oma: | |||||
_: d'8b@l@p,8nt | |||||
_; p'8ntkOm,a: | |||||
/ sl'As | |||||
_\ b'AkkslAs | |||||
_? v@-*'a:xte:k@n | |||||
_! 'Wyt@-*upt,e:k@n | |||||
_" 'a:nha:lInxste:k@n | |||||
@ 'a:p@nst,a:rt;@ | |||||
# h'Ekj@ | |||||
% p@-*o:s'Ent | |||||
_( h'a:kj@_|'o:pe:n@n | |||||
_) h'a:kj@sl'Wyt@n | |||||
_{ v'irkAnt@h,a:k | |||||
_} v'irkAnt@h,a:ksl'Wyt@n | |||||
_- k'OpElt,e:k@n | |||||
+ pl'8s | |||||
* st'E*rEt;@ | |||||
__ l'IgEntst@-*'e:pj@ | |||||
€ 'Y:*o:t,e:k@n | |||||
// numbers | // numbers | ||||
_0 n'8l | _0 n'8l | ||||
_9 n'e:x@n | _9 n'e:x@n | ||||
_10 t'in | _10 t'in | ||||
_11 'Elf | _11 'Elf | ||||
_12 tw'Alf | _12 tw'a:lf | ||||
_13 d'e:rtin | _13 d'Ertin | ||||
_14 f'e:rtin | _14 f'e:rtin | ||||
_15 f'EIftin | _15 f'EIftin | ||||
_16 z'Estin | _16 z'Estin | ||||
the _^_EN | the _^_EN | ||||
// pronunciation exceptions | // pronunciation exceptions | ||||
eren I:*@n | |||||
_) be (@P2 b@ | _) be (@P2 b@ | ||||
_) b (ee+ b | _) b (ee+ b | ||||
_) be( ren bI: | |||||
_) be (ter be: | _) be (ter be: | ||||
_) beu bY: | _) beu bY: | ||||
ee e: | ee e: | ||||
eeuw eU | eeuw eU | ||||
eu Y: | eu Y: | ||||
@) el (_ @l | |||||
@) ele (_ @l@ | |||||
@) en (_ @n | @) en (_ @n | ||||
@) er (_ @r | @) er (_ @r | ||||
@) ere (_ @r@ | |||||
@) eren (_ @r@n | @) eren (_ @r@n | ||||
eau o: //words with French origin | eau o: //words with French origin | ||||
.group k | .group k | ||||
_) k (_ kA | _) k (_ ka: | ||||
k k | k k | ||||
kk k | kk k | ||||
_) s (_ Es | _) s (_ Es | ||||
s s | s s | ||||
ss s | ss s | ||||
sch S; | sch sx | ||||
sj S | sj S | ||||
.group | .group | ||||
éé e: | éé e: | ||||
$ d'OlAr | |||||
, (D k'Oma: | , (D k'Oma: | ||||
% pro:s'Ent | __) - (_D m'In | ||||
@ 'a:pEnst,a:rt;@ | |||||
. p8nt | . p8nt | ||||
. (. _: | . (. _: |
<hr> | <hr> | ||||
<h2>2.1 INSTALLATION</h2> | <h2>2.1 INSTALLATION</h2> | ||||
<hr> | <hr> | ||||
(This section only applies to Linux and other Posix systems).<br> | <h3>2.1.1 Linux and other Posix systems</h3> | ||||
There are two versions of the command line program. They both have the same command parameters (see below). | There are two versions of the command line program. They both have the same command parameters (see below). | ||||
<ol> | <ol> | ||||
<li><strong>espeak</strong> uses speech engine in the <strong>libespeak</strong> shared library. The libespeak library must first be installed. | <li><strong>espeak</strong> uses speech engine in the <strong>libespeak</strong> shared library. The libespeak library must first be installed. | ||||
Some Linux distrubitions (eg. SuSe 10) have version 19 of PortAudio which has a slightly different API. The speak program can be compiled to use version 19 of PortAudio by copying the file portaudio19.h to portaudio.h before compiling.<p> | Some Linux distrubitions (eg. SuSe 10) have version 19 of PortAudio which has a slightly different API. The speak program can be compiled to use version 19 of PortAudio by copying the file portaudio19.h to portaudio.h before compiling.<p> | ||||
The speak program may be compiled without using PortAudio, by removing the line<pre> #define USE_PORTAUDIO | The speak program may be compiled without using PortAudio, by removing the line<pre> #define USE_PORTAUDIO | ||||
</pre>in the file speech.h. | </pre>in the file speech.h. | ||||
<p> <hr> | |||||
<h3>2.1.2 Use with KDE Text-to-Speech (KTTS)</h3> | |||||
To add to KDE-Text-to-Speech Manager (KTTSMgr), use it as a "Command" talker | |||||
with "command for speaking texts" set to:<br> | |||||
<strong>cat %f | espeak --stdin -w %w -v en -s190</strong> | |||||
<p> | |||||
In this example, "en" is the voice name, "190" is the speed. | |||||
<p> | |||||
Note: | |||||
<ul> | |||||
<li>When used by the KTTS system, I noticed a slight background hiss with the speech, which is not present when I use <strong>espeak</strong> directly from the command line. This was because KDE sound default was set to "8 bits" rather than 16 bits.<p> | |||||
<li>KTTSMgr breaks the text into sentences to pass to the speech engine, but it mistakenly assumes sentence breaks when dots follow abbreviations and therefore pauses after the dots in "eg. Mr. John B. Smith etc." Speaking a text file directly with <strong>espeak</strong> gives better results in this respect. | |||||
</ul> | |||||
<p> <hr> | |||||
<h3>2.1.3 Windows</h3> | |||||
The installer: <strong>setup_espeak.exe</strong> installs the SAPI5 version of eSpeak. It also installs a command line program <strong>espeak</strong> in the espeak directory. | |||||
<p> <hr> | <p> <hr> | ||||
<h2>2.2 COMMAND OPTIONS</h2> | <h2>2.2 COMMAND OPTIONS</h2> | ||||
<hr> | <hr> | ||||
followed by text on subsequent lines. Each line is spoken when | followed by text on subsequent lines. Each line is spoken when | ||||
RETURN is pressed.<br>Use <strong>espeak -x</strong> to see the corresponding phoneme codes. | RETURN is pressed.<br>Use <strong>espeak -x</strong> to see the corresponding phoneme codes. | ||||
<p> <hr> | <p> <hr> | ||||
<h3>2.2.2 Use with KDE Text-to-Speech (KTTS)</h3> | <h3>2.2.2 The Command Line Options</h3> | ||||
To add to KDE-Text-to-Speech Manager (KTTSMgr), use it as a "Command" talker | |||||
with "command for speaking texts" set to:<br> | |||||
<strong>cat %f | espeak --stdin -v en -w %w</strong> | |||||
<p> | |||||
Note: | |||||
<ul> | |||||
<li>When used by the KTTS system, I noticed a slight background hiss with the speech, which is not present when I use <strong>espeak</strong> directly from the command line. This was because KDE sound default was set to "8 bits" rather than 16 bits. | |||||
<li>KTTSMgr breaks the text into sentences to pass to the speech engine, but it mistakenly assumes sentence breaks when dots follow abbreviations and therefore pauses after the dots in "eg. Mr. John B. Smith etc." Speaking a text file directly with <strong>espeak</strong> gives better results in this respect. | |||||
<li>Speaking text from a web page using KTTS often causes headings and image captions to be run together with the following text as a single sentence. Speaking the HTML directly with the <strong>-m</strong> option set (i.e. using <strong>espeak -m -f text.html</strong>), may help if this is a problem. | |||||
</ul> | |||||
<p> <hr> | |||||
<h3>2.2.3 The Command Line Options</h3> | |||||
<dl> | <dl> | ||||
<dt> | <dt> | ||||
<strong>espeak [options] ["text words"]</strong><br> | <strong>espeak [options] ["text words"]</strong><br> | ||||
<strong>--voices [=<language code>]</strong><br> | <strong>--voices [=<language code>]</strong><br> | ||||
<dd>Lists the available voices.<br> | <dd>Lists the available voices.<br> | ||||
If =<language code> is present then only those voices which are suitable for that language are listed.<br> | If =<language code> is present then only those voices which are suitable for that language are listed.<br> | ||||
<code>--voices=variant</code> lists the voice variants (voice modifiers). | <code>--voices=mbrola</code> lists the voices which use mbrola diphone voices. These are not included in the <code>--voices</code> list<br> | ||||
<code>--voices=variant</code> lists the voice variants (voice modifiers).<br> | |||||
</dl> | </dl> | ||||
<p> <hr> | <p> <hr> | ||||
<h3>2.2.4 The Input Text</h3> | <h3>2.2.3 The Input Text</h3> | ||||
<dl> | <dl> | ||||
<dt><b>HTML Input</b> | <dt><b>HTML Input</b> | ||||
<dd> | <dd> | ||||
<p> | <p> | ||||
<dt><b>Phoneme Input</b> | <dt><b>Phoneme Input</b> | ||||
<dd> | <dd> | ||||
As well as plain text, phoneme mnemonics can be used in the text input to <strong>espeak</strong>. They are enclosed within double square brackets. Spaces are used to separate words and all stressed syllables must be marked explicitly.<br> | As well as plain text, phoneme mnemonics can be used in the text input to <strong>espeak</strong>. They are enclosed within double square brackets. Spaces are used to separate words and all stressed syllables must be marked explicitly.<p> | ||||
eg: <code> [[D,Is Iz sVm f@n'EtIk t'Ekst 'InpUt]] </code> | eg: <code> espeak -v en [[D,Is Iz sVm f@n'EtIk t'Ekst 'InpUt]] </code><p> | ||||
("This is some phonetic text input"). | |||||
</dl> | </dl> | ||||
</body> | </body> | ||||
</b> | </b> |
[p2] fr | [p2] fr | ||||
[ph] hi | [ph] hi | ||||
[ph] zh | [ph] zh | ||||
ustop/percus10 [(X1)] base | ustop/percus10 [(X1] base | ||||
ustop/pl [p] base | ustop/pl [p] base | ||||
[p] base2 | [p] base2 | ||||
[p] fi | [p] fi | ||||
ustop/t_short [t.] hi | ustop/t_short [t.] hi | ||||
[t] sk | [t] sk | ||||
[t] el | [t] el | ||||
ustop/tsh_pzd [tS;h] zh | ustop/tsh_pzd [tS;] zh | ||||
ustop/tsh_pzd_unasp [tS;] zh | ustop/tsh_pzd_unasp [tS;] zh | ||||
ustop/tsh_sr [tS] sr | ustop/tsh_sr [tS] sr | ||||
ustop/ts_pzd [tS;] base | ustop/ts_pzd [tS;] base | ||||
[c] hu | [c] hu | ||||
ustop/t_sr [d] sr | ustop/t_sr [d] sr | ||||
[t] sr | [t] sr | ||||
ustop/ts_rfx [ts.h] zh | ustop/ts_rfx [ts.] zh | ||||
ustop/ts_rfx_unasp [ts.] zh | ustop/ts_rfx_unasp [ts.] zh | ||||
ustop/ts_sr [tS;] sr | ustop/ts_sr [tS;] sr | ||||
[dZ;] sr | [dZ;] sr | ||||
vwl_ru/u# [u#] ru | vwl_ru/u# [u#] ru | ||||
vwl_ru/u#u [u"] ru | vwl_ru/u#u [u"] ru | ||||
vwl_sv/r_sv3 [r] sv | vwl_sv/r_sv3 [r] sv | ||||
vwl_zh/aang [aang] zhy | vwl_zh/aang [aan] zhy | ||||
vwl_zh/aau [Au] zh | vwl_zh/aau [Au] zh | ||||
vwl_zh/a_n [a] zh | vwl_zh/a_n [a] zh | ||||
vwl_zh/ang [ang] zhy | vwl_zh/ang [ang] zhy | ||||
vwl_zh/ing [ing] zhy | vwl_zh/ing [ing] zhy | ||||
vwl_zh/iou [iou] zh | vwl_zh/iou [iou] zh | ||||
vwl_zh/ng [ng] zhy | vwl_zh/ng [ng] zhy | ||||
vwl_zh/oeng [oeng] zhy | vwl_zh/oeng [oen] zhy | ||||
vwl_zh/ong [ong] zhy | vwl_zh/ong [ong] zhy | ||||
vwl_zh/uaa [uA] zh | vwl_zh/uaa [uA] zh | ||||
vwl_zh/uai [uai] zh | vwl_zh/uai [uai] zh |
else | else | ||||
{ | { | ||||
EncodePhonemes(phonetic,encoded_ph,bad_phoneme); | EncodePhonemes(phonetic,encoded_ph,bad_phoneme); | ||||
printf("Encode: [%s] = %.2x %.2x %.2x\n",phonetic,encoded_ph[0],encoded_ph[1],encoded_ph[2]); | |||||
if(strchr(encoded_ph,phonSWITCH) != 0) | if(strchr(encoded_ph,phonSWITCH) != 0) | ||||
{ | { | ||||
flag_codes[n_flag_codes++] = BITNUM_FLAG_ONLY_S; // don't match on suffixes (except 's') when switching languages | flag_codes[n_flag_codes++] = BITNUM_FLAG_ONLY_S; // don't match on suffixes (except 's') when switching languages |
} | } | ||||
// use the following macros for translation from little endian to host's endianness | static int reverse_word_bytes(int word) | ||||
{//============================= | |||||
// reverse the order of bytes from little-endian to big-endian | |||||
#ifdef ARCH_BIG | #ifdef ARCH_BIG | ||||
#define FIX_ENDIAN_USHORT(val) ((unsigned short) ( \ | int ix; | ||||
(unsigned short) ((unsigned short) (val) >> 8) | \ | int word2 = 0; | ||||
(unsigned short) ((unsigned short) (val) << 8))) | |||||
#define FIX_ENDIAN_UINT(val) ((unsigned int) ( \ | |||||
(((unsigned int) (val) & (unsigned int) 0x000000ffU) << 24) | \ | |||||
(((unsigned int) (val) & (unsigned int) 0x0000ff00U) << 8) | \ | |||||
(((unsigned int) (val) & (unsigned int) 0x00ff0000U) >> 8) | \ | |||||
(((unsigned int) (val) & (unsigned int) 0xff000000U) >> 24))) | |||||
for(ix=0; ix<=24; ix+=8) | |||||
{ | |||||
word2 = word2 << 8; | |||||
word2 |= (word >> ix) & 0xff; | |||||
} | |||||
return(word2); | |||||
#else | #else | ||||
return(word); | |||||
#define FIX_ENDIAN_USHORT(val) (val) | |||||
#define FIX_ENDIAN_UINT(val) (val) | |||||
#endif | #endif | ||||
} | |||||
int LookupMnem(MNEM_TAB *table, char *string) | int LookupMnem(MNEM_TAB *table, char *string) | ||||
pw = (int *)data_dictlist; | pw = (int *)data_dictlist; | ||||
length = FIX_ENDIAN_UINT(pw[1]); | length = reverse_word_bytes(pw[1]); | ||||
if(size <= (N_HASH_DICT + sizeof(int)*2)) | if(size <= (N_HASH_DICT + sizeof(int)*2)) | ||||
{ | { | ||||
return(2); | return(2); | ||||
} | } | ||||
if((FIX_ENDIAN_UINT(pw[0]) != N_HASH_DICT) || | if((reverse_word_bytes(pw[0]) != N_HASH_DICT) || | ||||
(length <= 0) || (length > 0x8000000)) | (length <= 0) || (length > 0x8000000)) | ||||
{ | { | ||||
fprintf(stderr,"Bad data: '%s' (%x %x)\n",fname,FIX_ENDIAN_UINT(pw[0]),length); | fprintf(stderr,"Bad data: '%s' (%x length=%x)\n",fname,reverse_word_bytes(pw[0]),length); | ||||
return(2); | return(2); | ||||
} | } | ||||
data_dictrules = &data_dictlist[length]; | data_dictrules = &data_dictlist[length]; | ||||
pw = (unsigned int *)langopts.replace_chars; | pw = (unsigned int *)langopts.replace_chars; | ||||
while(*pw != 0) | while(*pw != 0) | ||||
{ | { | ||||
*pw = FIX_ENDIAN_UINT(*pw); | *pw = reverse_word_bytes(*pw); | ||||
pw++; | pw++; | ||||
*pw = FIX_ENDIAN_UINT(*pw); | *pw = reverse_word_bytes(*pw); | ||||
pw++; | pw++; | ||||
} | } | ||||
#endif | #endif |
int ix; | int ix; | ||||
static char buf[5]; | static char buf[5]; | ||||
for(ix=0; ix<4; ix++) | for(ix=0; ix<3; ix++) | ||||
buf[ix] = word >> (ix*8); | buf[ix] = word >> (ix*8); | ||||
buf[4] = 0; | buf[4] = 0; | ||||
return(buf); | return(buf); |
SetLetterVowel(tr,'y'); | SetLetterVowel(tr,'y'); | ||||
tr->langopts.numbers = 0x11c19; | tr->langopts.numbers = 0x11c19; | ||||
tr->langopts.accents = 1; | |||||
memcpy(tr->stress_lengths,stress_lengths_nl,sizeof(tr->stress_lengths)); | memcpy(tr->stress_lengths,stress_lengths_nl,sizeof(tr->stress_lengths)); | ||||
} | } | ||||
break; | break; |