diff --git a/dictsource/de_list b/dictsource/de_list index 73ac1ca0..feb154a5 100644 --- a/dictsource/de_list +++ b/dictsource/de_list @@ -42,6 +42,7 @@ _— g@d'ank@nSt@-*,IC _#9 t,abu:l'Ato:* _#32 l'e:*ts'aIC@n +_?? zymb'o:l // Not Roman numbers v faU diff --git a/dictsource/dict_phonemes b/dictsource/dict_phonemes index ee6649ef..cb663456 100644 --- a/dictsource/dict_phonemes +++ b/dictsource/dict_phonemes @@ -43,9 +43,9 @@ x z Dictionary de_dict 3 @ @- a A A: aI aU -E E2 E: e: EI I i2 I: -i: O o: OY U u: W y -y: Y: +E E2 E: e: EI I i2 i: +O o: OY U u: W y y: +Y: * : ; b C C2 d D dZ f g h j k l m @@ -117,8 +117,9 @@ w^i W~ y Y * : ; b c d dZ f g h j k l L m n -N n^ p r R s S t -t2 tS v w z Z z2 z3 +N n2 n^ p r R s S +t t2 tS v w z Z z2 +z3 Dictionary hi_dict @@ -281,7 +282,7 @@ u U uI u~ y g h j k l l^ m n N n^ p Q r R r- s S s# s; t T tS ts v -w w2 x z Z +w x z Z Dictionary ro_dict @@ -340,10 +341,10 @@ Dictionary zh_dict i i. i[ iou o o- ou u uai y -: f j k kh l m n -N p ph r R s s. S; -t th ts ts. ts. tS; tS; tsh -v w x z z. +(u) : f h j k kh l +m n N p ph r s s. +S; t th ts ts. ts. tS; tS; +tsh v w x z z. Dictionary jbo_dict @@ -390,3 +391,13 @@ x z Dictionary ja_dict + + +Dictionary tr_dict + +a e E i I o O u +u# W y Y + +: ; b d dZ f g h +j k l m n p Q r +R s S t tS v z Z diff --git a/dictsource/en_list b/dictsource/en_list index a98f12a0..1313a9e4 100644 --- a/dictsource/en_list +++ b/dictsource/en_list @@ -92,6 +92,25 @@ _| vi:b'A@ _} A@breIs _~ tIld@ +£ paUnd +¥ jEn +§ sEkS@n +_¶ par@graf // in en_rules +¤ kVr@nsI2saIn +© k0pI2raIt +° dI2gri:z +− maIn@s +± plVs@maIn@s +µ maIkroU +¼ a2kwO@t3 +½ a2hA:f +¾ Tri:kwO@t3 +× taImz +÷ dI2vaIdbaI +€ jU@roUz +♯ SA@p +♭ flat +ə SwA: // numeric @@ -2673,8 +2692,8 @@ than %Dan $only then DEn $verbf // these should be stressed at the start of a sentence -which ,wItS $pause $strend2 $only $verbsf -who ,hu: $verbsf $pause $strend2 $onlys +which ,wItS $pause $strend2 $only $verbf +who ,hu: $verbf $pause $strend2 $onlys whose ,hu:z $pause $only what ,w0t $strend2 $onlys how ,haU $strend2 $onlys diff --git a/dictsource/en_rules b/dictsource/en_rules index bcef1cf5..80257624 100644 --- a/dictsource/en_rules +++ b/dictsource/en_rules @@ -5160,7 +5160,6 @@ ë E ï i: ö 3: -?5 ö VR ü u: ç s ß s @@ -5178,7 +5177,6 @@ ?3 \\ bakslaS ?3 / slaS ' - £ paUnd ! _:Ekskl@meIS@n_: !) ! ? (? kwEstS@nmA@ks @@ -5227,22 +5225,6 @@ %) % (% %%) % (_ _:: -// extra symbols - ¥ jEn - § sEkS@n +// extra symbols (mostly in en_list) ¶ par@graf ¶¶ par@grafs - ¤ kVr@nsI2saIn - © k0pI2raIt - ° dI2gri:z - − maIn@s - ± plVs@maIn@s - µ maIkroU - ¼ a2kwO@t3 - ½ a2hA:f - ¾ Tri:kwO@t3 - × taImz - ÷ dI2vaIdbaI - € jU@roUz - ♯ SA@p - ♭ flat diff --git a/dictsource/es_list b/dictsource/es_list index beae3b9f..80b5f600 100644 --- a/dictsource/es_list +++ b/dictsource/es_list @@ -2,8 +2,54 @@ // This file in UTF8 encoded // letters -ch tSe -ll Ejje + +_cap m'aJ^us +_?? s'imbolo +_#32 Esp'aTjo + + +// names of symbols +_. punto +_, koma +_; p,untoik'oma +_: d,osp'untos +_! TE*R'aRaDmi**aTj'on +_? TE*R'aRintE*R,oQaTj'on +_¡ aB@-*'iRaDmi**aTj'on +_¿ aB@-*'iRintE*R,oQaTj'on +_= iQw'al +_< mEn'oRke +_> maJ^'oRke +_' apost@-*'ofo +_" kom'iJ^as +_+ s'iQnodesum'aR +_$ dolar +_# almoaD'il^a +_* astE*'isko +_- gJ^on +__ suB@-*aJ^'aDo +_/ ba*Ra +_\ b'a*RaimbERt'iDa +_` aT'Entog@-*'aBe +_( ,aB@-*epa**'EntEsis +_) Tj,E*Rapa**'EntEsis +_[ ,aB@-*ekoRtS'Ete +_] Tj,E*RakoRtS'Ete +_{ ,aB@-*eJ^'aBe +_} Tj,E*RaJ^'aBe +_« kom'iJ^as||iTkJ^'ERDas +_» kom'iJ^as||dE**'EtSas + +^ TiRkumfl'Exo +€ eU*o +% porTj'Ento +& ampERs'ant +@ a*R'oBa +/ ba*Ra +© kopi*R'aIt +£ liB@-*as +¶ p'a*Rafo +§ sEkTj'on // numbers @@ -291,8 +337,16 @@ v uve x Ekis _y ,ig@-*'iEQa y ,ig@-*'iEQa $atend +ch tSe +ll Ejje +á 'a||aTEntw'aDa +é 'e||aTEntw'aDa +í 'i||aTEntw'aDa +_ó 'o||aTEntw'aDa +ó 'o||aTEntw'aDa $atend +ú 'u||aTEntw'aDa +ü ,uDjE**'Esis -_. punto diff --git a/dictsource/es_rules b/dictsource/es_rules index ad6f60da..eb982ded 100644 --- a/dictsource/es_rules +++ b/dictsource/es_rules @@ -201,12 +201,6 @@ _)ñ (_ En^e $ d'olar - € eU*o - % porTj'Ento - & ampErs'ant - @ a*R'oBa - / b'a*Ra - © k,opi*R'aIt + m'as _) ++ (_ masm'as diff --git a/dictsource/fr_list b/dictsource/fr_list index 59b7f7c7..b119c9ed 100755 --- a/dictsource/fr_list +++ b/dictsource/fr_list @@ -63,9 +63,11 @@ _y i:gR'Ek // character names -//_cap k,ap@-t@L -_?A lEt@ -_?? sE~b'OL +//_cap k,ap@-t@L +_?A lEt@ +_?? sE~b'OL +_#9 tabylasjO~ +_#32 Espas _" gijmE _# djEz diff --git a/dictsource/fr_rules b/dictsource/fr_rules index 468835a3..8d0a8b12 100755 --- a/dictsource/fr_rules +++ b/dictsource/fr_rules @@ -3,7 +3,7 @@ // 2006-11-18 Gilles Casse // -// Updated: 2008-01-29 Michel Such +// Updated: 2008-02-04 Michel Such // // * The rules are based on Cicero TTS. // @@ -136,10 +136,9 @@ em (b A~ // décembre em (m A~ // emmancher em (p A~ - en (_ A~ // en + en (_ A~n2 // en en (hA A~n // enharmonique en (A A~n // enivrer - en (_A A~n // en avion C) en (d_ A~ // comprend dépend C) en (ds_ A~ @@ -395,6 +394,7 @@ _) h (ac _! // hache _) h (ai _! // haine haillon _) h (al _! // halte +_) h (amea _! // hameau _) h (amp _! // hampe _) h (an _! // hanche _) h (app _! // happer @@ -406,6 +406,7 @@ _) h (arp _! // harpe _) h (au _! // haut _) h (av _! // havre _) h (ern _! // hernie +_) h (éro _! // héros, héron _) h (ers _! // herse _) h (eurt _! // heurter _) h (ibo _! // hibou @@ -655,6 +656,7 @@ mou) rr RR // mourrai A) s (oft s // microsoft y) s (A z // paysage CCan) s (A z // transition + xpan) s (A s // expansion ibu) s (_ s @@ -758,8 +760,9 @@ C) te (_ t@- // patte um (b W~ // humble um (p W~ un (C W~ // emprunt lundi - un (_ W~ // brun - un (_A W~n // un avion + C) un (_ W~ // brun + uc) un (_ W~n2 // aucun + un (_ W~n2 // un avion g) u (A // fatigue g) u (ï y // ambiguïté @@ -864,3 +867,4 @@ C) te (_ t@- // patte + diff --git a/dictsource/no_list b/dictsource/no_list index 90186aff..93591071 100755 --- a/dictsource/no_list +++ b/dictsource/no_list @@ -23,7 +23,7 @@ m e:m n En p pe: q ku-: -r Err +r E:R s Es t te: v ve: diff --git a/dictsource/tr_list b/dictsource/tr_list new file mode 100644 index 00000000..eaad0544 --- /dev/null +++ b/dictsource/tr_list @@ -0,0 +1,71 @@ + +// This file is UTF8 encoded +// Spelling-to-phoneme words for Turkish + +a a +b be +c dZE +ç tSE +d dE +e E +f fE +g g;E +ğ jumuS'ak||g;'E +h hE +ı u# +i i +j ZE +k ka +l lE +m mE +n nE +o O +ö W +p pE +q kvE +r RE +s sE +ş SE +t tE +u u +ü y +v vE +w dubElv'E +x Eks +y jE +z zE + +_?? sEmb'Ol + +_0 su#fu#r +_1 bir +_2 iki +_3 YtS +_4 dWrt +_5 beS +_6 altu# +_7 jedi +_8 sekiz +_9 dokuz +_10 on +_1X on +_2X jirmi +_3X otuz +_4X ku#rk +_5X elli +_6X altmu#S +_7X jetmiS +_8X seksEn +_9X doksan +_0C jyz +_0M1 bIn +_0M2 miljon +_0M3 miljar +_dpt _virg,Yl + + + +// exceptions + +ankara $1 + diff --git a/dictsource/tr_rules b/dictsource/tr_rules new file mode 100644 index 00000000..fbe09344 --- /dev/null +++ b/dictsource/tr_rules @@ -0,0 +1,108 @@ + +// Turkish translation rules +// This file is UTF-8 encoded + + +.group a + a a + +.group b + b b + +.group c + c dZ + +.group ç + ç tS + +.group d + d d + +.group e + e e + +.group f + f f + +.group g + g g + +.group ğ + ğ Q + A) ğ : + +.group h + h h + +.group i + i i + +.group ı + ı u# + +.group j + j Z + +.group k + k k + +.group l + l l + +.group m + m m + + @) ma (_S2 m%a + @) me (_S2 m%e + @) mı (_S2 m%u# + +.group n + n n + +.group o + o o + +.group ö + ö W + +.group p + p p + +.group q + q k + +.group r + r r + +.group s + s s + +.group ş + ş S + +.group t + t t + +.group u + u u + +.group ü + ü y + +.group v + v v + +.group w + w v + +.group x + x ks + +.group y + y j + +.group z + z z + +.group + $ dolar diff --git a/docs/phonemes.html b/docs/phonemes.html index 15f3483b..0c3f80e4 100644 --- a/docs/phonemes.html +++ b/docs/phonemes.html @@ -144,8 +144,8 @@ In rhotic accents, such as General American, the phonemes [3:], [A@], [e@] [aU]mouth [oU]goat -[aI@] -[aU@] +[aI@]science +[aU@]hour diff --git a/espeak-data/voices/no b/espeak-data/voices/no index abd5818b..77b60b96 100755 --- a/espeak-data/voices/no +++ b/espeak-data/voices/no @@ -3,3 +3,4 @@ language no language nb gender male +intonation 4 diff --git a/espeak-data/voices/tr b/espeak-data/voices/tr new file mode 100755 index 00000000..00cef6fb --- /dev/null +++ b/espeak-data/voices/tr @@ -0,0 +1,4 @@ +name turkish-test +language tr +gender male + diff --git a/phsource/compile_report b/phsource/compile_report index 973eb0dd..c1da070d 100644 --- a/phsource/compile_report +++ b/phsource/compile_report @@ -1,51 +1,52 @@ -46 phoneme tables +47 phoneme tables new total - base 98 98 - base2 24 117 - en 54 147 - en_n 30 147 - en_us 34 147 - en_sc 39 149 - en_rp 34 147 - en_wm 30 147 - en_wi 30 147 - af 38 130 - cy 29 124 - de 33 125 - eo 13 110 - jbo 4 111 - fi 40 129 - fr 42 122 - fr_ca 11 122 - hi 50 134 - ta 15 136 - hu 23 114 - nl 28 121 - pl 15 109 - sk 29 127 - cs 6 127 - hr 20 132 - mk 3 133 - sr 14 132 - ru 38 128 - it 17 120 - la 21 116 - es 7 117 - pt 27 133 - pt_pt 20 133 - ro 36 141 - el 8 117 - grc 12 122 - sv 25 120 - no 28 124 - is 32 123 - vi 42 136 - zhy 40 131 - zh 62 146 - sw 14 107 - th 50 141 - id 14 119 - ja 7 103 + base 99 99 + base2 24 118 + en 54 148 + en_n 30 148 + en_us 34 148 + en_sc 39 150 + en_rp 34 148 + en_wm 30 148 + en_wi 30 148 + af 38 131 + cy 29 125 + de 33 126 + eo 13 111 + jbo 4 112 + fi 40 130 + fr 43 124 + fr_ca 11 124 + hi 50 135 + ta 15 137 + hu 23 115 + nl 28 122 + pl 15 110 + sk 29 128 + cs 6 128 + hr 20 133 + mk 3 134 + sr 14 133 + ru 38 129 + it 17 121 + la 21 117 + es 7 118 + pt 27 134 + pt_pt 20 134 + ro 36 142 + el 8 118 + grc 12 123 + sv 25 121 + no 28 125 + is 32 124 + vi 42 137 + zhy 40 132 + zh 62 147 + sw 14 108 + th 50 142 + id 14 120 + tr 14 123 + ja 7 104 Data file Used by b/b [b] base @@ -402,6 +403,7 @@ n/_n [n] base [n;] ro [n] zh n/n_ [n] base + [n2] fr [n;] ro n/n@ [(@)] base n/n#_ [n#] is @@ -1260,6 +1262,7 @@ vowel/a_5 [a:] ta [a] la [a] sv [a] sw + [a] tr vowel/aa [a] fi [A] fr_ca [A] no @@ -1367,6 +1370,7 @@ vowel/e_mid [E] en_rp [E] is [E] id [E2] id + [E] tr [e] ja vowel/e_mid2 [E] af [E] de @@ -1378,6 +1382,7 @@ vowel/e_mid2 [E] af [e] ro [e] el [e] sw + [e] tr vowel/@_fnt [@] en_wi [@2] en_wi [@2] hr @@ -1432,6 +1437,7 @@ vowel/i_6 [i:] en_us [i] ta [i] hr [i] id + [i] tr vowel/i#_7 [i[] zh vowel/i_en [i:] en [i:] fr @@ -1460,6 +1466,7 @@ vowel/ii_3 [I] cy [I] hr [I] sv [I] no + [I] tr vowel/ii_4 [I] en [I2] en [I] en_n @@ -1519,9 +1526,11 @@ vowel/oe [W] en [W] af [W] de vowel/oe_2 [W] no + [W] tr vowel/oe_4 [W] sv vowel/o_mid [O] fr [o] hu + [o] tr vowel/oo [O:] en_sc [O] en_wi [O:] en_wi @@ -1536,6 +1545,7 @@ vowel/oo [O:] en_sc [O] th [O:] th [O] id + [O] tr [o] ja vowel/oo_1 [O:] en_n [O:] en_rp @@ -1593,10 +1603,12 @@ vowel/u [u:] en_wi [u] id vowel/u# [u-] en [u:] en_sc + [Y] tr vowel/u_2 [u1] fi [u] sk [U] hr [u] ro + [u] tr vowel/u#_2 [u-] ta [u-] sv vowel/u_3 [yU] ro @@ -1608,6 +1620,7 @@ vowel/u_6 [U] pt_pt [u] pt_pt vowel/u#_6 [u:] en_us vowel/u_7 [u] vi +vowel/u#_7 [u#] tr vowel/u_bck [u] base2 [U] cy [u] fi @@ -1634,6 +1647,7 @@ vowel/uu [U] en vowel/uu_2 [U] base2 [U] de [U] ta + [U] tr vowel/uu_3 [u] af vowel/uu_4 [U] fi [U] sv @@ -1685,6 +1699,7 @@ vowel/y_3 [y] af vowel/y#_3 [W] is vowel/y_4 [y:] no vowel/y_5 [y:] sv + [y] tr vowel/yy [y"] fr_ca [y] no vowel/yy_3 [y] sv diff --git a/phsource/ph_english_us b/phsource/ph_english_us index 5af25f63..1d4d8457 100644 --- a/phsource/ph_english_us +++ b/phsource/ph_english_us @@ -276,6 +276,6 @@ phoneme t# // reduced [t] as in "city" vowelout f1=2 f2=1700 -300 300 f3=-100 80 formants d/tap2+x/d%70 after @ d/x_tap - lengthmod 2 + lengthmod 5 endphoneme diff --git a/phsource/ph_french b/phsource/ph_french index 52d8a568..20f34527 100644 --- a/phsource/ph_french +++ b/phsource/ph_french @@ -266,6 +266,17 @@ phoneme l endphoneme +phoneme n2 + beforenotvowel NULL + vcd alv nasal + vowelout f1=2 f2=1700 -300 250 f3=-100 80 rms=20 brk + length 100 + lengthmod 4 + formants n/n_ + before _ n/n_ +endphoneme + + phoneme p vls blb stop vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11 diff --git a/phsource/ph_norwegian b/phsource/ph_norwegian index d4389a3b..d18efdea 100644 --- a/phsource/ph_norwegian +++ b/phsource/ph_norwegian @@ -177,7 +177,6 @@ endphoneme phoneme Yy vowel starttype (@) endtype (u) length 270 - long formants vwl_no/y#y endphoneme diff --git a/phsource/ph_turkish b/phsource/ph_turkish new file mode 100644 index 00000000..ea3e0e07 --- /dev/null +++ b/phsource/ph_turkish @@ -0,0 +1,93 @@ + + +phoneme i + vowel starttype (i) endtype (i) + beforenotvowel2 I + length 150 + formants vowel/i_6 +endphoneme + +phoneme I + vowel starttype (i) endtype (i) + length 150 + formants vowel/ii_3 +endphoneme + +phoneme y + vowel starttype (u) endtype (u) + beforenotvowel2 Y + length 155 + formants vowel/y_5 +endphoneme + +phoneme Y + vowel starttype (u) endtype (u) + length 155 + formants vowel/u# +endphoneme + + + +phoneme e + vowel starttype (e) endtype (e) + beforenotvowel2 E + length 180 + formants vowel/e_mid2 +endphoneme + +phoneme E + vowel starttype (e) endtype (e) + length 180 + formants vowel/e_mid +endphoneme + +phoneme W + vowel starttype (@) endtype (@) + length 180 + formants vowel/oe_2 +endphoneme + + + +phoneme a + vowel starttype (a) endtype (a) + length 190 + formants vowel/a_5 +endphoneme + + + +phoneme u + vowel starttype (u) endtype (u) + beforenotvowel2 U + length 150 + formants vowel/u_2 +endphoneme + +phoneme U + vowel starttype (u) endtype (u) + length 150 + formants vowel/uu_2 +endphoneme + +phoneme u# + vowel starttype (@) endtype (@) + length 150 + formants vowel/u#_7 +endphoneme + + + +phoneme o + vowel starttype (o) endtype (o) + beforenotvowel2 O + length 190 + formants vowel/o_mid +endphoneme + +phoneme O + vowel starttype (o) endtype (o) + length 190 + formants vowel/oo +endphoneme + diff --git a/phsource/phonemes b/phsource/phonemes index 81e584f1..957f42bd 100644 --- a/phsource/phonemes +++ b/phsource/phonemes @@ -31,6 +31,7 @@ phonemenumber 24 _:: // long pause phonemenumber 25 t# // reduced version of [t] phonemenumber 26 '! // stress - emphasized phonemenumber 27 _;_ // clause pause +phonemenumber 28 _^^ // Change language + phoneme table number // The base phoneme table contains the utility phonemes, the consonants, // and a schwa. The vowels are defined in the language specific phoneme @@ -149,6 +150,13 @@ phoneme _^_ // Change dictionary (followed by language-code in ascii lengthmod 1 endphoneme +phoneme _^^ // Change phoneme table (followed by phoneme table number) + pause + starttype _ endtype _ + length 1 + lengthmod 1 +endphoneme + phoneme _X1 // a language specific action pause starttype _ endtype _ @@ -1268,5 +1276,8 @@ include ph_thai phonemetable id base2 include ph_indonesian +phonemetable tr base2 +include ph_turkish + phonemetable ja base include ph_japanese diff --git a/phsource/vowel/oe_2 b/phsource/vowel/oe_2 index c35aef7f..d3d1c484 100644 Binary files a/phsource/vowel/oe_2 and b/phsource/vowel/oe_2 differ diff --git a/phsource/vowel/u# b/phsource/vowel/u# index 23df5813..2eafac85 100644 Binary files a/phsource/vowel/u# and b/phsource/vowel/u# differ diff --git a/phsource/vowel/u#_7 b/phsource/vowel/u#_7 new file mode 100644 index 00000000..060d09e1 Binary files /dev/null and b/phsource/vowel/u#_7 differ diff --git a/phsource/vowel/uu_2 b/phsource/vowel/uu_2 index 4cdfe995..8a5d5968 100644 Binary files a/phsource/vowel/uu_2 and b/phsource/vowel/uu_2 differ diff --git a/phsource/vowel/vowelchart.png b/phsource/vowel/vowelchart.png index 4255a138..3a86078d 100644 Binary files a/phsource/vowel/vowelchart.png and b/phsource/vowel/vowelchart.png differ diff --git a/phsource/vwl_en_us/3_us b/phsource/vwl_en_us/3_us index 0e5ca6c6..85a4781a 100644 Binary files a/phsource/vwl_en_us/3_us and b/phsource/vwl_en_us/3_us differ diff --git a/src/compiledata.cpp b/src/compiledata.cpp index fcc6dfe6..0b88b6bb 100755 --- a/src/compiledata.cpp +++ b/src/compiledata.cpp @@ -58,21 +58,26 @@ #define tOLDNAME 14 #define tREDUCETO 15 #define tFIXEDCODE 16 + #define tBEFOREVOWEL 17 #define tBEFOREVOWELPAUSE 18 #define tBEFORENOTVOWEL 19 -#define tLINKOUT 20 +#define tBEFORENOTVOWEL2 20 #define tSWITCHVOICING 21 -#define tVOWELIN 22 -#define tVOWELOUT 23 -#define tAPPENDPH 24 // always insert another phoneme (linkout) after this one -#define tIMPORTPH 25 -#define tBEFOREPAUSE 26 + +#define tLINKOUT 23 +#define tVOWELIN 24 +#define tVOWELOUT 25 +#define tAPPENDPH 26 // always insert another phoneme (linkout) after this one +#define tIMPORTPH 27 +#define tBEFOREPAUSE 28 #define tPHONEMENUMBER 29 #define tPHONEMETABLE 30 #define tINCLUDE 31 +static const int flags_alternative[] = {phBEFOREVOWEL,phBEFOREVOWELPAUSE,phBEFORENOTVOWEL,phBEFORENOTVOWEL2,phSWITCHVOICING}; + extern void Write4Bytes(FILE *f, int value); extern int Read4Bytes(FILE *f); extern void MakeVowelLists(void); @@ -230,16 +235,17 @@ static keywtab_t keywords[] = { {"length", 12}, {"longlength", 13}, {"reduceto", 15}, - {"beforevowel", 17}, - {"beforevowelpause", 18}, - {"beforenotvowel",19}, - {"linkout",20}, - {"switchvoicing",21}, - {"vowelin",22}, - {"vowelout",23}, - {"appendph",24}, - {"import_phoneme",25}, - {"beforepause",26}, + {"beforevowel", tBEFOREVOWEL}, + {"beforevowelpause", tBEFOREVOWELPAUSE}, + {"beforenotvowel",tBEFORENOTVOWEL}, + {"beforenotvowel2",tBEFORENOTVOWEL2}, + {"linkout",tLINKOUT}, + {"switchvoicing",tSWITCHVOICING}, + {"vowelin",tVOWELIN}, + {"vowelout",tVOWELOUT}, + {"appendph",tAPPENDPH}, + {"import_phoneme",tIMPORTPH}, + {"beforepause",tBEFOREPAUSE}, // flags {"wavef", 0x2000000+phWAVE}, @@ -1374,18 +1380,12 @@ int Compile::CPhoneme() ph->phflags = (ph->phflags & 0xfffffff) + (value << 28); break; - case tBEFORENOTVOWEL: - ph->phflags |= phBEFORENOTVOWEL; // and drop through to tBEFOREVOWEL - case tBEFOREVOWELPAUSE: - ph->phflags |= phBEFOREVOWELPAUSE; case tBEFOREVOWEL: - if((phcode = NextItem(tPHONEMEMNEM)) == -1) - phcode = LookupPhoneme(item_string,1); - ph->alternative_ph = phcode; - break; - + case tBEFOREVOWELPAUSE: + case tBEFORENOTVOWEL: + case tBEFORENOTVOWEL2: case tSWITCHVOICING: - ph->phflags |= phSWITCHVOICING; + ph->phflags |= flags_alternative[item - tBEFOREVOWEL]; if((phcode = NextItem(tPHONEMEMNEM)) == -1) phcode = LookupPhoneme(item_string,1); ph->alternative_ph = phcode; diff --git a/src/dictionary.cpp b/src/dictionary.cpp index c411a210..82f26d9a 100755 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -1197,6 +1197,23 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int } break; + case 7: // LANG=tr, the last syllable for any vowel markes explicitly as unstressed + if(stressed_syllable == 0) + { + stressed_syllable = vowel_count - 1; + for(ix=2; ix < vowel_count; ix++) + { + if(vowel_stress[ix] == 1) + { + stressed_syllable = ix-1; + break; + } + } + vowel_stress[stressed_syllable] = 4; + max_stress = 4; + } + break; + case 9: // mark all as stressed for(ix=1; ix. This is the second sentence"; +const char* text1 = "Hello world. Testing."; void TestTest(int control) {//======================= @@ -1200,10 +1200,10 @@ if(control==2) f_wavtest = OpenWaveFile3("/home/jsd1/speechdata/text/test.wav"); f_events = fopen("/home/jsd1/speechdata/text/events","w"); - fprintf(f_events,"Type Audio Text Length Id\n"); + fprintf(f_events,"Type Audio Text Length Id\n"); fclose(f_events); - espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,1000,NULL,0); + espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL,1000,NULL,1); espeak_SetSynthCallback(TestSynthCallback); espeak_SetUriCallback(TestUriCallback); diff --git a/src/numbers.cpp b/src/numbers.cpp index 943fe664..f4114d44 100644 --- a/src/numbers.cpp +++ b/src/numbers.cpp @@ -31,6 +31,7 @@ #include "speech.h" #include "phoneme.h" #include "synthesize.h" +#include "voice.h" #include "translate.h" @@ -44,6 +45,15 @@ void Translator::LookupLetter(int letter, int next_byte, char *ph_buf1) char ph_stress[2]; char ph_buf3[30]; + if((letter <= 32) || iswspace(letter)) + { + // lookup space as _&32 etc. + sprintf(&single_letter[1],"_#%d ",letter); + Lookup(&single_letter[1],ph_buf1); + return; + } + + len = utf8_out(letter,&single_letter[2]); single_letter[len+2] = ' '; @@ -89,11 +99,13 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control) int n_bytes; int letter; int len; + int phoneme_tab_en; char *p2; char *pbuf; char capital[20]; - char ph_buf[50]; - char ph_buf2[50]; + char ph_buf[60]; + char ph_buf2[60]; + char ph_buf_en[60]; char hexbuf[6]; static char single_letter[10] = {0,0}; @@ -117,15 +129,6 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control) } letter = towlower(letter); - if((letter <= 32) || iswspace(letter)) - { - // lookup space as _&32 etc. - sprintf(&single_letter[1],"_#%d ",letter); - Lookup(&single_letter[1],ph_buf); - strcat(phonemes,ph_buf); - return(n_bytes); - } - LookupLetter(letter, word[n_bytes], ph_buf); if(ph_buf[0] == phonSWITCH) @@ -133,6 +136,18 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control) strcpy(phonemes,ph_buf); return(0); } + + if(ph_buf[0] == 0) + { + phoneme_tab_en = SetTranslator2("en"); + translator2->LookupLetter(letter, word[n_bytes], ph_buf_en); + if(ph_buf_en[0] != 0) + { + sprintf(ph_buf,"%c%c%s%c%c",phonSWITCH2, phoneme_tab_en + phonTOP, ph_buf_en, phonSWITCH2, voice->phoneme_tab_ix + phonTOP); + } + SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table + } + if(ph_buf[0] == 0) { // character name not found @@ -166,8 +181,8 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control) -void Translator::SetSpellingStress(char *phonemes, int control) -{//============================================================ +void Translator::SetSpellingStress(char *phonemes, int control, int n_chars) +{//========================================================================= // Individual letter names, reduce the stress of some. int ix; unsigned int c; @@ -188,7 +203,7 @@ void Translator::SetSpellingStress(char *phonemes, int control) count = 0; for(ix=0; (c = buf[ix]) != 0; ix++) { - if(c == phonSTRESS_P) + if((c == phonSTRESS_P) && (n_chars > 1)) { count++; diff --git a/src/phoneme.h b/src/phoneme.h index fb2acc23..c2662cce 100755 --- a/src/phoneme.h +++ b/src/phoneme.h @@ -45,18 +45,19 @@ #define phTRILL 0x80 #define phVOWEL2 0x100 // liquid that is considered a vowel #define phPALATAL 0x200 -#define phLONG 0x1000 #define phAPPENDPH 0x2000 // always insert another phoneme (link_out) after this one #define phBRKAFTER 0x4000 // [*] add a post-pause #define phBEFOREPAUSE 0x8000 // replace with the link_out phoneme if the next phoneme is a pause -#define phALTERNATIVE 0x0c00 // bits 10,11 specifying use of alternative_ph +#define phALTERNATIVE 0x1c00 // bits 10,11,12 specifying use of alternative_ph #define phBEFOREVOWEL 0x0000 #define phBEFOREVOWELPAUSE 0x0400 #define phBEFORENOTVOWEL 0x0c00 +#define phBEFORENOTVOWEL2 0x1000 #define phSWITCHVOICING 0x0800 #define phNONSYLLABIC 0x100000 // don't count this vowel as a syllable when finding the stress position +#define phLONG 0x200000 // fixed phoneme code numbers, these can be used from the program code #define phonCONTROL 1 @@ -86,6 +87,8 @@ #define phonT_REDUCED 25 #define phonSTRESS_TONIC 26 #define phonPAUSE_CLAUSE 27 +#define phonSWITCH2 28 +#define phonTOP 28 // highest pre-defined phoneme number extern const unsigned char pause_phonemes[8]; // 0, vshort, short, pause, long, glottalstop diff --git a/src/phonemelist.cpp b/src/phonemelist.cpp index 7fd57122..4a186f3d 100755 --- a/src/phonemelist.cpp +++ b/src/phonemelist.cpp @@ -395,6 +395,14 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence) alternative = ph->alternative_ph; break; + case phBEFORENOTVOWEL2: // LANG=tr + if(((plist2+1)->sourceix != 0) || + ((next->type != phVOWEL) && ((phoneme_tab[(plist2+2)->phcode]->type != phVOWEL) || ((plist2+2)->sourceix != 0)))) + { + alternative = ph->alternative_ph; + } + break; + case phBEFOREVOWELPAUSE: if((next->type == phVOWEL) || (next->type == phPAUSE)) alternative = ph->alternative_ph; diff --git a/src/speech.h b/src/speech.h index 6223c700..44dad5fe 100755 --- a/src/speech.h +++ b/src/speech.h @@ -41,6 +41,7 @@ #endif #ifdef _ESPEAKEDIT +#define USE_PORTAUDIO #define USE_ASYNC #define LOG_FRAMES // write keyframe info to log-espeakedit #endif diff --git a/src/synthdata.cpp b/src/synthdata.cpp index 08722858..dcb25dc2 100755 --- a/src/synthdata.cpp +++ b/src/synthdata.cpp @@ -35,8 +35,8 @@ #include "translate.h" #include "wave.h" -const char *version_string = "1.31.04 30.Jan.08"; -const int version_phdata = 0x013100; +const char *version_string = "1.31.05 04.Feb.08"; +const int version_phdata = 0x013105; int option_device_number = -1; diff --git a/src/tr_languages.cpp b/src/tr_languages.cpp index ad901d29..d7d88a19 100644 --- a/src/tr_languages.cpp +++ b/src/tr_languages.cpp @@ -669,15 +669,15 @@ SetLengthMods(tr,3); // all equal case L('t','r'): // Turkish { static const unsigned char stress_amps_tr[8] = {16,16, 20,20, 20,24, 24,22 }; - static const short stress_lengths_tr[8] = {180,150, 200,180, 0,0, 230,270}; + static const short stress_lengths_tr[8] = {170,170, 190,170, 0,0, 250,270}; tr = new Translator(); SetupTranslator(tr,stress_lengths_tr,stress_amps_tr); tr->charset_a0 = charsets[9]; // ISO-8859-9 - Latin5 - tr->langopts.stress_rule = 3; // stress on the last syllable + tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable - tr->langopts.numbers = 0x1009; + tr->langopts.numbers = 0x1d09; tr->langopts.max_initial_consonants = 2; } break; diff --git a/src/translate.cpp b/src/translate.cpp index a78c7faf..578c6719 100755 --- a/src/translate.cpp +++ b/src/translate.cpp @@ -38,7 +38,7 @@ Translator *translator = NULL; // the main translator -static Translator *translator2 = NULL; // secondary translator for certain words +Translator *translator2 = NULL; // secondary translator for certain words static char translator2_language[20] = {0}; FILE *f_trans = NULL; // phoneme output text @@ -750,6 +750,7 @@ if((wmark > 0) && (wmark < 8)) while(*wordx != ' ') { wordx += TranslateLetter(wordx, phonemes,spell_word); + posn++; if(phonemes[0] == phonSWITCH) { // change to another language in order to translate this word @@ -757,7 +758,7 @@ if((wmark > 0) && (wmark < 8)) return(0); } } - SetSpellingStress(phonemes,spell_word); + SetSpellingStress(phonemes,spell_word,posn); } else if(found == 0) @@ -776,6 +777,7 @@ if((wmark > 0) && (wmark < 8)) // find a remainder that we can pronounce. emphasize_allcaps = 0; wordx += TranslateLetter(wordx,phonemes,0); + posn++; if(phonemes[0] == phonSWITCH) { // change to another language in order to translate this word @@ -798,7 +800,7 @@ if((wmark > 0) && (wmark < 8)) if(length > 0) wordx[-1] = ' '; // prevent this affecting the pronunciation of the pronuncable part } - SetSpellingStress(phonemes,0); + SetSpellingStress(phonemes,0,posn); // anything left ? if(*wordx != ' ') @@ -1164,6 +1166,39 @@ static int CountSyllables(unsigned char *phonemes) return(count); } + +int SetTranslator2(const char *new_language) +{//========================================= +// Set translator2 to a second language + int new_phoneme_tab; + + if((new_phoneme_tab = SelectPhonemeTableName(new_language)) >= 0) + { + if((translator2 != NULL) && (strcmp(new_language,translator2_language) != 0)) + { + // we already have an alternative translator, but not for the required language, delete it + delete translator2; + translator2 = NULL; + } + + if(translator2 == NULL) + { + translator2 = SelectTranslator(new_language); + strcpy(translator2_language,new_language); + + if(translator2->LoadDictionary(new_language,0) != 0) + { + SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table + new_phoneme_tab = -1; + translator2_language[0] = 0; + } + } + } + return(new_phoneme_tab); +} // end of SetTranslator2 + + + int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int next_pause) {//====================================================================================== int flags=0; @@ -1199,27 +1234,31 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne if(word_flags & FLAG_EMBEDDED) { embedded_flag = SFLAG_EMBEDDED; - value = embedded_list[embedded_read] >> 8; - switch(embedded_cmd = embedded_list[embedded_read] & 0x1f) + do { - case EMBED_Y: - option_sayas = value; - break; + embedded_cmd = embedded_list[embedded_read++]; + value = embedded_cmd >> 8; - case EMBED_F: - option_emphasis = value; - break; - - case EMBED_B: - // break command - if(value == 0) - pre_pause = 0; // break=none - else - pre_pause += value; - break; - } - while((embedded_list[embedded_read++] & 0x80) == 0); // read over the embedded commands for this word + switch(embedded_cmd & 0x1f) + { + case EMBED_Y: + option_sayas = value; + break; + + case EMBED_F: + option_emphasis = value; + break; + + case EMBED_B: + // break command + if(value == 0) + pre_pause = 0; // break=none + else + pre_pause += value; + break; + } + } while((embedded_cmd & 0x80) == 0); } if(word[0] == 0) @@ -1328,28 +1367,9 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne new_language = (char *)(&p[1]); if(new_language[0]==0) new_language = "en"; - if((switch_phonemes = SelectPhonemeTableName(new_language)) >= 0) - { - if((translator2 != NULL) && (strcmp(new_language,translator2_language) != 0)) - { - // we already have an alternative translator, but not for the required language, delete it - delete translator2; - translator2 = NULL; - } - if(translator2 == NULL) - { - translator2 = SelectTranslator(new_language); - strcpy(translator2_language,new_language); + switch_phonemes = SetTranslator2(new_language); - if(translator2->LoadDictionary(new_language,0) != 0) - { - SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table - switch_phonemes = -1; - translator2_language[0] = 0; - } - } - } if(switch_phonemes >= 0) { // re-translate the word using the new translator @@ -1488,6 +1508,12 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne srcix = source_ix+1; } else + if(ph_code == phonSWITCH2) + { + SetPlist2(&ph_list2[n_ph_list2],phonSWITCH); + ph_list2[n_ph_list2++].tone_number = *p++ - phonTOP; // phoneme table number (phonTOP is added to avoid confusion with special phoneme numbers) + } + else if(ph_code == phonX1) { // a language specific action diff --git a/src/translate.h b/src/translate.h index 46ca94a0..2389bc2f 100755 --- a/src/translate.h +++ b/src/translate.h @@ -416,7 +416,7 @@ public: private: int TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int next_pause); int TranslateLetter(char *letter, char *phonemes, int control); - void SetSpellingStress(char *phonemes, int control); + void SetSpellingStress(char *phonemes, int control, int n_chars); void WriteMnemonic(int *ix, int mnem); void MakePhonemeList(int post_pause, int new_sentence); int SubstitutePhonemes(PHONEME_LIST2 *plist_out); @@ -541,6 +541,7 @@ extern unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS]; extern int speech_parameters[]; extern Translator *translator; +extern Translator *translator2; extern const unsigned short *charsets[N_CHARSETS]; extern char dictionary_name[40]; extern char ctrl_embedded; // to allow an alternative CTRL for embedded commands @@ -554,6 +555,7 @@ extern int (* phoneme_callback)(const char *); extern void SetLengthMods(Translator *tr, int value); Translator *SelectTranslator(const char *name); +int SetTranslator2(const char *name); int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *err_name,int flags); void LoadConfig(void); int PhonemeCode(unsigned int mnem);