Browse Source

[1.28.03] Added macro in speech.h for max. length of the espeak-data path.

Added language: "bs" Bosnian.
Fix to speak_lib.h for Windows dll version.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@69 d46cf337-b52f-0410-862d-fd96e6ae7743
master
jonsd 18 years ago
parent
commit
810fb2404d

+ 2
- 15
dictsource/dict_phonemes View File



& @ @- @2 a A a: aI & @ @- @2 a A a: aI
aU E e e: E~ i I i: aU E e e: E~ i I i:
l- o o: oU r- u U u:
y
l- O o o: oU r- u U
u: y


* b d dZ dZ; f g h * b d dZ dZ; f g h
j k l l^ m n N n^ j k l l^ m n N n^
r R s t w z r R s t w z




Dictionary sr_dict

& @ @- @2 a A a: aI
aU E e e: E~ i I i:
l- o o: oU r- u U u:
y

* b d dZ dZ; f g h
j k l l^ m n N n^
p r R s S t tS ts
tS; v x z Z


Dictionary mk_dict Dictionary mk_dict


& @ @- @2 a A a: E & @ @- @2 a A a: E

+ 13
- 13
dictsource/en_list View File

farewell $2 farewell $2
fasten faas@n fasten faas@n
fathom faD@m fathom faD@m
favorite feIv@-rIt // sp.
favorite feIv@-rIt // sp.
favourite feIv@-rIt favourite feIv@-rIt
favorites feIv@-rIts // sp.
favorites feIv@-rIts // sp.
favourites feIv@-rIts favourites feIv@-rIts
feisty faIstI2 feisty faIstI2
feline fi:laIn feline fi:laIn
feminine fEm@nIn feminine fEm@nIn
fete feIt fete feIt
fetus fi:t@s fetus fi:t@s
fi f,aI // as in "hi-fi"
fi f,aI // as in "hi-fi"
fiasco fi:'askoU fiasco fi:'askoU
fiery faI@rI2 fiery faI@rI2
finale fIn'A:lI2 finale fIn'A:lI2
finance faInans $only finance faInans $only
finance $verb finance $verb
finess fI2nEs // for finessed
finesse fI2nEs finesse fI2nEs
finite faInaIt finite faInaIt
fishnet fISnEt fishnet fISnEt
fiord fi:O@d fiord fi:O@d
fix fIks // for fixer
fix fIks // for fixer
flagellum fla2dZEl@m flagellum fla2dZEl@m
flexible flEksIb@L flexible flEksIb@L
flier flaI3 flier flaI3
flourish flVrI2S flourish flVrI2S
focus foUk@s // ed,ing
focus foUk@s // ed,ing
foothold fUthoUld foothold fUthoUld
forage f0rIdZ forage f0rIdZ
force fo@s force fo@s
foretell fo@t'El foretell fo@t'El
forever $2 forever $2
forewarn $2 forewarn $2
formid fO@m'Id // formidable
formid fO@m'Id // formidable
foyer fOIeI foyer fOIeI
freelance fri:laans freelance fri:laans
frigate frIg@t frigate frIg@t
fringer frIndZ3 // infringer
fringer frIndZ3 // infringer
fringing frIndZIN fringing frIndZIN
frontend fr'Vnt,End frontend fr'Vnt,End
frontpage fr'Vntp,eIdZ frontpage fr'Vntp,eIdZ
graduate gradju:@t graduate gradju:@t
graduate gradju:eIt $verb graduate gradju:eIt $verb
graffiti gra2fi:tI2 graffiti gra2fi:tI2
gredient gri:di@nt // ingredient
gredient gri:di@nt // ingredient
grenade gr@neId grenade gr@neId
grosvenor groUv@n3 grosvenor groUv@n3
groupie gru:pI groupie gru:pI
influenza Influ:'Enz@ influenza Influ:'Enz@
infrastructure $1 infrastructure $1
ingenuity IndZIn'ju:I2tI2 ingenuity IndZIn'ju:I2tI2
inherit I2nhErIt // inherited
inherit I2nhErIt // inherited
innard In3d innard In3d
inner In3 inner In3
inning InIN inning InIN
insert Ins'3:t $verb insert Ins'3:t $verb
insightful $2 insightful $2
inspire Insp'aI@ inspire Insp'aI@
instal I2nstO:l // instalment
instal I2nstO:l // instalment
installation Inst@l'eIS@n installation Inst@l'eIS@n
instinctive $2 instinctive $2
insult $2 insult $2
interrogatory $3 interrogatory $3
inventory Inv@ntrI2 inventory Inv@ntrI2
interface $1 interface $1
intermin I2nt3:mIn // interminable
intermin I2nt3:mIn // interminable
internet Int3nEt internet Int3nEt
interrupt $1 $onlys interrupt $1 $onlys
interrupt $3 $verb interrupt $3 $verb
interval Int3v@L interval Int3v@L
interven Int3v'i:n // for intervening
interven Int3v'i:n // for intervening
intro $1 intro $1
iris aIrIs iris aIrIs
irony aIr@nI2 irony aIr@nI2
Penelope p@nEl@pI2 Penelope p@nEl@pI2
Phoebe fi:bi: Phoebe fi:bi:
Rachel reItS@L Rachel reItS@L
Reilly raIlI2
Rica ri:ka2 Rica ri:ka2
Robert r0b3t Robert r0b3t
Roderick r0drIk Roderick r0drIk

+ 8
- 7
dictsource/en_rules View File

.group e .group e
e E e E
&) e (_ &) e (_
e (_ =@
_C) e (_ i:
_CC) e (_ i:
_C) e (_N i:
_CC) e (_N i:
_C) e (Be_ i: _C) e (Be_ i:
_CC) e (Be_ i: _CC) e (Be_ i:
_CCC) e (Be_ i: _CCC) e (Be_ i:
_C) er 3: _C) er 3:
_h) er (A Er _h) er (A Er
_CC) er 3: _CC) er 3:
_CC) er (A Er
_qu) er 3: _qu) er 3:
c) er (am I2r c) er (am I2r
&) ere (_ 3 &) ere (_ 3
c) ere (mon ErI2 c) ere (mon ErI2
h) er (en i@r h) er (en i@r
st) ereo ErI2oU st) ereo ErI2oU
_st) er (A Er
m) er (ge '3: m) er (ge '3:
erging '3:dZI2N erging '3:dZI2N
v) er (ge '3: v) er (ge '3:
ied (_$2i d // suffix ied (_$2i d // suffix
ie (c aI ie (c aI
ie (ce i: ie (ce i:
_C) ie (_ aI
ie (_ aI
&) ie (_ I2
_r) ie i: _r) ie i:
iedly IdlI2 iedly IdlI2
_z) ie i: _z) ie i:
cl) ie (nt aI@ cl) ie (nt aI@
&) ier (y I2@r &) ier (y I2@r
ier i@ ier i@
ier (_ i@
&) ier (_S2i @
_h) ie (r aI@ _h) ie (r aI@
pl) ier (_ aI@ pl) ier (_ aI@
_Cr) ier aI@ _Cr) ier aI@
ser) ies (_ i:z ser) ies (_ i:z
_ar) ies (_ i:z _ar) ies (_ i:z
iesc I2Es iesc I2Es
&) ie (st_ I2@
&) iest (_S3i @st
pr) ie (st i: pr) ie (st i:
_v) ie (t %i@ _v) ie (t %i@
ie (ve i: ie (ve i:
regim rEdZIm regim rEdZIm
re (gist rE re (gist rE
_) re (i@P2 r,i: _) re (i@P2 r,i:
_) rei (l raI
_) rele (g rElI2 _) rele (g rElI2
rele (nt rI2lE rele (nt rI2lE
rele (v rElI rele (v rElI

+ 2
- 0
dictsource/es_list View File

a a $atend a a $atend
_o o _o o
o o $atend o o $atend
v uve
x Ekis
_y ,ig@-*'iEQa _y ,ig@-*'iEQa
y ,ig@-*'iEQa $atend y ,ig@-*'iEQa $atend



+ 2
- 2
dictsource/hi_rules View File



.group ू .group ू
ू u: ू u:
ूं u~
ूं u~ // or O~ ??
ूँ u~ ूँ u~


.group ृ .group ृ
्) य (_ j@3 ्) य (_ j@3


.group र .group र
र rV
र r@2
र (B r र (B r
?1 र (_ r ?1 र (_ r
्) र (_ r@- ्) र (_ r@-

+ 16
- 0
dictsource/hr_list View File

% p'osto % p'osto
+ plus + plus
€ 'euRo € 'euRo
?2 € 'ev@-*o
@ _'at @ _'at
& _'end & _'end
! 'usklItSnIk ! 'usklItSnIk
: dv'ototSk& : dv'ototSk&
?2 : dv'otatSk&
# b@-*'oj_ # b@-*'oj_
/ k@-*'oz_ / k@-*'oz_
\\ b'EkslES \\ b'EkslES
µ m'ik@-*o µ m'ik@-*o
¶ tSl'an&k ¶ tSl'an&k
° st'up&n^ ° st'up&n^
?2 ° st'epen
_" n'avodnIk _" n'avodnIk
_‚ 'otvoReni||n'avodnIk _‚ 'otvoReni||n'avodnIk
_„ sp'uSteni||n'avodnIk _„ sp'uSteni||n'avodnIk
… t@-*'i||t'otSke … t@-*'i||t'otSke
?2 … t@-*'i||t'atSke
† k@-*'iZ † k@-*'iZ
‡ dv'ost@-*Uki||k@-*'iZ ‡ dv'ost@-*Uki||k@-*'iZ
‰ p@-*'omil ‰ p@-*'omil
_“ 'otvoReni||n'avodnIk _“ 'otvoReni||n'avodnIk
_” z'atvoReni||n'avodnIk _” z'atvoReni||n'avodnIk
• k@-*'upna||t'otSk& • k@-*'upna||t'otSk&
?2 • k@-*'upna||t'atSk&
_– En||ts'r-t& _– En||ts'r-t&
_— Em||ts'r-t& _— Em||ts'r-t&
™ p@-*'o'izvodZ&tS ™ p@-*'o'izvodZ&tS
_- ts'r-t'its& _- ts'r-t'its&
_. t'otSk& _. t'otSk&
_; t'otSk&z,a*Ez _; t'otSk&z,a*Ez
?2 _. t'atSk&
?2 _; t'atSk&z,a*Ez
_< m'an^i||'od _< m'an^i||'od
_= j'edn&ko _= j'edn&ko
_> v'etSi||'od _> v'etSi||'od
_0M1 t'isUtS;& _0M1 t'isUtS;&
_0MA1 t'isUtS;e _0MA1 t'isUtS;e
_1M1 t'isUtS;U _1M1 t'isUtS;U
?2 _0M1 h'il^ad&
?2 _0MA1 h'il^ade
?2 _1M1 h'il^adU
_0M2 m'ilijUna _0M2 m'ilijUna
_0MA2 m'ilijUna _0MA2 m'ilijUna
_1M2 m'ilijUn _1M2 m'ilijUn
?2 _0M2 m'ilijOna
?2 _0MA2 m'ilijOna
?2 _1M2 m'ilijOn
_0M3 m'iliardI _0M3 m'iliardI
_0MA3 m'iliarde _0MA3 m'iliarde
_1M3 m'iliardU _1M3 m'iliardU
_0M4 b'ilijUna _0M4 b'ilijUna
_1M4 b'ilijUn _1M4 b'ilijUn
?2 _0M4 b'ilijOna
?2 _1M4 b'ilijOn
_dpt _:z'a*Ez_ _dpt _:z'a*Ez_






// Demonstratives // Demonstratives
tko $u+ tko $u+
?2 šta $u+
što $u+ što $u+
koga $pause koga $pause
čega $pause čega $pause

+ 5
- 0
dictsource/hr_rules View File

// translation rules for Croatian // translation rules for Croatian
// This file is UTF-8 encoded // This file is UTF-8 encoded


// Conditional rules:
// ?1 Croatian
// ?2 Bosnian (Bosna and Hercegovina)

.group a .group a
a a a a
a (j A a (j A
$ d'ol&R $ d'ol&R


. totSk& . totSk&
?2 . tatSk&
. (. _: . (. _:
\.) . \.) .



+ 16
- 4
dictsource/pt_rules View File

eu (s eU eu (s eU
e (uCK e e (uCK e


j) e (tA_ E
j) e (tAm_ E
j) e (tAs_ E
?1 d) e (CAA y
?1 d) e (CACAA y
?1 d) e (CACAC y
?1 d) e (CACC y
?1 d) e (CCAA y
?1 d) e (nCAA ,e
?1 d) e (CCACA y
?1 d) e (nCACA ,e
?1 d) e (CCACCA y
?1 d) e (nCACCA ,e

j) e (tA_ E
j) e (tAm_ E
j) e (tAs_ E


?1 _) es (C@@ S // drop initial "e". ?1 _) es (C@@ S // drop initial "e".
?1 _) e (f i // efectuar, etc. ?1 _) e (f i // efectuar, etc.
?1 _f) e (ch y // fechar ?1 _f) e (ch y // fechar
?1 _p) e (rcentag y // percentagem ?1 _p) e (rcentag y // percentagem
?1 p) e (ssoa y //pessoal, pessoais, etc. ?1 p) e (ssoa y //pessoal, pessoais, etc.
?1 pr) e (cis y // precisar
?1 pr) e (cis y // precisar
?1 pr) e (f y // preferências, etc. ?1 pr) e (f y // preferências, etc.
?1 _r) e (cicl y // recicla, reciclagem, etc... ?1 _r) e (cicl y // recicla, reciclagem, etc...
?1 r) e (cor y // recorrer, recordar ?1 r) e (cor y // recorrer, recordar








+ 6
- 5
phsource/compile_report View File

de 32 123 de 32 123
eo 13 108 eo 13 108
fi 40 127 fi 40 127
fr 35 118
fr 34 118
fr_ca 11 118 fr_ca 11 118
hi 50 132 hi 50 132
hu 23 112 hu 23 112
no 28 122 no 28 122
is 32 121 is 32 121
vi 41 133 vi 41 133
zhy 32 124
zhy 33 125
sw 14 105 sw 14 105


4 b/b base fr hi ro
3 b/b base hi ro
2 b/b_ base hi 2 b/b_ base hi
2 b/b@ base hi 2 b/b@ base hi
2 b/b@2 base hi 2 b/b@2 base hi
10 vowel/e_mid2 af de fi nl sk ro el sw 10 vowel/e_mid2 af de fi nl sk ro el sw
2 vowel/@_fnt hr mk 2 vowel/@_fnt hr mk
1 vowel/@_hgh no 1 vowel/@_hgh no
19 vowel/i base2 en_n en_rp en_wm cy eo fr hu pl it pt pt_pt ++
18 vowel/i base2 en_n en_rp en_wm cy eo fr hu pl it pt pt_pt ++
1 vowel/i# cy 1 vowel/i# cy
5 vowel/i_2 de nl la sv 5 vowel/i_2 de nl la sv
2 vowel/i_3 af sk
3 vowel/i_3 af fr sk
4 vowel/i_4 fi hu it is 4 vowel/i_4 fi hu it is
5 vowel/i_5 en_sc 5 vowel/i_5 en_sc
3 vowel/i#_5 pt_pt ro 3 vowel/i#_5 pt_pt ro
1 vwl_sv/r_sv3 sv 1 vwl_sv/r_sv3 sv
1 vwl_zh/aang zhy 1 vwl_zh/aang zhy
1 vwl_zh/ong zhy 1 vwl_zh/ong zhy
1 vwl_zh/ung zhy
2 w/w base fr 2 w/w base fr
2 w/_w base fr 2 w/_w base fr
1 w/w_ base 1 w/w_ base

+ 2
- 11
phsource/ph_french View File

phoneme i phoneme i
vowel starttype (i) endtype (i) vowel starttype (i) endtype (i)
length 160 length 160
formants vowel/i
formants vowel/i_3
linkout ; linkout ;
endphoneme endphoneme


endphoneme endphoneme




phoneme B
vcd blb frc
vowelin f1=2 f2=1000 -300 -200 f3=-100 100
vowelout f1=2 f2=1000 -500 -300 f3=-100 60 len=50
lengthmod 6
formants b/b
switchvoicing f
endphoneme


phoneme p phoneme p
vls blb stop vls blb stop
vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11 vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11








+ 9
- 5
phsource/ph_zh_yue View File

// Cantonese Chinese
//==================

//==================================================== //====================================================
// Tone Numbers // Tone Numbers
//==================================================== //====================================================
endphoneme endphoneme


phoneme aang phoneme aang
vowel starttype (a) endtype (u)
vowel starttype (a) endtype (a)
length 270 length 270
formants vwl_zh/aang formants vwl_zh/aang
endphoneme endphoneme
endphoneme endphoneme


phoneme ong phoneme ong
vowel starttype (o) endtype (u)
vowel starttype (o) endtype (o)
length 220 length 220
formants vwl_zh/ong formants vwl_zh/ong
endphoneme endphoneme
before N vowel/uu_bck before N vowel/uu_bck
endphoneme endphoneme


phoneme ung
vowel starttype (u) endtype (u)
length 200
formants vwl_zh/ung
endphoneme

phoneme ui phoneme ui
vowel starttype (u) endtype (i) vowel starttype (u) endtype (i)
length 220 length 220

BIN
phsource/vwl_zh/aang View File


+ 12
- 12
src/compiledata.cpp View File

int CPhoneme(); int CPhoneme();
void StartPhonemeTable(const char *name); void StartPhonemeTable(const char *name);
void EndPhonemeTable(); void EndPhonemeTable();
void CPhonemeFiles(char *path_source);
void CPhonemeFiles();
int NextItem(int type); int NextItem(int type);
void UngetItem(); void UngetItem();
void Error(const char *msg); void Error(const char *msg);


}; };


char path_source[80];
char path_source[sizeof(path_home)+20];


Compile *compile; Compile *compile;


int resample_wav = 0; int resample_wav = 0;
char fname_temp[100]; char fname_temp[100];
int scale_factor=0; int scale_factor=0;
char command[200];
char command[sizeof(path_source)+200];


fseek(f,24,SEEK_SET); fseek(f,24,SEEK_SET);
sr1 = Read4Bytes(f); sr1 = Read4Bytes(f);
int hash; int hash;
int type_code=' '; int type_code=' ';
REF_HASH_TAB *p, *p2; REF_HASH_TAB *p, *p2;
char buf[256];
char buf[sizeof(path_source)+120];


count_references++; count_references++;








void Compile::CPhonemeFiles(char *path_source)
{//===========================================
void Compile::CPhonemeFiles()
{//==========================
int phcode; int phcode;
int item; int item;
FILE *f; FILE *f;
char buf[120];
char buf[sizeof(path_source)+120];


linenum = 1; linenum = 1;
n_phcodes = 1; // don't use phoneme code=0, it's used as string terminator n_phcodes = 1; // don't use phoneme code=0, it's used as string terminator
REF_HASH_TAB *p; REF_HASH_TAB *p;
REF_HASH_TAB **list; REF_HASH_TAB **list;
FILE *f_report; FILE *f_report;
char fname[80];
char fname[sizeof(path_source)+20];


// make a list of all the references and sort it // make a list of all the references and sort it
list = (REF_HASH_TAB **)malloc(count_references * sizeof(REF_HASH_TAB *)); list = (REF_HASH_TAB **)malloc(count_references * sizeof(REF_HASH_TAB *));
FILE *log; FILE *log;
FILE *f_phused; FILE *f_phused;
char dictname[80]; char dictname[80];
char fname_log[80];
char fname_log[sizeof(path_dsource)+20];
char save_voice_name[80]; char save_voice_name[80];


if(!wxDirExists(path_dictsource)) if(!wxDirExists(path_dictsource))


void Compile::CPhonemeTab(const char *source) void Compile::CPhonemeTab(const char *source)
{//======================================== {//========================================
char fname[130];
char fname[sizeof(path_source)+40];
wxString report; wxString report;
wxString report_dict; wxString report_dict;


n_phoneme_tabs = 0; n_phoneme_tabs = 0;
stack_ix = 0; stack_ix = 0;
StartPhonemeTable("base"); StartPhonemeTable("base");
CPhonemeFiles(path_source);
CPhonemeFiles();


EndPhonemeTable(); EndPhonemeTable();
WritePhonemeTable(); WritePhonemeTable();
char name1[40]; char name1[40];
char name2[40]; char name2[40];
char mbrola_voice[40]; char mbrola_voice[40];
char buf[150];
char buf[sizeof(path_home)+30];
int mbrola_ctrl = 20; // volume in 1/16 ths int mbrola_ctrl = 20; // volume in 1/16 ths
MBROLA_TAB data[N_PHONEME_TAB]; MBROLA_TAB data[N_PHONEME_TAB];



+ 3
- 3
src/compiledict.cpp View File

FILE *f_out; FILE *f_out;
int offset_rules=0; int offset_rules=0;
int value; int value;
char fname_buf[130];
char fname_temp[130];
char path[80];
char fname_buf[sizeof(path_home)+15];
char fname_temp[sizeof(path_home)+15];
char path[sizeof(path_home)+40]; // path_dsource+20


error_count = 0; error_count = 0;



+ 1
- 1
src/dictionary.cpp View File

int length; int length;
FILE *f; FILE *f;
unsigned int size; unsigned int size;
char fname[130];
char fname[sizeof(path_home)+20];


strcpy(dictionary_name,name); // currently loaded dictionary name strcpy(dictionary_name,name); // currently loaded dictionary name



+ 1
- 1
src/espeak.cpp View File

#include <string.h> #include <string.h>
#include <getopt.h> #include <getopt.h>
#include <time.h> #include <time.h>
#include "sys/stat.h"
#include <sys/stat.h>


#include "speak_lib.h" #include "speak_lib.h"



+ 2
- 2
src/espeakedit.cpp View File

{//========================================= {//=========================================
int err; int err;
FILE *log; FILE *log;
char fname_log[80];
char err_fname[130];
char fname_log[sizeof(path_dsource)+12];
char err_fname[sizeof(path_home)+15];


switch(event.GetId()) switch(event.GetId())
{ {

+ 12
- 10
src/extras.cpp View File

#include <wx/dirdlg.h> #include <wx/dirdlg.h>
#include "wx/filename.h" #include "wx/filename.h"
#include "wx/sound.h" #include "wx/sound.h"
#include "wx/dir.h"


#include "sys/stat.h"
#include <sys/stat.h>


#include "speak_lib.h" #include "speak_lib.h"
#include "main.h" #include "main.h"
int counts[20][20][10]; int counts[20][20][10];


char phonemes[N_WORD_PHONEMES]; char phonemes[N_WORD_PHONEMES];
char buf[100];
char buf[120];
char fname[sizeof(path_dsource)+20];


// KOI8-R codes for Russian vowels // KOI8-R codes for Russian vowels
static char vowels[] = {0xa3,0xc0,0xc1,0xc5,0xc9,0xcf,0xd1,0xd5,0xd9,0xdc,0}; static char vowels[] = {0xa3,0xc0,0xc1,0xc5,0xc9,0xcf,0xd1,0xd5,0xd9,0xdc,0};
} }
input_length = GetFileLength(buf); input_length = GetFileLength(buf);


sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1");
if((f_out = fopen(buf,"w")) == NULL)
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1");
if((f_out = fopen(fname,"w")) == NULL)
{ {
wxLogError(_T("Can't write to: ")+wxString(buf,wxConvLocal));
wxLogError(_T("Can't write to: ")+wxString(fname,wxConvLocal));
fclose(f_in); fclose(f_in);
return; return;
} }


sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_log");
f_log = fopen(buf,"w");
sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1");
f_roots = fopen(buf,"w");
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_log");
f_log = fopen(fname,"w");
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1");
f_roots = fopen(fname,"w");


LoadVoice("ru",0); LoadVoice("ru",0);


return 0; return 0;
} }



char* text1 = "Hello World2. <audio src=\"here\"> Some text</audio> This is the second sentence"; char* text1 = "Hello World2. <audio src=\"here\"> Some text</audio> This is the second sentence";


void TestTest(int control) void TestTest(int control)
//CharsetToUnicode("ISO-8859-4"); //CharsetToUnicode("ISO-8859-4");
//CharsetToUnicode("ISCII"); //CharsetToUnicode("ISCII");


test4();
return; return;


if(control==2) if(control==2)

+ 6
- 8
src/options.cpp View File



#include "wx/wx.h" #include "wx/wx.h"
#include "wx/fileconf.h" #include "wx/fileconf.h"
#include "sys/stat.h"
#include <sys/stat.h>
#include "speech.h" #include "speech.h"


#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
extern int GetNumeric(wxTextCtrl *t); extern int GetNumeric(wxTextCtrl *t);
extern void SetNumeric(wxTextCtrl *t, int value); extern void SetNumeric(wxTextCtrl *t, int value);
extern int samplerate; extern int samplerate;
extern char path_home[120]; // .speak directory in user's HOME
extern char voice_name[40]; extern char voice_name[40];


wxString basedir;
wxString path_spectload; wxString path_spectload;
wxString path_spectload2; wxString path_spectload2;
wxString path_pitches; wxString path_pitches;
wxString path_dir1; wxString path_dir1;
int option_speed=160; int option_speed=160;


char path_dsource[120];
char path_dsource[sizeof(path_home)+20];


BEGIN_EVENT_TABLE(Options, wxDialog) BEGIN_EVENT_TABLE(Options, wxDialog)
EVT_BUTTON(wxID_SAVE,Options::OnCommand) EVT_BUTTON(wxID_SAVE,Options::OnCommand)


void ConfigSetPaths() void ConfigSetPaths()
{//================== {//==================
// set paths from wxStrings
// set c_string paths from wxStrings
strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1); strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1);
strcat(path_source,"/"); strcat(path_source,"/");


{//============== {//==============
long value; long value;
wxString string; wxString string;
wxString basedir;
const char *path_base; const char *path_base;
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
{ {
wxString RegVal; wxString RegVal;
pRegKey->QueryValue(_T("Path"),RegVal); pRegKey->QueryValue(_T("Path"),RegVal);
strcpy(buf,RegVal.mb_str(wxConvLocal));
strncpy0(buf,RegVal.mb_str(wxConvLocal),sizeof(buf));
path_base = buf; path_base = buf;
} }
else else
#endif #endif
WavegenInit(value,0); WavegenInit(value,0);


pConfig->Read(_T("/basedir"),&basedir,wxString(path_base,wxConvLocal));
basedir = wxString(path_base,wxConvLocal); // this is only used to set defaults for other paths if they are not in the config file
pConfig->Read(_T("/spectload"),&path_spectload,basedir+_T("/phsource")); pConfig->Read(_T("/spectload"),&path_spectload,basedir+_T("/phsource"));
pConfig->Read(_T("/spectload2"),&path_spectload2,basedir+_T("/phsource")); pConfig->Read(_T("/spectload2"),&path_spectload2,basedir+_T("/phsource"));
pConfig->Read(_T("/pitchpath"),&path_pitches,basedir+_T("/pitch")); pConfig->Read(_T("/pitchpath"),&path_pitches,basedir+_T("/pitch"));
#ifndef PLATFORM_WINDOWS #ifndef PLATFORM_WINDOWS
pConfig->Write(_T("/samplerate"),samplerate); pConfig->Write(_T("/samplerate"),samplerate);
#endif #endif
pConfig->Write(_T("/basedir"),basedir);
pConfig->Write(_T("/spectload"),path_spectload); pConfig->Write(_T("/spectload"),path_spectload);
pConfig->Write(_T("/spectload2"),path_spectload2); pConfig->Write(_T("/spectload2"),path_spectload2);
pConfig->Write(_T("/pitchpath"),path_pitches); pConfig->Write(_T("/pitchpath"),path_pitches);

+ 2
- 2
src/options.h View File

extern wxString path_modifiervoice; extern wxString path_modifiervoice;
extern wxString path_dir1; extern wxString path_dir1;


extern char path_source[80];
extern char path_dsource[120];
extern char path_source[sizeof(path_home)+20];
extern char path_dsource[sizeof(path_home)+20];


extern int option_speed; extern int option_speed;



+ 128
- 3
src/readclause.cpp View File

#include "synthesize.h" #include "synthesize.h"
#include "translate.h" #include "translate.h"


#include <locale.h>
#define N_XML_BUF 256 #define N_XML_BUF 256


espeak_VOICE *SelectVoice(espeak_VOICE *voice_select, int *variant); espeak_VOICE *SelectVoice(espeak_VOICE *voice_select, int *variant);
}; };




#ifdef PLATFORM_RISCOS
#ifdef NEED_WCHAR_FUNCTIONS

// additional Latin characters beyond the Latin1 character set
#define MAX_WALPHA 0x233
// indexed by character - 0x100
// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case
static unsigned char walpha_tab[MAX_WALPHA-0xff] = {
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120
0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160
1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170
0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180
203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190
1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0
0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0
0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0
0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210
0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220
1,0xff, 1,0xff }; // 230

// use ctype.h functions for Latin1 (character < 0x100)
int iswalpha(int c)
{
if(c < 0x100)
return(isalpha(c));
if(c > MAX_WALPHA)
return(0);
return(walpha_tab[c-0x100]);
}

int iswdigit(int c)
{
if(c < 0x100)
return(isdigit(c));
return(0);
}

int iswalnum(int c)
{
if(iswdigit(c))
return(1);
return(iswalpha(c));
}

int towlower(int c)
{
int x;
if(c < 0x100)
return(tolower(c));
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff))
return(c); // already lower case
return(c + x); // convert to lower case
}

int towupper(int c)
{
// check whether the previous character code is the upper-case equivalent of this character
if(tolower(c-1) == c)
return(c-1); // yes, use it
return(c); // no
}

int iswupper(int c)
{
int x;
if(c < 0x100)
return(isupper(c));
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff))
return(0);
return(1);
}

int iswlower(int c)
{
if(c < 0x100)
return(islower(c));
if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff))
return(0);
return(1);
}

int iswspace(int c)
{
if(c < 0x100)
return(isspace(c));
return(0);
}

int iswpunct(int c)
{
if(c < 0x100)
return(ispunct(c));
return(0);
}

const wchar_t *wcschr(const wchar_t *str, int c)
{
while(*str != 0)
{
if(*str == c)
return(str);
str++;
}
return(NULL);
}

const int wcslen(const wchar_t *str)
{
int ix=0;

while(*str != 0)
{
ix++;
}
return(ix);
}

float wcstod(const wchar_t *str, wchar_t **tailptr) float wcstod(const wchar_t *str, wchar_t **tailptr)
{ {
int ix; int ix;
int *ip; int *ip;
int length; int length;
char fname_temp[100]; char fname_temp[100];
char fname2[200];
char command[150];
char fname2[sizeof(path_home)+13+40];
char command[sizeof(fname2)+sizeof(fname2)+30];


if(fname == NULL) if(fname == NULL)
fname = soundicon_tab[index].filename; fname = soundicon_tab[index].filename;

+ 24
- 7
src/speak.cpp View File

#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

#ifndef PLATFORM_DOS
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
#include <windows.h> #include <windows.h>
#include <winreg.h> #include <winreg.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
#endif

#ifndef NEED_GETOPT #ifndef NEED_GETOPT
#include <getopt.h> #include <getopt.h>
#endif #endif
#include <time.h> #include <time.h>
#include <signal.h> #include <signal.h>
#include <locale.h> #include <locale.h>
#include "sys/stat.h"
#include <sys/stat.h>


#include "speak_lib.h" #include "speak_lib.h"
#include "voice.h" #include "voice.h"






char path_home[120];
char path_home[N_PATH_HOME]; // this is the espeak-data directory

char wavefile[120]; char wavefile[120];
int (* uri_callback)(int, const char *, const char *) = NULL; int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL; int (* phoneme_callback)(const char *) = NULL;
unsigned long size; unsigned long size;
unsigned long var_type; unsigned long var_type;
char *env; char *env;
unsigned char buf[100];
unsigned char buf[sizeof(path_home)-12];


if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
if(((env = getenv("ESPEAK_DATA_PATH")) != NULL) && ((strlen(env)+12) < sizeof(path_home)))
{ {
sprintf(path_home,"%s/espeak-data",env);
sprintf(path_home,"%s\\espeak-data",env);
if(GetFileLength(path_home) == -2) if(GetFileLength(path_home) == -2)
return; // an espeak-data directory exists return; // an espeak-data directory exists
} }


sprintf(path_home,"%s\\espeak-data",buf); sprintf(path_home,"%s\\espeak-data",buf);
#else #else
#ifdef PLATFORM_DOS
strcpy(path_home,PATH_ESPEAK_DATA);
#else
// char *env; // char *env;
// if((env = getenv("ESPEAK_DATA_PATH")) != NULL) // if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
// { // {
strcpy(path_home,PATH_ESPEAK_DATA); strcpy(path_home,PATH_ESPEAK_DATA);
} }
#endif #endif
#endif
} }






if(flag_compile) if(flag_compile)
{ {
#ifdef PLATFORM_DOS
char path_dsource[sizeof(path_home)+20];
strcpy(path_dsource,path_home);
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
strcat(path_dsource,"dictsource\\");
CompileDictionary(path_dsource,dictionary_name,NULL,NULL);
#else
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
char path_dsource[120];
char path_dsource[sizeof(path_home)+20];
strcpy(path_dsource,path_home); strcpy(path_dsource,path_home);
path_dsource[strlen(path_home)-11] = 0; // renove "espeak-data" from the end
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
strcat(path_dsource,"dictsource\\"); strcat(path_dsource,"dictsource\\");
CompileDictionary(path_dsource,dictionary_name,NULL,NULL); CompileDictionary(path_dsource,dictionary_name,NULL,NULL);
#else #else
CompileDictionary(NULL,dictionary_name,NULL,NULL); CompileDictionary(NULL,dictionary_name,NULL,NULL);
#endif
#endif #endif
exit(0); exit(0);
} }

+ 4
- 4
src/speak_lib.cpp View File



#include "speech.h" #include "speech.h"


#include "sys/stat.h"
#include <sys/stat.h>
#ifndef PLATFORM_WINDOWS #ifndef PLATFORM_WINDOWS
#include <unistd.h> #include <unistd.h>
#endif #endif
int (* uri_callback)(int, const char *, const char *) = NULL; int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL; int (* phoneme_callback)(const char *) = NULL;


char path_home[120];
char path_home[N_PATH_HOME]; // this is the espeak-data directory


voice_t voicedata; voice_t voicedata;
voice_t *voice = &voicedata; voice_t *voice = &voicedata;
unsigned long size; unsigned long size;
unsigned long var_type; unsigned long var_type;
char *env; char *env;
unsigned char buf[100];
unsigned char buf[sizeof(path_home)-13];


if(path != NULL) if(path != NULL)
{ {
sprintf(path_home,"%s\\espeak-data",buf); sprintf(path_home,"%s\\espeak-data",buf);


#else #else
char *env;
// char *env;


if(path != NULL) if(path != NULL)
{ {

+ 2
- 118
src/speak_riscos.cpp View File

"\t If <language> is omitted, then list all voices.\n"; "\t If <language> is omitted, then list all voices.\n";




// additional Latin characters beyond the Latin1 character set
#define MAX_WALPHA 0x233
// indexed by character - 0x100
// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case
static unsigned char walpha_tab[MAX_WALPHA-0xff] = {
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120
0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160
1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170
0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180
203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190
1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0
0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0
0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0
0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210
0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220
1,0xff, 1,0xff }; // 230

// use ctype.h functions for Latin1 (character < 0x100)
int iswalpha(int c)
{
if(c < 0x100)
return(isalpha(c));
if(c > MAX_WALPHA)
return(0);
return(walpha_tab[c-0x100]);
}

int iswdigit(int c)
{
if(c < 0x100)
return(isdigit(c));
return(0);
}

int iswalnum(int c)
{
if(iswdigit(c))
return(1);
return(iswalpha(c));
}

int towlower(int c)
{
int x;
if(c < 0x100)
return(tolower(c));
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff))
return(c); // already lower case
return(c + x); // convert to lower case
}

int iswupper(int c)
{
int x;
if(c < 0x100)
return(isupper(c));
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff))
return(0);
return(1);
}

int iswlower(int c)
{
if(c < 0x100)
return(islower(c));
if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff))
return(0);
return(1);
}

int iswspace(int c)
{
if(c < 0x100)
return(isspace(c));
return(0);
}

int iswpunct(int c)
{
if(c < 0x100)
return(ispunct(c));
return(0);
}

const wchar_t *wcschr(const wchar_t *str, int c)
{
while(*str != 0)
{
if(*str == c)
return(str);
str++;
}
return(NULL);
}

const int wcslen(const wchar_t *str)
{
int ix=0;

while(*str != 0)
{
ix++;
}
return(ix);
}


int GetFileLength(const char *filename) int GetFileLength(const char *filename)
{//==================================== {//====================================
int length=0; int length=0;
_kernel_swi_regs regs; _kernel_swi_regs regs;
_kernel_oserror *error; _kernel_oserror *error;
char buf[80]; char buf[80];
char directory2[80];
char directory2[sizeof(path_home)+100];


regs.r[0] = 10; regs.r[0] = 10;
regs.r[1] = (int)directory; regs.r[1] = (int)directory;


void ReadVoiceNames() void ReadVoiceNames()
{//=================== {//===================
char directory[80];
char directory[sizeof(path_home)+10];


for(n_voice_files=0; n_voice_files<N_VOICE_NAMES; n_voice_files++) for(n_voice_files=0; n_voice_files<N_VOICE_NAMES; n_voice_files++)
voice_names[n_voice_files] = NULL; voice_names[n_voice_files] = NULL;

+ 3
- 2
src/speech.h View File

char *Alloc(int size); char *Alloc(int size);
void Free(void *ptr); void Free(void *ptr);


#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory


extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
extern const char *version_string; extern const char *version_string;
extern const int version_phdata; extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size);



+ 1
- 1
src/synth_mbrola.cpp View File



int size; int size;
FILE *f_in; FILE *f_in;
char path[150];
char path[sizeof(path_home)+15];


mbrola_name[0] = 0; mbrola_name[0] = 0;
if(mbrola_voice == NULL) if(mbrola_voice == NULL)

+ 3
- 3
src/synthdata.cpp View File

#include "translate.h" #include "translate.h"
#include "wave.h" #include "wave.h"


const char *version_string = "1.28.01 17.Jul.07";
const char *version_string = "1.28.03 30.Jul.07";
const int version_phdata = 0x012801; const int version_phdata = 0x012801;


int option_device_number = -1; int option_device_number = -1;
FILE *f_in; FILE *f_in;
char *p; char *p;
unsigned int length; unsigned int length;
char buf[200];
char buf[sizeof(path_home)+40];


sprintf(buf,"%s%c%s",path_home,PATHSEP,fname); sprintf(buf,"%s%c%s",path_home,PATHSEP,fname);
length = GetFileLength(buf); length = GetFileLength(buf);
void LoadConfig(void) void LoadConfig(void)
{//================== {//==================
// Load configuration file, if one exists // Load configuration file, if one exists
char buf[130];
char buf[sizeof(path_home)+10];
FILE *f; FILE *f;
int ix; int ix;
char c1; char c1;

+ 1
- 0
src/tr_languages.cpp View File





case L('h','r'): // Croatian case L('h','r'): // Croatian
case L('b','s'): // Bosnian
case L('s','r'): // Serbian case L('s','r'): // Serbian
{ {
static int stress_amps_hr[8] = {16,16, 20,20, 20,24, 24,22 }; static int stress_amps_hr[8] = {16,16, 20,20, 20,24, 24,22 };

+ 2
- 3
src/translate.cpp View File

new_c = langopts.replacement_chars[ix]; new_c = langopts.replacement_chars[ix];
break; break;
} }
if((word >> 16) == tolower(next_in))
if((word >> 16) == (unsigned int)tolower(next_in))
{ {
new_c = langopts.replacement_chars[ix]; new_c = langopts.replacement_chars[ix];
ignore_next = 1; ignore_next = 1;
*insert = c2; *insert = c2;
new_c &= 0xffff; new_c &= 0xffff;
} }
#ifndef PLATFORM_RISCOS
if(upper_case) if(upper_case)
new_c = towupper(new_c); new_c = towupper(new_c);
#endif
return(new_c); return(new_c);
} }



+ 1
- 1
src/transldlg.cpp View File

{//======================== {//========================
wxString path; wxString path;
wxString filename; wxString filename;
char fname[130];
char fname[sizeof(path_home)+10];


sprintf(fname,"%s/voices",path_home); sprintf(fname,"%s/voices",path_home);
path = wxFileSelector(_T("Load voice"),wxString(fname,wxConvLocal),_T(""),_T(""),_T("*"),wxOPEN); path = wxFileSelector(_T("Load voice"),wxString(fname,wxConvLocal),_T(""),_T(""),_T("*"),wxOPEN);

+ 8
- 7
src/voices.cpp View File





#define DEFAULT_LANGUAGE_PRIORITY 5 #define DEFAULT_LANGUAGE_PRIORITY 5
#define N_VOICES_LIST 100
#define N_VOICES_LIST 150
static int n_voices_list = 0; static int n_voices_list = 0;
static espeak_VOICE *voices_list[N_VOICES_LIST]; static espeak_VOICE *voices_list[N_VOICES_LIST];
static int len_path_voices; static int len_path_voices;
// Read a Voice file, allocate a VOICE_DATA and set data from the // Read a Voice file, allocate a VOICE_DATA and set data from the
// file's language, gender, name lines // file's language, gender, name lines


char linebuf[120];
char linebuf[80];
char vname[80]; char vname[80];
char vgender[80]; char vgender[80];
char vlanguage[80]; char vlanguage[80];
char languages[300]; // allow space for several alternate language names and priorities char languages[300]; // allow space for several alternate language names and priorities
char fname_buf[sizeof(path_home)+15];




unsigned int len; unsigned int len;
// check whether the mbrola speech data is present for this voice // check whether the mbrola speech data is present for this voice
memcpy(vname,&leafname[3],3); memcpy(vname,&leafname[3],3);
vname[3] = 0; vname[3] = 0;
sprintf(linebuf,"%s/mbrola/%s",path_home,vname);
sprintf(fname_buf,"%s/mbrola/%s",path_home,vname);


if(GetFileLength(linebuf) <= 0)
if(GetFileLength(fname_buf) <= 0)
return(0); return(0);
} }
#endif #endif
char phonemes_name[40]; char phonemes_name[40];
char *language_type; char *language_type;
char buf[200]; char buf[200];
char path_voices[140];
char path_voices[sizeof(path_home)+12];
char langname[4]; char langname[4];


int stress_amps[8]; int stress_amps[8];
FILE *f_voice; FILE *f_voice;
espeak_VOICE *voice_data; espeak_VOICE *voice_data;
int ftype; int ftype;
char fname[140];
char fname[sizeof(path_home)+100];


#ifdef PLATFORM_RISCOS #ifdef PLATFORM_RISCOS
#else #else
int ix; int ix;
static espeak_VOICE *voices[N_VOICES_LIST]; static espeak_VOICE *voices[N_VOICES_LIST];
char selected_voice_id[80]; char selected_voice_id[80];
char path_voices[130];
char path_voices[sizeof(path_home)+12];


// free previous voice list data // free previous voice list data
if((voice_selected != NULL) && (voice_selected->identifier != NULL)) if((voice_selected != NULL) && (voice_selected->identifier != NULL))

+ 3
- 3
src/vowelchart.cpp View File

#include "phoneme.h" #include "phoneme.h"
#include "synthesize.h" #include "synthesize.h"
#include "translate.h" #include "translate.h"
#include "options.h"


/* Read a file of vowel symbols and f1,f2 formants, and produce a vowel diagram /* Read a file of vowel symbols and f1,f2 formants, and produce a vowel diagram
*/ */
extern wxString path_phsource; extern wxString path_phsource;
extern char path_source[];
extern char voice_name[]; extern char voice_name[];


extern char *spects_data; extern char *spects_data;
SPECT_SEQ *seq; SPECT_SEQ *seq;
frame_t *frame; frame_t *frame;
int match_level; int match_level;
char dirname[100];
char fname[120];
char dirname[sizeof(path_source)+20];
char fname[sizeof(dirname)+40];


progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables); progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables);



+ 4
- 3
src/wave.cpp View File

SHOW("init_buffer > myRead=0x%x, myWrite=0x%x, BUFFER_LENGTH=0x%x, myReadPosition = myWritePosition = 0\n", (int)myRead, (int)myWrite, BUFFER_LENGTH); SHOW("init_buffer > myRead=0x%x, myWrite=0x%x, BUFFER_LENGTH=0x%x, myReadPosition = myWritePosition = 0\n", (int)myRead, (int)myWrite, BUFFER_LENGTH);
} }


static int get_used_mem()
static unsigned int get_used_mem()
{ {
char* aRead = myRead; char* aRead = myRead;
char* aWrite = myWrite; char* aWrite = myWrite;
int used = 0;
unsigned int used = 0;


assert ((aRead >= myBuffer) assert ((aRead >= myBuffer)
&& (aRead <= myBuffer + BUFFER_LENGTH) && (aRead <= myBuffer + BUFFER_LENGTH)


static void start_stream() static void start_stream()
{ {
PaError err;
SHOW_TIME("start_stream"); SHOW_TIME("start_stream");


my_stream_could_start=0; my_stream_could_start=0;
mInCallbackFinishedState = false; mInCallbackFinishedState = false;


PaError err = Pa_StartStream(pa_stream);
err = Pa_StartStream(pa_stream);
SHOW("start_stream > Pa_StartStream=%d (%s)\n", err, Pa_GetErrorText(err)); SHOW("start_stream > Pa_StartStream=%d (%s)\n", err, Pa_GetErrorText(err));
#if USE_PORTAUDIO == 19 #if USE_PORTAUDIO == 19

+ 2
- 0
src/wave.h View File

#ifndef WAVE_H #ifndef WAVE_H
#define WAVE_H #define WAVE_H


#ifndef PLATFORM_DOS
#include "stdint.h" #include "stdint.h"
#endif


extern int option_device_number; extern int option_device_number;



+ 10
- 9
windows/espeakedit/src_copy/speech.h View File



// comment this out when compiling the "speak" process // comment this out when compiling the "speak" process
//#define SPECT_EDITOR //#define SPECT_EDITOR
#include <windows.h> #include <windows.h>
#define PLATFORM_WINDOWS
#define __WIN32__
#define mkdir(p1,p2) mkdir(p1)
#define PLATFORM_WINDOWS
#define __WIN32__
#define mkdir(p1,p2) mkdir(p1)


#define PATHSEP '\\' #define PATHSEP '\\'
#define USE_PORTAUDIO #define USE_PORTAUDIO
//#define USE_NANOSLEEP //#define USE_NANOSLEEP
#define __cdecl #define __cdecl
#define ESPEAK_API
#define ESPEAK_API
#define PATH_ESPEAK_DATA "C:\\Program files\\espeak\\espeak-data" #define PATH_ESPEAK_DATA "C:\\Program files\\espeak\\espeak-data"


typedef unsigned short USHORT; typedef unsigned short USHORT;
char *Alloc(int size); char *Alloc(int size);
void Free(void *ptr); void Free(void *ptr);


#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory

extern const char *version_string;
extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size); extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
extern const int version_phdata;
extern const char *version_string;

+ 4
- 3
windows/windows_cmd/src/speech.h View File

void Free(void *ptr); void Free(void *ptr);




extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory


extern const int version_phdata;
extern const char *version_string; extern const char *version_string;
extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size);



+ 39
- 37
windows/windows_dll/src/speak_lib.h View File

#ifndef SPEAK_LIB_H #ifndef SPEAK_LIB_H
#define SPEAK_LIB_H #define SPEAK_LIB_H
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Jonathan Duddington *
* [email protected] *
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: [email protected] *
* * * *
* 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 *
* the Free Software Foundation; either version 2 of the License, or *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* along with this program; if not, see: *
* <http://www.gnu.org/licenses/>. *
***************************************************************************/ ***************************************************************************/






#include <stdio.h> #include <stdio.h>



#define ESPEAK_LIB_REVISION 2
#define ESPEAK_API_REVISION 2
/* /*
Revision 2 Revision 2
Added parameter "options" to eSpeakInitialize() Added parameter "options" to eSpeakInitialize()


*/ */

/********************/ /********************/
/* Initialization */ /* Initialization */
/********************/ /********************/
espeakEVENT_MARK, // Mark espeakEVENT_MARK, // Mark
espeakEVENT_PLAY, // Audio element espeakEVENT_PLAY, // Audio element
espeakEVENT_END, // End of sentence espeakEVENT_END, // End of sentence
espeakEVENT_MSG_TERMINATED // End of message
espeakEVENT_MSG_TERMINATED, // End of message
espeakEVENT_PHONEME // Phoneme, if enabled in espeak_Initialize()
} espeak_EVENT_TYPE; } espeak_EVENT_TYPE;




int sample; // sample id (internal use) int sample; // sample id (internal use)
void* user_data; // pointer supplied by the calling program void* user_data; // pointer supplied by the calling program
union { union {
int number; // used for WORD and SENTENCE events
int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic.
const char *name; // used for MARK and PLAY events. UTF8 string const char *name; // used for MARK and PLAY events. UTF8 string
} id; } id;
} espeak_EVENT; } espeak_EVENT;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path);
int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
/* Must be called before any synthesis functions are called. /* Must be called before any synthesis functions are called.
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function. output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.




path: The directory which contains the espeak-data directory, or NULL for the default location. path: The directory which contains the espeak-data directory, or NULL for the default location.


Returns: sample rate in Hz
options: bit 0: 1=allow espeakEVENT_PHONEME events.


Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
*/ */


typedef int (t_espeak_callback)(short*, int, espeak_EVENT*); typedef int (t_espeak_callback)(short*, int, espeak_EVENT*);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
/* Must be called before any synthesis functions are called. /* Must be called before any synthesis functions are called.
This specifies a function in the calling program which is called when a buffer of This specifies a function in the calling program which is called when a buffer of
speech sound data has been produced. speech sound data has been produced.
sometimes be zero (which does NOT indicate end of synthesis). sometimes be zero (which does NOT indicate end of synthesis).


events: an array of espeak_EVENT items which indicate word and sentence events, and events: an array of espeak_EVENT items which indicate word and sentence events, and
also the occurance if <mark> and <audio> elements within the text.
also the occurance if <mark> and <audio> elements within the text. The list of
events is terminated by an event of type = 0.




Callback returns: 0=continue synthesis, 1=abort synthesis. Callback returns: 0=continue synthesis, 1=abort synthesis.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
/* This function may be called before synthesis functions are used, in order to deal with /* This function may be called before synthesis functions are used, in order to deal with
<audio> tags. It specifies a callback function which is called when an <audio> element is <audio> tags. It specifies a callback function which is called when an <audio> element is
encountered and allows the calling program to indicate whether the sound file which encountered and allows the calling program to indicate whether the sound file which
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
espeak_ERROR espeak_Synth(const void *text,
size_t size, size_t size,
unsigned int position, unsigned int position,
espeak_POSITION_TYPE position_type, espeak_POSITION_TYPE position_type,


espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored. espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored.


espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirschenbaum encoding).
espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirshenbaum encoding).


espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then
this pause is suppressed. this pause is suppressed.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
espeak_ERROR espeak_Synth_Mark(const void *text,
size_t size, size_t size,
const char *index_mark, const char *index_mark,
unsigned int end_position, unsigned int end_position,
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
espeak_ERROR espeak_Key(const char *key_name);
/* Speak the name of a keyboard key. /* Speak the name of a keyboard key.
Currently this just speaks the "key_name" as given Currently this just speaks the "key_name" as given


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character);
espeak_ERROR espeak_Char(wchar_t character);
/* Speak the name of the given character /* Speak the name of the given character


Return: EE_OK: operation achieved Return: EE_OK: operation achieved
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
/* Sets the value of the specified parameter. /* Sets the value of the specified parameter.
relative=0 Sets the absolute value of the parameter. relative=0 Sets the absolute value of the parameter.
relative=1 Sets a relative value of the parameter. relative=1 Sets a relative value of the parameter.


espeakVOLUME: volume in range 0-100 0=silence espeakVOLUME: volume in range 0-100 0=silence


espeakPITCH: base pitch in Hz
espeakPITCH: base pitch, range 0-100. 50=normal


espeakRANGE: pitch range in Hz
espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal


espeakPUNCTUATION: which punctuation characters to announce: espeakPUNCTUATION: which punctuation characters to announce:
value in espeak_PUNCT_TYPE (none, all, some), value in espeak_PUNCT_TYPE (none, all, some),
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
int espeak_GetParameter(espeak_PARAMETER parameter, int current);
/* current=0 Returns the default value of the specified parameter. /* current=0 Returns the default value of the specified parameter.
current=1 Returns the current value of the specified parameter, as set by SetParameter() current=1 Returns the current value of the specified parameter, as set by SetParameter()
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
/* Specified a list of punctuation characters whose names are to be spoken when the /* Specified a list of punctuation characters whose names are to be spoken when the
value of the Punctuation parameter is set to "some". value of the Punctuation parameter is set to "some".


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
void espeak_SetPhonemeTrace(int value, FILE *stream);
/* Controls the output of phoneme symbols for the text /* Controls the output of phoneme symbols for the text
value=0 No phoneme output (default) value=0 No phoneme output (default)
value=1 Output the translated phoneme symbols for the text value=1 Output the translated phoneme symbols for the text
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log);
void espeak_CompileDictionary(const char *path, FILE *log);
/* Compile pronunciation dictionary for a language which corresponds to the currently /* Compile pronunciation dictionary for a language which corresponds to the currently
selected voice. The required voice should be selected before calling this function. selected voice. The required voice should be selected before calling this function.


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers. /* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers.
The list is terminated by a NULL pointer The list is terminated by a NULL pointer


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
espeak_ERROR espeak_SetVoiceByName(const char *name);
/* Searches for a voice with a matching "name" field. Language is not considered. /* Searches for a voice with a matching "name" field. Language is not considered.
"name" is a UTF8 string. "name" is a UTF8 string.


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
/* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following /* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following
fields may be set: fields may be set:


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
espeak_VOICE *espeak_GetCurrentVoice(void);
/* Returns the espeak_VOICE data for the currently selected voice. /* Returns the espeak_VOICE data for the currently selected voice.
This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s> This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Cancel(void);
espeak_ERROR espeak_Cancel(void);
/* Stop immediately synthesis and audio output of the current text. When this /* Stop immediately synthesis and audio output of the current text. When this
function returns, the audio output is fully stopped and the synthesizer is ready to function returns, the audio output is fully stopped and the synthesizer is ready to
synthesize a new message. synthesize a new message.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API int espeak_IsPlaying(void);
int espeak_IsPlaying(void);
/* Returns 1 if audio is played, 0 otherwise. /* Returns 1 if audio is played, 0 otherwise.
*/ */


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Synchronize(void);
espeak_ERROR espeak_Synchronize(void);
/* This function returns when all data have been spoken. /* This function returns when all data have been spoken.
Return: EE_OK: operation achieved Return: EE_OK: operation achieved
EE_INTERNAL_ERROR. EE_INTERNAL_ERROR.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API espeak_ERROR espeak_Terminate(void);
espeak_ERROR espeak_Terminate(void);
/* last function to be called. /* last function to be called.
Return: EE_OK: operation achieved Return: EE_OK: operation achieved
EE_INTERNAL_ERROR. EE_INTERNAL_ERROR.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
ESPEAK_API const char *espeak_Info(void* ptr);
const char *espeak_Info(void* ptr);
/* Returns the version number string. /* Returns the version number string.
The parameter is for future use, and should be set to NULL The parameter is for future use, and should be set to NULL
*/ */

+ 4
- 3
windows/windows_dll/src/speech.h View File

void Free(void *ptr); void Free(void *ptr);




extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory


extern const int version_phdata;
extern const char *version_string; extern const char *version_string;
extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size);



+ 4
- 3
windows/windows_sapi/src/speech.h View File

void Free(void *ptr); void Free(void *ptr);




extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory


extern const int version_phdata;
extern const char *version_string; extern const char *version_string;
extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size);



Loading…
Cancel
Save