Browse Source

[1.46.22]

lang=bs,hr,sr: fix for million numbers
lang=fa, treat ZLNJ character as hyphen
Dictionary changes to lang=pt


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@287 d46cf337-b52f-0410-862d-fd96e6ae7743
master
jonsd 13 years ago
parent
commit
cd17260b31

+ 2
- 2
dictsource/dict_phonemes View File

T v x z T v x z




Dictionary hbs_dict 2008-12-17
Dictionary hbs_dict 2012-08-08


& @ @2 a A a: aI aU & @ @2 a A a: aI aU
e E e: i I i: l- o e E e: i I i: l- o
ts; v w x z Z Z; ts; v w x z Z Z;




Dictionary pt_dict 2012-07-25
Dictionary pt_dict 2012-08-08


& &/ &U~ &~ @ @- a A & &/ &U~ &~ @ @- a A
aI aU e E eI EI eU EU aI aU e E eI EI eU EU

+ 5
- 0
dictsource/hbs_list View File

?2 _3C tR'ist'a_ ?2 _3C tR'ist'a_
?2 _4C tSetR'ist'o_ ?2 _4C tSetR'ist'o_
_6C S'Est'o _6C S'Est'o

_0M1 t'isUtS;& _0M1 t'isUtS;&
_0MA1 t'isUtS;e _0MA1 t'isUtS;e
_1M1 t'isUtS;U _1M1 t'isUtS;U
?3 _0M1 h'il^ad& ?3 _0M1 h'il^ad&
?3 _0MA1 h'il^ade ?3 _0MA1 h'il^ade
?3 _1M1 h'il^adU ?3 _1M1 h'il^adU

_0M2 m'ilijUna _0M2 m'ilijUna
_0MA2 m'ilijUna _0MA2 m'ilijUna
_1M2 m'ilijUn _1M2 m'ilijUn
?4 _0M2 m'ilijOna ?4 _0M2 m'ilijOna
?4 _0MA2 m'ilijOna ?4 _0MA2 m'ilijOna
?4 _1M2 m'ilijOn ?4 _1M2 m'ilijOn

_0M3 m'iliaRdI _0M3 m'iliaRdI
_0MA3 m'iliaRde _0MA3 m'iliaRde
_1M3 m'iliaRdU _1M3 m'iliaRdU
?2 _0M3 milijArdI ?2 _0M3 milijArdI
?2 _0MA3 milijArde ?2 _0MA3 milijArde
?2 _1M3 milijArdU ?2 _1M3 milijArdU

_0M4 b'ilijUna _0M4 b'ilijUna
_1M4 b'ilijUn _1M4 b'ilijUn
?4 _0M4 b'ilijOna ?4 _0M4 b'ilijOna
?4 _1M4 b'ilijOn ?4 _1M4 b'ilijOn

_dpt _:z'a*Ez_ _dpt _:z'a*Ez_
_roman r*'imsko _roman r*'imsko



+ 54
- 2
dictsource/pt_list View File



acerto $alt2 $noun acerto $alt2 $noun
adore $alt adore $alt
albatrozes $alt
alferes $alt alferes $alt
algozes $alt
atrozes $alt
ameba $alt ameba $alt
belo $alt
besta $alt2
boca $alt2 boca $alt2
bolo $alt2
borboleta $alt2 borboleta $alt2
bordo $alt
cabeça $alt2
casebre $alt
catorze $alt2 catorze $alt2
cerca $alt $verb cerca $alt $verb
cerco $alt $verb cerco $alt $verb
chamego $alt2 chamego $alt2
chefe $alt
chinelo $alt
coco $alt2
começo $alt2 $noun
comeres $alt2 comeres $alt2
conheço $alt2 conheço $alt2
copa $alt copa $alt
copo $alt copo $alt
cornos $alt
corpos $alt corpos $alt
corto $alt
corvos $alt corvos $alt
coto $alt2
couber $alt couber $alt
couberem $alt couberem $alt
couberdes $alt couberdes $alt
couberes $alt couberes $alt
der $alt der $alt
descova $alt2
desfecho $alt2
dez $alt dez $alt
doce $alt2 doce $alt2
descova $alt2
droga $alt
enumerem $alt enumerem $alt
erro $alt2 $noun erro $alt2 $noun
esforços $alt
esperma $alt
estrofe $alt
estiverdes $alt estiverdes $alt
estiveres $alt estiveres $alt
farofa $alt farofa $alt
fere $alt fere $alt
ferem $alt ferem $alt
fezes $alt
fizer $alt fizer $alt
fizerem $alt fizerem $alt
fizerdes $alt fizerdes $alt
fizeres $alt fizeres $alt
fogos $alt fogos $alt
fores $alt2
fosse $alt2 fosse $alt2
fossem $alt2 fossem $alt2
foste $alt2
frevo $alt2
gelo $alt $verb
germe $alt germe $alt
grego $alt2
groselha $alt
grosso $alt2 grosso $alt2
grozo $alt $verb
hoje $alt2 hoje $alt2
joga $alt
jogam $alt
jogos $alt jogos $alt
jogue $alt
joguem $alt
líderes $alt2 líderes $alt2
lopes $alt lopes $alt
mantiverdes $alt mantiverdes $alt
mexa m'eS& mexa m'eS&
mexi meS'i mexi meS'i
mexo m'eSU mexo m'eSU
miolo $alt2
modo $alt modo $alt
modos $alt modos $alt
molho $alt $verb
morcego $alt2
morda $alt2
mortos $alt mortos $alt
?2 mulher mulj'Er ?2 mulher mulj'Er
?4 mulher mul^'Er ?4 mulher mul^'Er
muito mw'iNtU // -s is included as a suffix muito mw'iNtU // -s is included as a suffix
muita mw'iNt& muita mw'iNt&
mulheres $alt mulheres $alt
negro $alt2
novos $alt novos $alt
onu $1 onu $1
opereta $alt2
osso $alt2
ovos $alt ovos $alt
paexa paeSa paexa paeSa
pedra $alt pedra $alt
pelego $alt2
perdem $alt perdem $alt
perede $alt2
pesa $alt pesa $alt
pesam $alt pesam $alt
pesque $alt
pesquem $alt
peso $alt peso $alt
peso $alt2 $noun peso $alt2 $noun
portos $alt portos $alt
pose $alt2
povos $alt povos $alt
preto $alt2 preto $alt2
profere $alt profere $alt
selvagem seUv'aZeIN selvagem seUv'aZeIN
soco $alt2 soco $alt2
sofrem $alt sofrem $alt
sofres $alt
sofre $alt
sofreste $alt2
sopre $alt sopre $alt
soprem $alt soprem $alt
souber $alt souber $alt
souberdes $alt souberdes $alt
souberes $alt souberes $alt
souberem $alt souberem $alt
sugere $alt
sugerem $alt sugerem $alt
suor swOr suor swOr
tapete $alt2 tapete $alt2
tiver $alt tiver $alt
tiveres $alt tiveres $alt
torres $alt2 torres $alt2
tortos $alt
travesso $alt2
trevo $alt2
troco $alt2 $noun
tropeço $alt2 $noun tropeço $alt2 $noun
vanessa $alt2 vanessa $alt2
verbo $alt verbo $alt
verme $alt verme $alt
vierem $alt vierem $alt
violeta $alt2 violeta $alt2
vozes $alt


// Close [o] // Close [o]
?1 calculadora $alt2 ?1 calculadora $alt2

+ 16
- 0
dictsource/pt_rules View File

// G a voiced consonant // G a voiced consonant
// K not a vowel // K not a vowel


// endings
.L01 a am o
.L02 a am e em o

.group a .group a
_) a (_ a _) a (_ a
_) a (_W 'a // in an acronym _) a (_W 'a // in an acronym
?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc... ?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc...
?1 l) e (ta 'E // eg: bicicleta, atleta. ?1 l) e (ta 'E // eg: bicicleta, atleta.


_com) e (tL01_ e
_prom) e (tL01_ e
_esqu) e (çL01_ e
_derr) e (tL01_ e
_atr) e (vL01_ e
_f) e (rvL01_ e
_per) e (çL01_ e
_pad) e (çL01_ e
_dec) e (pL02_ E
_p) e (scL01_ E


.group é .group é
é ''E é ''E
?1 f) o (rmulá u // eg: formulário, formulários. ?1 f) o (rmulá u // eg: formulário, formulários.
?1 v) o (lt O ?1 v) o (lt O


_m) o (lhL02_ O



.group ô .group ô
ô ''o ô ''o

+ 21
- 33
phsource/compile_report View File

bo 10 152 bo 10 152
kk 20 117 kk 20 117
fa 9 110 fa 9 110
ga 25 125
ga 21 125


Data file Used by Data file Used by
b/b [b] base b/b [b] base
[d] hr [d] hr
[d] sq [d] sq
[d] mt [d] mt
[d[] ga
d/d_ [d] base d/d_ [d] base
[d[] base [d[] base
[d] base2 [d] base2
[d] hr [d] hr
[d] sq [d] sq
[d] mt [d] mt
[d[] ga
d/d_dnt [d] sr d/d_dnt [d] sr
d/dr [*] base d/dr [*] base
[d[] base [d[] base
[d] hr [d] hr
[d] sq [d] sq
[d] mt [d] mt
[d[] ga
d/tap [*;] ro d/tap [*;] ro
d/tap1 [*] base d/tap1 [*] base
d/tap2 [t#] en d/tap2 [t#] en
[d] mt [d] mt
[dz] bo [dz] bo
[dzh] bo [dzh] bo
[d[] ga
d/xd3 [dh] hi d/xd3 [dh] hi
d/xd_pzd [d^] et d/xd_pzd [d^] et
[d;] lt [d;] lt
[l/] fr [l/] fr
l/l_@ [l/3] base l/l_@ [l/3] base
[l/] fr [l/] fr
l/l@ [höx] base
l/l@ [hF{] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
l/L2_uL [l/2] base l/L2_uL [l/2] base
l/l_3 [l/] de l/l_3 [l/] de
l/l_4 [ll] sq l/l_4 [ll] sq
l/la [höx] base
l/la [hF{] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
[K] tn [K] tn
l/l_a [l/3] base l/l_a [l/3] base
[l/] fr [l/] fr
l/le [höx] base
l/le [hF{] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
[&:] af [&:] af
l/l_front [L] sq l/l_front [L] sq
l/l_front_ [l/4] sq l/l_front_ [l/4] sq
l/li [höx] base
l/li [hF{] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
ll/_ll [L] bg ll/_ll [L] bg
l/l_long [l] base l/l_long [l] base
[l] fr [l] fr
l/lo [höx] base
l/lo [hF{] base
[l#] base [l#] base
[l/2] fr [l/2] fr
[K] nso [K] nso
[l;] lt [l;] lt
[l] ru [l] ru
[l^] ru [l^] ru
l/lu [höx] base
l/lu [hF{] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
[K] tn [K] tn
ufric/x [x] base ufric/x [x] base
[kh] vi [kh] vi
[x] ga
ufric/x2 [x2] af ufric/x2 [x2] af
[x] ku [x] ku
[X] kk [X] kk
ufric/x_hr [x] base ufric/x_hr [x] base
[x] hr [x] hr
[x] ru [x] ru
[x] ga
ufric/x_sr [h#] sr ufric/x_sr [h#] sr
[x#] sr [x#] sr
ufric/xx [X] base ufric/xx [X] base
[t] lt [t] lt
[t] pl [t] pl
[t] hr [t] hr
[t[] ga
ustop/t_dnt2 [t] base2 ustop/t_dnt2 [t] base2
[d] kn [d] kn
ustop/t_hi [t[] base ustop/t_hi [t[] base
[t] et [t] et
[t^] et [t^] et
[t`] am [t`] am
[t[] ga
ustop/t_pzd [c] base ustop/t_pzd [c] base
[t^] et [t^] et
[t;] lt [t;] lt
vdiph2/e_u [e[u] ro vdiph2/e_u [e[u] ro
vdiph2/i@ [i@] en-n vdiph2/i@ [i@] en-n
[i@] hy [i@] hy
[i@] ga
vdiph2/i@_2 [i@] en-wm vdiph2/i@_2 [i@] en-wm
vdiph2/ie [i@] en-wi vdiph2/ie [i@] en-wi
[ie] fi [ie] fi
vdiph2/o_oo [o@] en-wi vdiph2/o_oo [o@] en-wi
[O:] is [O:] is
[o] zh [o] zh
vdiph2/u@ [u@] ga
vdiph2/u#@ [U@] en-sc vdiph2/u#@ [U@] en-sc
vdiph2/uaa [uo] lt vdiph2/uaa [uo] lt
[uo] lv [uo] lv
vdiph/@i [Yi] et vdiph/@i [Yi] et
[@I] vi [@I] vi
[@:I] vi [@:I] vi
[@I] ga
vdiph/&i [&i] fi vdiph/&i [&i] fi
[&i] et [&i] et
[aI] hi [aI] hi
[@:U] vi [@:U] vi
vdiph/@u_2 [oU] en-rp vdiph/@u_2 [oU] en-rp
vdiph/@u_3 [@U] ro vdiph/@u_3 [@U] ro
[@U] ga
vdiph/@u_en [oU] en vdiph/@u_en [oU] en
[@U] id [@U] id
vdiph/ui [uI] base2 vdiph/ui [uI] base2
[@] wo [@] wo
[@:] wo [@:] wo
[@] te [@] te
[@] ga
[E#] ga
[I#] ga
[O#] ga
[U#] ga
vowel/@- [@-] base vowel/@- [@-] base
[r*] hr [r*] hr
vowel/& [a] en-rp vowel/& [a] en-rp
[a] sq [a] sq
[a/] sq [a/] sq
[3] da [3] da
[a#] ga
vowel/a_4 [a] es vowel/a_4 [a] es
[a] el [a] el
[a] vi [a] vi
[A] zh [A] zh
[A@] tn [A@] tn
[A:] ga [A:] ga
[A0:] ga
[A1:] ga
[A9:] ga
[0A:] ga
vowel/aa_3 [A:] af vowel/aa_3 [A:] af
[A] sq [A] sq
[A] prs [A] prs
[A1] et [A1] et
[A] nl [A] nl
[a:] is [a:] is
[0] ga
vowel/aa_9 [a] fi vowel/aa_9 [a] fi
[a] et [a] et
[a:] hi [a:] hi
[E] wo [E] wo
[E:] wo [E:] wo
[E] tn [E] tn
[E] ga
vowel/ee_6 [&] sk vowel/ee_6 [&] sk
[E3] sv [E3] sv
[E] ku [E] ku
[E] prs [E] prs
[E] ht [E] ht
[e] si [e] si
[E] ga
vowel/e_mid2 [E] af vowel/e_mid2 [E] af
[E] de [E] de
[E2] de [E2] de
[i] wo [i] wo
vowel/ii_7 [i] en vowel/ii_7 [i] en
[i] sq [i] sq
[i] ga
vowel/ii_8 [i] kk vowel/ii_8 [i] kk
vowel/ii_final [i] en-us vowel/ii_final [i] en-us
[i] en-rp [i] en-rp
[o] te [o] te
[o:] te [o:] te
[o] bo [o] bo
[o2] ga
[o3] ga
[o:] ga [o:] ga
vowel/o_2 [o:] cy vowel/o_2 [o:] cy
[o:] hi [o:] hi
[o] prs [o] prs
[O] wo [O] wo
[O:] wo [O:] wo
[O] ga
vowel/oo_1 [O:] en-n vowel/oo_1 [O:] en-n
[O:] en-rp [O:] en-rp
[O@] en-rp [O@] en-rp
[O:] hi [O:] hi
[O] it [O] it
[O] pa [O] pa
[O] ga
vowel/oo_5 [O] pl vowel/oo_5 [O] pl
[O] is [O] is
[O] sq [O] sq
[u] ak [u] ak
[u:] wo [u:] wo
[u] bo [u] bo
[u1] ga
[u:] ga
vowel/u# [u:] en-sc vowel/u# [u:] en-sc
[Y] tr [Y] tr
vowel/u_2 [u1] fi vowel/u_2 [u1] fi
[u] ne [u] ne
[u] pa [u] pa
[u] mt [u] mt
[u:] ga
vowel/u_bck2 [u] et vowel/u_bck2 [u] et
[u] fr [u] fr
[u:] fr [u:] fr
[u] es [u] es
[u] ht [u] ht
[u] fa [u] fa
[U] ga
vowel/u_bck3 [u:] et vowel/u_bck3 [u:] et
[u] kk [u] kk
vowel/uu [U] en vowel/uu [U] en
[U] en-n [U] en-n
[U] en-wm [U] en-wm
[U] tn [U] tn
[U] ga
vowel/uu# [U] ku vowel/uu# [U] ku
vowel/uu_2 [U] base2 vowel/uu_2 [U] base2
[U] de [U] de
[V] pa [V] pa
vowel/V_4 [V] en-sc vowel/V_4 [V] en-sc
[V] da [V] da
[V] ga
vowel/V_6 [V] en-us vowel/V_6 [V] en-us
[a#] lv [a#] lv
vowel/y [y] base2 vowel/y [y] base2
[yI] is [yI] is
[y] hy [y] hy
vwl_af/@ [@] af vwl_af/@ [@] af
[@] ga
vwl_af/I [I] af vwl_af/I [I] af
vwl_af/r@ [@] af vwl_af/r@ [@] af
[I] af [I] af
[@] ga
vwl_de/uu_@ [UR] de vwl_de/uu_@ [UR] de
vwl_en/aI@ [aI@] en vwl_en/aI@ [aI@] en
[aI@] en-n [aI@] en-n
[d] is [d] is
[d] sq [d] sq
[d] mt [d] mt
[d[] ga
x/d_dnt [d[] base x/d_dnt [d[] base
[d] base2 [d] base2
[d] fi [d] fi
[d] lt [d] lt
[d] pl [d] pl
[d] mt [d] mt
[d[] ga
x/d_pzd [d^] et x/d_pzd [d^] et
[d;] lt [d;] lt
[d;] pl [d;] pl

+ 210
- 29
platforms/riscos/cpp/speak_riscos View File

extern int WcmdqUsed(); extern int WcmdqUsed();
extern void FreePhData(); extern void FreePhData();
extern void FreeDictionary(); extern void FreeDictionary();
extern void Write4Bytes(FILE *f, int value);


extern int wcmdq_head; extern int wcmdq_head;
extern int wcmdq_tail; extern int wcmdq_tail;
extern int current_source_index; extern int current_source_index;


FILE *f_text; FILE *f_text;
FILE *f_wave = NULL;
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;


int sample_rate_index; // current value int sample_rate_index; // current value
int current_voice_num=0; int current_voice_num=0;
int n_voice_files = 0; int n_voice_files = 0;
int n_voice_variant_files = 0;


// output sound buffer, 2 bytes per sample // output sound buffer, 2 bytes per sample
static unsigned short SoundBuf[4096]; static unsigned short SoundBuf[4096];
static int more_text=0; static int more_text=0;


#define N_VOICE_NAMES 60 #define N_VOICE_NAMES 60
static char *voice_names[40];
#define N_VOICE_VARIANT_NAMES 30
static char *voice_names[N_VOICE_NAMES];
static char *voice_variant_names[N_VOICE_VARIANT_NAMES];


#define N_STATIC_BUF 8000 #define N_STATIC_BUF 8000
static char static_buf[N_STATIC_BUF]; static char static_buf[N_STATIC_BUF];
"-p <integer>\n" "-p <integer>\n"
"\t Pitch adjustment, 0 to 99, default is 50\n" "\t Pitch adjustment, 0 to 99, default is 50\n"
"-s <integer>\n" "-s <integer>\n"
"\t Speed in words per minute 80 to 370, default is 170\n"
"\t Speed in words per minute 80 to 390, default is 170\n"
"-v <voice name>\n" "-v <voice name>\n"
"\t Use voice file of this name from espeak-data/voices\n" "\t Use voice file of this name from espeak-data/voices\n"
"-w <wave file name>\n" "-w <wave file name>\n"
"--punct=\"<characters>\"\n" "--punct=\"<characters>\"\n"
"\t Speak the names of punctuation characters during speaking. If\n" "\t Speak the names of punctuation characters during speaking. If\n"
"\t =<characters> is omitted, all punctuation is spoken.\n" "\t =<characters> is omitted, all punctuation is spoken.\n"
//"--voices=<langauge>\n"
//"\t List the available voices for the specified language.\n"
//"\t If <language> is omitted, then list all voices.\n"
"--voices=<language>\n"
"\t List the available voices for the specified language.\n"
"\t If <language> is omitted, then list all voices.\n"
"-k <integer>\n" "-k <integer>\n"
"\t Indicate capital letters with: 1=sound, 2=the word \"capitals\",\n" "\t Indicate capital letters with: 1=sound, 2=the word \"capitals\",\n"
"\t higher values = a pitch increase (try -k20).\n"; "\t higher values = a pitch increase (try -k20).\n";
} /* end of GetFileLength */ } /* end of GetFileLength */




void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr)
{
}


void ReadVoiceNames2(char *directory) void ReadVoiceNames2(char *directory)
{//================================== {//==================================
int len; int len;
int path_len;
int *type; int *type;
char *p; char *p;
_kernel_swi_regs regs; _kernel_swi_regs regs;
regs.r[5] = sizeof(buf); regs.r[5] = sizeof(buf);
regs.r[6] = 0; regs.r[6] = 0;


path_len = strlen(directory);

while(regs.r[3] > 0) while(regs.r[3] > 0)
{ {
error = _kernel_swi(0x0c+os_X,&regs,&regs); /* OS_GBPB 10, read directory entries */ error = _kernel_swi(0x0c+os_X,&regs,&regs); /* OS_GBPB 10, read directory entries */
} }
else else
{ {
p = Alloc(len+1);
p = (char *)malloc(len+1);
strcpy(p,&buf[20]); strcpy(p,&buf[20]);
voice_names[n_voice_files++] = p;
if(n_voice_files >= (N_VOICE_NAMES-1))
break;

if(strcmp(&directory[path_len-3],".!v")==0)
{
if(n_voice_variant_files >= (N_VOICE_VARIANT_NAMES-1))
continue;
voice_variant_names[n_voice_variant_files++] = p;
}
else
{
if(n_voice_files >= (N_VOICE_NAMES-1))
continue;
voice_names[n_voice_files++] = p;
}
} }
} }
} }
{//=================== {//===================
char directory[sizeof(path_home)+10]; char directory[sizeof(path_home)+10];


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

n_voice_files = 0; n_voice_files = 0;
n_voice_variant_files = 0;

sprintf(directory,"%s.voices",path_home); sprintf(directory,"%s.voices",path_home);


ReadVoiceNames2(directory); ReadVoiceNames2(directory);

voice_names[n_voice_files] = NULL;
voice_variant_names[n_voice_variant_files] = NULL;
} }




#endif #endif






static int OpenWaveFile(const char *path, int rate)
//=================================================
{
// Set the length of 0x7fffffff for --stdout
// This will be changed to the correct length for -w (write to file)
static unsigned char wave_hdr[44] = {
'R','I','F','F',0,0,0,0,'W','A','V','E','f','m','t',' ',
0x10,0,0,0,1,0,1,0, 9,0x3d,0,0,0x12,0x7a,0,0,
2,0,0x10,0,'d','a','t','a', 0xff,0xff,0xff,0x7f};

if(path == NULL)
return(2);

if(strcmp(path,"stdout")==0)
f_wave = stdout;
else
f_wave = fopen(path,"wb");

if(f_wave != NULL)
{
fwrite(wave_hdr,1,24,f_wave);
Write4Bytes(f_wave,rate);
Write4Bytes(f_wave,rate * 2);
fwrite(&wave_hdr[32],1,12,f_wave);
return(0);
}
return(1);
} // end of OpenWaveFile




static void CloseWaveFile(int rate)
//=================================
{
unsigned int pos;

if((f_wave == NULL) || (f_wave == stdout))
return;

fflush(f_wave);
pos = ftell(f_wave);

fseek(f_wave,4,SEEK_SET);
Write4Bytes(f_wave,pos - 8);

fseek(f_wave,40,SEEK_SET);
Write4Bytes(f_wave,pos - 44);


fclose(f_wave);
f_wave = NULL;

} // end of CloseWaveFile




void MarkerEvent(int type, unsigned int char_position, int value, unsigned char *out_ptr) void MarkerEvent(int type, unsigned int char_position, int value, unsigned char *out_ptr)
{//====================================================================================== {//======================================================================================
// Do nothing in the command-line version. // Do nothing in the command-line version.
} // end of MarkerEvent } // end of MarkerEvent




static int WavegenFile(void)
{//=========================
int finished;
unsigned char wav_outbuf[1024];

out_ptr = out_start = wav_outbuf;
out_end = wav_outbuf + sizeof(wav_outbuf);

finished = WavegenFill(0);

if(f_wave != NULL)
{
fwrite(wav_outbuf, 1, out_ptr - wav_outbuf, f_wave);
}
return(finished);
} // end of WavegenFile






void FillSoundBuf(int size) void FillSoundBuf(int size)


WavegenInit(22050,0); WavegenInit(22050,0);
LoadPhData(); LoadPhData();
SetVoiceStack(NULL);
SetVoiceStack(NULL, "");
SynthesizeInit(); SynthesizeInit();
return(0); return(0);
} }
regs.r[1] = (int)module_data; regs.r[1] = (int)module_data;
_kernel_swi(0x5f, &regs, &regs); _kernel_swi(0x5f, &regs, &regs);


option_endpause = 1;


if((voice_num >= 0) && (voice_num != current_voice_num) && (voice_num < N_VOICE_NAMES)) if((voice_num >= 0) && (voice_num != current_voice_num) && (voice_num < N_VOICE_NAMES))
{ {
option_linelength = 0; option_linelength = 0;
option_phonemes = 0; option_phonemes = 0;
option_waveout = 0; option_waveout = 0;
option_harmonic1 = 8;
option_multibyte = 0; // auto option_multibyte = 0; // auto
option_capitals = 0; option_capitals = 0;
option_punctuation = 0; option_punctuation = 0;
void jsd_swi_functions(int *r) void jsd_swi_functions(int *r)
/****************************/ /****************************/
{ {
espeak_VOICE voice_select;

switch(r[0]) switch(r[0])
{ {
case 0: /* major version */ case 0: /* major version */
r[0] = 3;
r[0] = 4;
r[1] = 331;
break; break;


case 1: /* register user */ case 1: /* register user */


case 5: /* get table of voice names */ case 5: /* get table of voice names */
r[0] = (int)voice_names; r[0] = (int)voice_names;
r[1] = (int)voice_variant_names;
break; break;


case 6: /* update voice data, r1 = voice_number */ case 6: /* update voice data, r1 = voice_number */
// init_voice((char *)r[1]); // init_voice((char *)r[1]);
break; break;


case 8:
// list voices, r[1] contains optional language name (or "variant")
voice_select.languages = (char *)r[1];
voice_select.age = 0;
voice_select.gender = 0;
voice_select.name = NULL;
r[0] = (int)espeak_ListVoices(&voice_select);
break;

default: default:
r[0] = 0; r[0] = 0;
r[1] = 0; r[1] = 0;
{ {
int value; int value;
int q_length; int q_length;
int speed;
int amp;
value = r[0]; value = r[0];


switch(swi_no) switch(swi_no)
break; break;


case 8: /* speed */ case 8: /* speed */
speed = (value * 160)/140;
SetParameter(espeakRATE,speed,0);
SetParameter(espeakRATE,value,0);
break; break;


case 9: /* word_gap */ case 9: /* word_gap */
break; break;


case 13: /* volume */ case 13: /* volume */
amp = (value*45)/100;
SetParameter(espeakVOLUME,amp,0);
SetParameter(espeakVOLUME,value,0);
WavegenSetVoice(voice); WavegenSetVoice(voice);
break; break;
} }
void PitchAdjust(int pitch_adjustment) void PitchAdjust(int pitch_adjustment)
{//=================================== {//===================================
int ix, factor; int ix, factor;
extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1];


voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128; voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128;






void DisplayVoices(FILE *f_out, char *language)
{//============================================
int ix;
const char *p;
int len;
int count;
int scores = 0;
const espeak_VOICE *v;
const char *lang_name;
char age_buf[12];
const espeak_VOICE **voices;
espeak_VOICE voice_select;

static char genders[4] = {' ','M','F',' '};

if(language[0] == '=')
{
// display only voices for the specified language, in order of priority
voice_select.languages = &language[1];
voice_select.age = 0;
voice_select.gender = 0;
voice_select.name = NULL;
voices = espeak_ListVoices(&voice_select);
scores = 1;
}
else
{
voices = espeak_ListVoices(NULL);
}

fprintf(f_out,"Pty Language Age/Gender VoiceName File Other Langs\n");

for(ix=0; (v = voices[ix]) != NULL; ix++)
{
count = 0;
p = v->languages;
while(*p != 0)
{
len = strlen(p+1);
lang_name = p+1;

if(v->age == 0)
strcpy(age_buf," ");
else
sprintf(age_buf,"%3d",v->age);

if(count==0)
{
fprintf(f_out,"%2d %-12s%s%c %-17s %-11s ",
p[0],lang_name,age_buf,genders[v->gender],v->name,v->identifier);
}
else
{
fprintf(f_out,"(%s %d)",lang_name,p[0]);
}
count++;
p += len+2;
}
// if(scores)
// fprintf(f_out,"%3d ",v->score);
fputc('\n',f_out);
}
} // end of DisplayVoices



char *param_string(char **argp) char *param_string(char **argp)
{//============================ {//============================
char *p; char *p;
option_phonemes = 0; option_phonemes = 0;
option_waveout = 0; option_waveout = 0;
option_quiet = 0; option_quiet = 0;
option_harmonic1 = 8;
option_multibyte = 0; // auto option_multibyte = 0; // auto
option_capitals = 0; option_capitals = 0;
option_punctuation = 0; option_punctuation = 0;
case 'm': case 'm':
option_ssml = 1; option_ssml = 1;
break; break;
case 'p': case 'p':
pitch_adjustment = param_number(&p); pitch_adjustment = param_number(&p);
break; break;
wordgap = param_number(&p); wordgap = param_number(&p);
SetParameter(espeakWORDGAP,wordgap,0); SetParameter(espeakWORDGAP,wordgap,0);
break; break;
case 'v': case 'v':
strncpy0(voicename,param_string(&p),sizeof(voicename)); strncpy0(voicename,param_string(&p),sizeof(voicename));
break; break;
strncpy0(command,param_string(&p),sizeof(command)); strncpy0(command,param_string(&p),sizeof(command));
if(memcmp(command,"compile=",8)==0) if(memcmp(command,"compile=",8)==0)
{ {
CompileDictionary(NULL,&command[8],NULL,NULL);
CompileDictionary(NULL,&command[8],NULL,NULL,0);
return;
}
else
if(memcmp(command,"voices",6)==0)
{
DisplayVoices(stdout,&command[6]);
return; return;
} }
else else
{ {
RiscosCloseSound(); RiscosCloseSound();
RemoveCallback(); RemoveCallback();
delete translator;
DeleteTranslator(translator);
FreePhData(); FreePhData();
} /* end of terminate_module */ } /* end of terminate_module */


for(param=0; param<N_SPEECH_PARAM; param++) for(param=0; param<N_SPEECH_PARAM; param++)
param_stack[0].parameter[param] = param_defaults[param]; param_stack[0].parameter[param] = param_defaults[param];


SetParameter(espeakRATE,170,0);
SetParameter(espeakVOLUME,65,0);
SetParameter(espeakRATE,175,0);
SetParameter(espeakVOLUME,70,0);


WavegenSetVoice(voice); WavegenSetVoice(voice);
atexit(terminate_module); atexit(terminate_module);

+ 1
- 1
platforms/riscos/s/cmhgfile View File

initialisation-code: user_init initialisation-code: user_init


title-string: Speak title-string: Speak
help-string: Speak 3.30 Text to Speech (32 bit)
help-string: Speak 3.46 Text to Speech (32 bit)


swi-chunk-base-number: &4ad80 swi-chunk-base-number: &4ad80
swi-handler-code: swi_handler swi-handler-code: swi_handler

+ 1
- 0
platforms/windows/espeakedit/src/speech.h View File

//#define SPECT_EDITOR //#define SPECT_EDITOR
#define INCLUDE_KLATT #define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC
#include <windows.h> #include <windows.h>
#define PLATFORM_WINDOWS #define PLATFORM_WINDOWS

+ 1
- 0
platforms/windows/espeakedit/src_copy/speech.h View File

//#define SPECT_EDITOR //#define SPECT_EDITOR
#define INCLUDE_KLATT #define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC
#include <windows.h> #include <windows.h>
#define PLATFORM_WINDOWS #define PLATFORM_WINDOWS

+ 2
- 0
platforms/windows/windows_cmd/src/speech.h View File

#define NO_VARIADIC_MACROS #define NO_VARIADIC_MACROS
#define INCLUDE_KLATT #define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC
// will look for espeak_data directory here, and also in user's home directory // will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" #define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 2
- 0
platforms/windows/windows_dll/src/speech.h View File

#define LIBRARY #define LIBRARY
#define INCLUDE_KLATT #define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC



// will look for espeak_data directory here, and also in user's home directory // will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" #define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 2
- 0
platforms/windows/windows_sapi/src/speech.h View File

//#define USE_NANOSLEEP //#define USE_NANOSLEEP
#define INCLUDE_KLATT #define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC
// will look for espeak_data directory here, and also in user's home directory // will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" #define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 32
- 25
src/numbers.cpp View File



static const char *M_Variant(int value) static const char *M_Variant(int value)
{//==================================== {//====================================
// returns M, or perhaps MA for some cases
// returns M, or perhaps MA or MB for some cases
if(translator->translator_name == L('l','t'))
int teens = 0;

if(((value % 100) > 10) && ((value % 100) < 20))
teens = 1;

switch((translator->langopts.numbers2 >> 6) & 0x7)
{ {
// Lithuanian
if((value % 10) == 1)
case 1: // lang=ru use singular for xx1 except for x11
if((teens == 0) && ((value % 10) == 1))
return("1M");
break;

case 2: // lang=cs,sk
if((value >= 2) && (value <= 4))
return("0MA"); return("0MA");
if(((value % 10) == 0) || ((value % 100) > 10) && ((value % 100) < 20))
{
return("0MB");
}
return("0M");
}
break;


if((translator->langopts.numbers2 & 0x100) && (value >= 2) && (value <= 4))
return("0MA"); // Czech, Slovak
else
if(((value % 100) < 10) || ((value % 100) > 20)) // but not teens, 10 to 19
{
if ((translator->langopts.numbers2 & 0x40) &&
((value % 10)>=2) &&
((value % 10)<=4))
{
// for Polish language - two forms of plural!
case 3: // lang=pl
if((teens == 0) && (((value % 10) >= 2) && ((value % 10) <= 4)))
return("0MA"); return("0MA");
}
break;

case 4: // lang=lt
if((teens == 1) || ((value % 10) == 0))
return("0MB");
if((value % 10) == 1)
return("0MA");
break;


if((translator->langopts.numbers2 & 0x80) &&
((value % 10)==1))
case 5: // lang=bs,hr,sr
if(teens == 0)
{ {
return("1MA");
if((value % 10) == 1)
return("1M");
if(((value % 10) >= 2) && ((value % 10) <= 4))
return("0MA");
} }

break;
} }
return("0M"); return("0M");
} }

+ 1
- 1
src/readclause.cpp View File

static int ReplaceKeyName(char *outbuf, int index, int &outix) static int ReplaceKeyName(char *outbuf, int index, int &outix)
{//=========================================================== {//===========================================================
// Replace some key-names by single characters, so they can be pronounced in different languages // Replace some key-names by single characters, so they can be pronounced in different languages
MNEM_TAB keynames[] = {
static MNEM_TAB keynames[] = {
{"space ",0xe020}, {"space ",0xe020},
{"tab ", 0xe009}, {"tab ", 0xe009},
{"underscore ", 0xe05f}, {"underscore ", 0xe05f},

+ 143
- 0
src/setlengths.cpp View File



//#define TEST_SPEED //#define TEST_SPEED


#ifdef INCLUDE_SONIC

void SetSpeed(int control) void SetSpeed(int control)
{//======================= {//=======================
int x; int x;
#endif #endif
} // end of SetSpeed } // end of SetSpeed


#else // not using sonic speed-up

void SetSpeed(int control)
{//=======================
// This is the earlier version of SetSpeed() before sonic speed-up was added
int x;
int s1;
int wpm;
int wpm2;

speed.loud_consonants = 0;
speed.min_sample_len = 450;
speed.lenmod_factor = 110; // controls the effect of FRFLAG_LEN_MOD reduce length change
speed.lenmod2_factor = 100;

wpm = embedded_value[EMBED_S];
if(control == 2)
wpm = embedded_value[EMBED_S2];

#ifdef TEST_SPEED
if(wpm > 1000)
{
// TESTING
test = wpm / 1000;
wpm = wpm % 1000;
}
#endif

if(voice->speed_percent > 0)
{
wpm = (wpm * voice->speed_percent)/100;
}
if(wpm > 450)
wpm = 450;

if(wpm > 360)
{
speed.loud_consonants = (wpm - 360) / 8;
}

wpm2 = wpm;
if(wpm > 359) wpm2 = 359;
if(wpm < 80) wpm2 = 80;
x = speed_lookup[wpm2-80];

if(wpm >= 380)
x = 7;
if(wpm >= 400)
x = 6;

if(control & 1)
{
// set speed factors for different syllable positions within a word
// these are used in CalcLengths()
speed1 = (x * voice->speedf1)/256;
speed2 = (x * voice->speedf2)/256;
speed3 = (x * voice->speedf3)/256;

if(x <= 7)
{
speed1 = x;
speed2 = speed3 = x - 1;
}
}

if(control & 2)
{
// these are used in synthesis file

if(wpm > 350)
{
speed.lenmod_factor = 85 - (wpm - 350) / 3;
speed.lenmod2_factor = 60 - (wpm - 350) / 8;
}
else
if(wpm > 250)
{
speed.lenmod_factor = 110 - (wpm - 250)/4;
speed.lenmod2_factor = 110 - (wpm - 250)/2;
}

s1 = (x * voice->speedf1)/256;

if(wpm >= 170)
speed.wav_factor = 110 + (150*s1)/128; // reduced speed adjustment, used for playing recorded sounds
else
speed.wav_factor = 128 + (128*s1)/130; // = 215 at 170 wpm

if(wpm >= 350)
{
speed.wav_factor = wav_factor_350[wpm-350];
}

if(wpm >= 390)
{
speed.min_sample_len = 450 - (wpm - 400)/2;
if(wpm > 440)
speed.min_sample_len = 420 - (wpm - 440);
}

speed.pause_factor = (256 * s1)/115; // full speed adjustment, used for pause length
speed.clause_pause_factor = 0;

if(wpm > 430)
{
speed.pause_factor = 12;
// speed.clause_pause_factor = 15;
}
else
if(wpm > 400)
{
speed.pause_factor = 13;
// speed.clause_pause_factor = 15;
}
else
if(wpm > 374)
{
speed.pause_factor = 14;
}
else
if(wpm > 350)
{
speed.pause_factor = pause_factor_350[wpm - 350];
}

if(speed.clause_pause_factor == 0)
{
// restrict the reduction of pauses between clauses
if((speed.clause_pause_factor = speed.pause_factor) < 16)
speed.clause_pause_factor = 16;
}
}

#ifdef TEST_SPEED
//if(control==3)
printf("%3d: speedf %d %d %d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,speed2,speed3, speed.pause_factor,speed.clause_pause_factor, speed.wav_factor,speed.lenmod_factor,speed.lenmod2_factor);
#endif
} // end of SetSpeed

#endif // of INCLUDE_SONIC



#ifdef deleted #ifdef deleted
void SetAmplitude(int amp) void SetAmplitude(int amp)

+ 5
- 0
src/sonic.cpp View File



#include "StdAfx.h" #include "StdAfx.h"



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

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


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

+ 1
- 0
src/speech.h View File

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


#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
#define ARCH_BIG #define ARCH_BIG

+ 2
- 2
src/synthdata.cpp View File

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


const char *version_string = "1.46.21 25.Jul.12";
const char *version_string = "1.46.22 09.Aug.12";
const int version_phdata = 0x014600; const int version_phdata = 0x014600;


int option_device_number = -1; int option_device_number = -1;
if(instn2 < 8) if(instn2 < 8)
{ {
// ChangeIf // ChangeIf
if(StressCondition(tr, plist, instn2 & 7, 1))
if(StressCondition(tr, plist, instn2 & 7, 1) == true)
{ {
phdata->pd_param[i_CHANGE_PHONEME] = instn & 0xff; phdata->pd_param[i_CHANGE_PHONEME] = instn & 0xff;
end_flag = 1; // change phoneme, exit end_flag = 1; // change phoneme, exit

+ 2
- 0
src/synthesize.cpp View File

} // end of DoMarker } // end of DoMarker




#ifdef INCLUDE_SONIC
void DoSonicSpeed(int value) void DoSonicSpeed(int value)
{//========================= {//=========================
// value, multiplier * 1024 // value, multiplier * 1024
wcmdq[wcmdq_tail][1] = value; wcmdq[wcmdq_tail][1] = value;
WcmdqInc(); WcmdqInc();
} // end of DoSonicSpeed } // end of DoSonicSpeed
#endif




void DoVoiceChange(voice_t *v) void DoVoiceChange(voice_t *v)

+ 8
- 10
src/tr_languages.cpp View File

0, 0 }; 0, 0 };


// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa) // alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
static const unsigned short chars_ignore_fa[] = {
0x200c, 0x0605, // zero width non-joiner, replace with not-used Arabic character code
static const unsigned short chars_ignore_zwnj_hyphen[] = {
0x200c, '-', // zero width non-joiner, replace with hyphen
0x200d, 1, // zero width joiner 0x200d, 1, // zero width joiner
0, 0 }; 0, 0 };




case L('f','a'): // Farsi case L('f','a'): // Farsi
{ {
static const char fa_ZWNJ[] = {0x05, 0}; // use letter group G for ZWNJ U+200c
tr->letter_bits_offset = OFFSET_ARABIC; tr->letter_bits_offset = OFFSET_ARABIC;
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND; tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND;
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words


tr->chars_ignore = chars_ignore_fa;
SetLetterBits(tr,LETTERGP_G,(char *)fa_ZWNJ);
tr->chars_ignore = chars_ignore_zwnj_hyphen; // replace ZWNJ by hyphen
} }
break; break;


tr->langopts.accents = 1; tr->langopts.accents = 1;


tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS; tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS;
tr->langopts.numbers2 = 0x4a; // variant numbers before thousands,milliards
tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards
tr->langopts.replace_chars = replace_cyrillic_latin; tr->langopts.replace_chars = replace_cyrillic_latin;


SetLetterVowel(tr,'y'); SetLetterVowel(tr,'y');
tr->langopts.unstressed_wd2 = 2; tr->langopts.unstressed_wd2 = 2;
tr->langopts.param[LOPT_DIERESES] = 1; tr->langopts.param[LOPT_DIERESES] = 1;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
tr->langopts.numbers2 = 0x100;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR4;
tr->langopts.max_roman = 5000; tr->langopts.max_roman = 5000;
} }
break; break;
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9; tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9;
tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :) tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :)
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2;
tr->langopts.numbers2 = 0x40;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3;
tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt) tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt)
SetLetterVowel(tr,'y'); SetLetterVowel(tr,'y');
} }
tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word


tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN; tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN;
tr->langopts.numbers2 = 0x100;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR2;
tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator
tr->langopts.decimal_sep = ','; tr->langopts.decimal_sep = ',';


tr->langopts.stress_flags = 0x0020; // waas 0x1010 tr->langopts.stress_flags = 0x0020; // waas 0x1010


tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
tr->langopts.numbers2 = 0xc2; // variant numbers before thousands
tr->langopts.numbers2 = 0x2 + NUM2_THOUSANDS_VAR1; // variant numbers before thousands
tr->langopts.phoneme_change = 1; tr->langopts.phoneme_change = 1;
tr->langopts.testing = 2; tr->langopts.testing = 2;



+ 2
- 2
src/translate.cpp View File

{//======================== {//========================
// Replacement for iswalph() which also checks for some in-word symbols // Replacement for iswalph() which also checks for some in-word symbols


const unsigned short extra_indic_alphas[] = {
static const unsigned short extra_indic_alphas[] = {
0xa70,0xa71, // Gurmukhi: tippi, addak 0xa70,0xa71, // Gurmukhi: tippi, addak
0 }; 0 };


found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0); found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0);
} }


if(!found & ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER))
if(!found && ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER))
{ {
// either all upper or all lower case // either all upper or all lower case



+ 6
- 3
src/translate.h View File



#define NUM2_MULTIPLE_ORDINAL 0x1000 #define NUM2_MULTIPLE_ORDINAL 0x1000
#define NUM2_ENGLISH_NUMERALS 0x2000 #define NUM2_ENGLISH_NUMERALS 0x2000
#define NUM2_THOUSANDS_VAR1 0x40
#define NUM2_THOUSANDS_VAR2 0x80
#define NUM2_THOUSANDS_VAR3 0xc0
#define NUM2_THOUSANDS_VAR4 0x100
#define NUM2_THOUSANDS_VAR5 0x140
// bits 1-4 use variant form of numbers before thousands,millions,etc. // bits 1-4 use variant form of numbers before thousands,millions,etc.
// bit6=(LANG=pl) two forms of plural, M or MA
// bit7=(LANG-ru) use MB for 1 thousand, million, etc
// bit8=(LANG=cs,sk) two forms of plural, M or MA
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after // bit9=(LANG=rw) say "thousand" and "million" before its number, not after
// bit12=(LANG=el,es) use ordinal form of hundreds and tens as well as units // bit12=(LANG=el,es) use ordinal form of hundreds and tens as well as units
// bit13=(LANG=ne) speak (non-replaced) English numerals in English // bit13=(LANG=ne) speak (non-replaced) English numerals in English

+ 22
- 4
src/wavegen.cpp View File

#include "phoneme.h" #include "phoneme.h"
#include "synthesize.h" #include "synthesize.h"
#include "voice.h" #include "voice.h"
#include "sonic.h"


//#undef INCLUDE_KLATT
#ifdef INCLUDE_SONIC
#include "sonic.h"
#endif


#ifdef USE_PORTAUDIO #ifdef USE_PORTAUDIO
#include "portaudio.h" #include "portaudio.h"
static PaStream *pa_stream=NULL; static PaStream *pa_stream=NULL;
#endif #endif


#ifdef INCLUDE_SONIC
static sonicStream sonicSpeedupStream = NULL; static sonicStream sonicSpeedupStream = NULL;
double sonicSpeed = 1.0; double sonicSpeed = 1.0;
#endif


// 1st index=roughness // 1st index=roughness
// 2nd index=modulation_type // 2nd index=modulation_type
{//============= {//=============
wcmdq_head = 0; wcmdq_head = 0;
wcmdq_tail = 0; wcmdq_tail = 0;

#ifdef INCLUDE_SONIC
if(sonicSpeedupStream != NULL) if(sonicSpeedupStream != NULL)
{ {
sonicDestroyStream(sonicSpeedupStream); sonicDestroyStream(sonicSpeedupStream);
sonicSpeedupStream = NULL; sonicSpeedupStream = NULL;
} }
#endif

#ifdef USE_PORTAUDIO #ifdef USE_PORTAUDIO
Pa_AbortStream(pa_stream); Pa_AbortStream(pa_stream);
#endif #endif
} }
wdata.n_mix_wavefile = 0; wdata.n_mix_wavefile = 0;
wdata.amplitude_fmt = 100; wdata.amplitude_fmt = 100;
#ifdef INCLUDE_KLATT
KlattReset(1); KlattReset(1);
#endif
result = PlaySilence(length,resume); result = PlaySilence(length,resume);
break; break;


case WCMD_WAVE: case WCMD_WAVE:
echo_complete = echo_length; echo_complete = echo_length;
wdata.n_mix_wavefile = 0; wdata.n_mix_wavefile = 0;
#ifdef INCLUDE_KLATT
KlattReset(1); KlattReset(1);
#endif
result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8);
break; break;


wdata.amplitude_fmt = 100; // percentage, but value=0 means 100% wdata.amplitude_fmt = 100; // percentage, but value=0 means 100%
break; break;


#ifdef INCLUDE_SONIC
case WCMD_SONIC_SPEED: case WCMD_SONIC_SPEED:
sonicSpeed = (double)q[1] / 1024; sonicSpeed = (double)q[1] / 1024;
break; break;
#endif
} }


if(result==0) if(result==0)
} // end of WavegenFill2 } // end of WavegenFill2




#ifdef INCLUDE_SONIC
/* Speed up the audio samples with libsonic. */ /* Speed up the audio samples with libsonic. */
static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text) static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text)
{//============================================================================== {//==============================================================================
} }
return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out); return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out);
} // end of SpeedUp } // end of SpeedUp
#endif




/* Call WavegenFill2, and then speed up the output samples. */ /* Call WavegenFill2, and then speed up the output samples. */
{//============================ {//============================
int finished; int finished;
unsigned char *p_start; unsigned char *p_start;
int length;
int max_length;


p_start = out_ptr; p_start = out_ptr;


// fill_zeros is ignored. It is now done in the portaudio callback // fill_zeros is ignored. It is now done in the portaudio callback
finished = WavegenFill2(0); finished = WavegenFill2(0);


#ifdef INCLUDE_SONIC
if(sonicSpeed > 1.0) if(sonicSpeed > 1.0)
{ {
int length;
int max_length;

max_length = (out_end - p_start); max_length = (out_end - p_start);
length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished); length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished);
out_ptr = p_start + length; out_ptr = p_start + length;
if(length >= max_length) if(length >= max_length)
finished = 0; // there may be more data to flush finished = 0; // there may be more data to flush
} }
#endif
return finished; return finished;
} // end of WavegenFill } // end of WavegenFill



Loading…
Cancel
Save