git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@159 d46cf337-b52f-0410-862d-fd96e6ae7743master
| // This file is UTF8 encoded | |||||
| // Spelling-to-phoneme words for Kurdish | |||||
| _0 s'Ifr | |||||
| _1 j'Ek | |||||
| _2 d'U | |||||
| _3 s'e | |||||
| _4 dZ'ar | |||||
| _5 p'endZ | |||||
| _6 S'ES | |||||
| _7 h'Eft | |||||
| _8 h'EjSt | |||||
| _9 n'Eh | |||||
| _10 d'Eh | |||||
| _11 jazd'E# | |||||
| _12 danzd'E# | |||||
| _13 sezd'E# | |||||
| _14 tSaRd'E# | |||||
| _15 panzd'E# | |||||
| _16 Sanzd'E# | |||||
| _17 hIvd'Eh | |||||
| _18 hIZd'Eh | |||||
| _19 nozd'Eh | |||||
| _2X b'Ist | |||||
| _3X s'i | |||||
| _4X tS'Il | |||||
| _5X pendZ'i | |||||
| _6X S'est | |||||
| _7X hEft'e | |||||
| _8X heSt'e | |||||
| _9X n'od | |||||
| _0C s'Ed | |||||
| _1C s'Ed | |||||
| _0M1 hEz'ar | |||||
| _1M1 hEz'ar | |||||
| _0M2 mIl'jon | |||||
| _1M2 mIl'jon | |||||
| _0and _u | |||||
| _dpt _xal | |||||
| _?? tipa | |||||
| _cap mezin // or "ya mezin" after the letter | |||||
| // characters | |||||
| // letter names | |||||
| _a a | |||||
| b be | |||||
| c dZe | |||||
| ç tSe | |||||
| d de | |||||
| _e E | |||||
| _ê e | |||||
| f fe | |||||
| g ge | |||||
| h he | |||||
| _i I | |||||
| _î i | |||||
| j Ze | |||||
| k ke | |||||
| l le | |||||
| m me | |||||
| n ne | |||||
| _o o | |||||
| p pe | |||||
| q qe | |||||
| r Re | |||||
| s se | |||||
| ş Se | |||||
| t te | |||||
| _u U | |||||
| _û u | |||||
| v ve | |||||
| w we | |||||
| x xe | |||||
| y je | |||||
| z ze | |||||
| _, behnok | |||||
| _. xal | |||||
| _: dZotxal | |||||
| _; xalbehnok | |||||
| _- bEndIk | |||||
| _? pIRsniS'an | |||||
| _! banES'an | |||||
| % sEde | |||||
| * steRk | |||||
| // function words | |||||
| û $u+ $pause | |||||
| a $u+ | |||||
| ê $u+ | |||||
| // pronouns | |||||
| ez $u+ | |||||
| te $u+ | |||||
| wê $u+ | |||||
| wî $u+ | |||||
| me $u+ | |||||
| we $u+ | |||||
| wan $u+ | |||||
| bes $pause | |||||
| an $u $pause | |||||
| anji $u $pause | |||||
| ên $u | |||||
| ya $u | |||||
| yê $u | |||||
| yan $u | |||||
| yên $u | |||||
| ji $u | |||||
| bi $u | |||||
| re $u | |||||
| di $u | |||||
| de $u | |||||
| kir $u | |||||
| got $u | |||||
| // abbreviations | |||||
| hwd hEr||wEki||dIn | |||||
| // pronunciation exceptions |
| // Kurdish translation rules | |||||
| // This file is UTF-8 encoded | |||||
| .L01 î iy ê ew ey // front vowels | |||||
| .group a | |||||
| a a | |||||
| @) a (_S1 %a | |||||
| @) an (_S2 %an | |||||
| .group b | |||||
| b b | |||||
| .group c | |||||
| c dZ | |||||
| .group ç | |||||
| ç tS | |||||
| .group d | |||||
| d d | |||||
| .group e | |||||
| e E | |||||
| e (_ E# | |||||
| ew eU | |||||
| ey eI | |||||
| .group ê | |||||
| ê e | |||||
| @) ê (_S1 %e | |||||
| @) ên (_S2 %en | |||||
| .group f | |||||
| f f | |||||
| .group g | |||||
| g g | |||||
| g (L01 J | |||||
| .group h | |||||
| h h | |||||
| .group i | |||||
| i I | |||||
| .group î | |||||
| î i | |||||
| .group j | |||||
| j Z | |||||
| .group k | |||||
| k k | |||||
| k (L01 c | |||||
| .group l | |||||
| l l | |||||
| .group m | |||||
| m m | |||||
| .group n | |||||
| n n | |||||
| .group o | |||||
| o o | |||||
| .group p | |||||
| p p | |||||
| .group q | |||||
| q q | |||||
| .group r | |||||
| r R | |||||
| .group s | |||||
| s s | |||||
| .group ş | |||||
| ş S | |||||
| .group t | |||||
| t t | |||||
| .group u | |||||
| u U | |||||
| .group û | |||||
| û u | |||||
| .group v | |||||
| v v | |||||
| .group w | |||||
| w w | |||||
| .group x | |||||
| x x | |||||
| .group y | |||||
| y j | |||||
| .group z | |||||
| z z | |||||
| .group | |||||
| ö I: | |||||
| ü y | |||||
| $ dUlar |
| 49 phoneme tables | |||||
| 47 phoneme tables | |||||
| new total | new total | ||||
| base 98 98 | base 98 98 | ||||
| base2 24 117 | base2 24 117 | ||||
| grc 12 122 | grc 12 122 | ||||
| sv 25 120 | sv 25 120 | ||||
| no 28 124 | no 28 124 | ||||
| is 32 123 | |||||
| is 33 124 | |||||
| vi 42 136 | vi 42 136 | ||||
| zhy 40 131 | zhy 40 131 | ||||
| zh 65 148 | zh 65 148 | ||||
| tr 18 122 | tr 18 122 | ||||
| ku 17 121 | ku 17 121 | ||||
| id 14 119 | id 14 119 | ||||
| ja 7 103 | |||||
| rw 12 122 | |||||
| Data file Used by | Data file Used by | ||||
| b/b [b] base | b/b [b] base | ||||
| [s] es | [s] es | ||||
| [s#] pt | [s#] pt | ||||
| [z;] ro | [z;] ro | ||||
| [s2] is | |||||
| ufric/s! [s] base | ufric/s! [s] base | ||||
| [s2] fi | [s2] fi | ||||
| [s] fr | [s] fr | ||||
| [s2] hu | [s2] hu | ||||
| [s] es | [s] es | ||||
| [s#] pt | [s#] pt | ||||
| [s2] is | |||||
| ufric/s_continue [s2] fi | ufric/s_continue [s2] fi | ||||
| [s2] hu | [s2] hu | ||||
| [s2] is | |||||
| ufric/sh [S] base | ufric/sh [S] base | ||||
| [S] fr | [S] fr | ||||
| [s#] pt_pt | [s#] pt_pt | ||||
| [p2] fr | [p2] fr | ||||
| [ph] hi | [ph] hi | ||||
| [ph] zh | [ph] zh | ||||
| ustop/percus10 [(X1] base | |||||
| ustop/percus10 [(X1)] base | |||||
| ustop/pl [p] base | ustop/pl [p] base | ||||
| [p] base2 | [p] base2 | ||||
| [p] fi | [p] fi | ||||
| ustop/t_short [t.] hi | ustop/t_short [t.] hi | ||||
| [t] sk | [t] sk | ||||
| [t] el | [t] el | ||||
| ustop/tsh_pzd [tS;] zh | |||||
| ustop/tsh_pzd [tS;h] zh | |||||
| ustop/tsh_pzd_unasp [tS;] zh | ustop/tsh_pzd_unasp [tS;] zh | ||||
| ustop/tsh_sr [tS] sr | ustop/tsh_sr [tS] sr | ||||
| ustop/ts_pzd [tS;] base | ustop/ts_pzd [tS;] base | ||||
| [c] hu | [c] hu | ||||
| ustop/t_sr [d] sr | ustop/t_sr [d] sr | ||||
| [t] sr | [t] sr | ||||
| ustop/ts_rfx [ts.] zh | |||||
| ustop/ts_rfx [ts.h] zh | |||||
| ustop/ts_rfx_unasp [ts.] zh | ustop/ts_rfx_unasp [ts.] zh | ||||
| ustop/ts_sr [tS;] sr | ustop/ts_sr [tS;] sr | ||||
| [dZ;] sr | [dZ;] sr | ||||
| vnasal/a#u_n [&U~] pt | vnasal/a#u_n [&U~] pt | ||||
| [&U~] pt_pt | [&U~] pt_pt | ||||
| vnasal/ee_n [E~] en | vnasal/ee_n [E~] en | ||||
| [a] en_us | |||||
| [E~] fr_ca | [E~] fr_ca | ||||
| vnasal/ee_n2 [E~] hi | |||||
| vnasal/ee_n2 [a] en_us | |||||
| [E~] hi | |||||
| [E~] pl | [E~] pl | ||||
| [&~] pt_pt | [&~] pt_pt | ||||
| vnasal/e_n [e~] af | vnasal/e_n [e~] af | ||||
| [a] it | [a] it | ||||
| [a] zh | [a] zh | ||||
| [a] id | [a] id | ||||
| [a] ja | |||||
| vowel/a# [a/] base2 | vowel/a# [a/] base2 | ||||
| [a2] en_sc | [a2] en_sc | ||||
| [a2] en_wi | [a2] en_wi | ||||
| [&] sr | [&] sr | ||||
| [&] pt | [&] pt | ||||
| [&/] pt | [&/] pt | ||||
| [a#] rw | |||||
| [a/] rw | |||||
| vowel/a_2 [a] base2 | vowel/a_2 [a] base2 | ||||
| [a] en_wi | [a] en_wi | ||||
| [A:] en_wi | [A:] en_wi | ||||
| [a] pt_pt | [a] pt_pt | ||||
| [a] ro | [a] ro | ||||
| [a:] vi | [a:] vi | ||||
| [a] rw | |||||
| vowel/a#_2 [&] hr | vowel/a#_2 [&] hr | ||||
| [a2] sv | [a2] sv | ||||
| [&] is | [&] is | ||||
| [e] grc | [e] grc | ||||
| [e] vi | [e] vi | ||||
| [e] id | [e] id | ||||
| [e] rw | |||||
| [e#] rw | |||||
| vowel/e# [I] en_sc | vowel/e# [I] en_sc | ||||
| [I2] en_sc | [I2] en_sc | ||||
| vowel/e_2 [eI] en_sc | vowel/e_2 [eI] en_sc | ||||
| [E] tr | [E] tr | ||||
| [E] id | [E] id | ||||
| [E2] id | [E2] id | ||||
| [e] ja | |||||
| vowel/e_mid2 [E] af | vowel/e_mid2 [E] af | ||||
| [E] de | [E] de | ||||
| [E2] de | [E2] de | ||||
| [i] zhy | [i] zhy | ||||
| [i] zh | [i] zh | ||||
| [i] sw | [i] sw | ||||
| [i] ja | |||||
| [i] rw | |||||
| [i#] rw | |||||
| vowel/i# [i] en_rp | vowel/i# [i] en_rp | ||||
| [y:] cy | [y:] cy | ||||
| vowel/i_2 [i:] en_rp | vowel/i_2 [i:] en_rp | ||||
| [o] grc | [o] grc | ||||
| [o:] sv | [o:] sv | ||||
| [o] id | [o] id | ||||
| [o] rw | |||||
| [o#] rw | |||||
| vowel/o_2 [o:] cy | vowel/o_2 [o:] cy | ||||
| [o:] hi | [o:] hi | ||||
| [o:] hu | [o:] hu | ||||
| [o] zhy | [o] zhy | ||||
| [O] tr | [O] tr | ||||
| [O] id | [O] id | ||||
| [o] ja | |||||
| vowel/oo_1 [O:] en_n | vowel/oo_1 [O:] en_n | ||||
| [O:] en_rp | [O:] en_rp | ||||
| [O@] en_rp | [O@] en_rp | ||||
| [u] is | [u] is | ||||
| [u] zhy | [u] zhy | ||||
| [u] zh | [u] zh | ||||
| [u] rw | |||||
| [u#] rw | |||||
| vowel/u_bck2 [u:] la | vowel/u_bck2 [u:] la | ||||
| vowel/u_fnt [u:] en_rp | vowel/u_fnt [u:] en_rp | ||||
| vowel/uu [U] en | vowel/uu [U] en | ||||
| [U] pt | [U] pt | ||||
| [U] no | [U] no | ||||
| [u] zhy | [u] zhy | ||||
| vowel/u_unr [u] ja | |||||
| vowel/V [3] en_sc | vowel/V [3] en_sc | ||||
| vowel/V_2 [V] en | vowel/V_2 [V] en | ||||
| [a] af | [a] af | ||||
| vwl_ru/u# [u#] ru | vwl_ru/u# [u#] ru | ||||
| vwl_ru/u#u [u"] ru | vwl_ru/u#u [u"] ru | ||||
| vwl_sv/r_sv3 [r] sv | vwl_sv/r_sv3 [r] sv | ||||
| vwl_zh/aang [aan] zhy | |||||
| vwl_zh/aang [aang] zhy | |||||
| vwl_zh/aau [Au] zh | vwl_zh/aau [Au] zh | ||||
| vwl_zh/a_n [a] zh | vwl_zh/a_n [a] zh | ||||
| vwl_zh/ang [ang] zhy | vwl_zh/ang [ang] zhy | ||||
| vwl_zh/ing [ing] zhy | vwl_zh/ing [ing] zhy | ||||
| vwl_zh/iou [iou] zh | vwl_zh/iou [iou] zh | ||||
| vwl_zh/ng [ng] zhy | vwl_zh/ng [ng] zhy | ||||
| vwl_zh/oeng [oen] zhy | |||||
| vwl_zh/oeng [oeng] zhy | |||||
| vwl_zh/ong [ong] zhy | vwl_zh/ong [ong] zhy | ||||
| vwl_zh/uaa [uA] zh | vwl_zh/uaa [uA] zh | ||||
| vwl_zh/uai [uai] zh | vwl_zh/uai [uai] zh |
| vowel starttype (a) endtype (@) | vowel starttype (a) endtype (@) | ||||
| length 210 | length 210 | ||||
| formants vwl_en_us/a | formants vwl_en_us/a | ||||
| before n vnasal/ee_n | |||||
| before N vnasal/ee_n | |||||
| before m vnasal/ee_n | |||||
| before n vnasal/ee_n2 | |||||
| before N vnasal/ee_n2 | |||||
| before m vnasal/ee_n2 | |||||
| reduceto a2 0 | reduceto a2 0 | ||||
| endphoneme | endphoneme | ||||
| endphoneme | endphoneme | ||||
| phoneme s2 // 2nd part of geminated s | |||||
| vls alv frc sibilant | |||||
| vowelin f1=0 f2=1700 -300 300 f3=-100 80 | |||||
| vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20 | |||||
| lengthmod 3 | |||||
| wave ufric/s_continue | |||||
| before _ ufric/s_ | |||||
| before p ufric/s! | |||||
| before t ufric/s! | |||||
| before k ufric/s! | |||||
| switchvoicing z | |||||
| endphoneme | |||||
| phoneme u | phoneme u | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 130 | |||||
| length 110 | |||||
| formants vowel/u | formants vowel/u | ||||
| reduceto U 4 | reduceto U 4 | ||||
| endphoneme | endphoneme | ||||
| phoneme U | phoneme U | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 130 | |||||
| length 110 | |||||
| formants vowel/u#_3 | formants vowel/u#_3 | ||||
| endphoneme | endphoneme | ||||
| phoneme u: | phoneme u: | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 270 | |||||
| length 250 | |||||
| formants vowel/u | formants vowel/u | ||||
| endphoneme | endphoneme | ||||
| phonemetable id base2 | phonemetable id base2 | ||||
| include ph_indonesian | include ph_indonesian | ||||
| phonemetable ja base | |||||
| include ph_japanese | |||||
| phonemetable rw base2 | |||||
| include ph_kinyarwanda | |||||
| [Setup] | [Setup] | ||||
| AppName=eSpeak | AppName=eSpeak | ||||
| AppVerName=eSpeak version 1.32 | |||||
| AppVerName=eSpeak version 1.33 | |||||
| AppCopyright=Licensed under GNU General Public License version 3. (See file License.txt for details). | AppCopyright=Licensed under GNU General Public License version 3. (See file License.txt for details). | ||||
| WindowVisible=yes | WindowVisible=yes | ||||
| [Setup] | [Setup] | ||||
| AppName=eSpeakEdit | AppName=eSpeakEdit | ||||
| AppVerName=eSpeakEdit version 1.32 | |||||
| AppVerName=eSpeakEdit version 1.33 | |||||
| DefaultDirName={pf}\eSpeak | DefaultDirName={pf}\eSpeak | ||||
| DefaultGroupName=eSpeak | DefaultGroupName=eSpeak | ||||
| OutputBaseFilename=setup_espeakedit | OutputBaseFilename=setup_espeakedit |
| # removed -fno-exceptions because it caused problems with stdio library on some platforms | |||||
| # remove -fno-exceptions because it caused problems with stdio library on some platforms (ARM) | |||||
| PREFIX=/ | PREFIX=/ | ||||
| BINDIR=$(PREFIX)/usr/bin | BINDIR=$(PREFIX)/usr/bin | ||||
| LIBDIR=$(PREFIX)/usr/lib | LIBDIR=$(PREFIX)/usr/lib | ||||
| DATADIR=$(PREFIX)/usr/share/espeak-data | DATADIR=$(PREFIX)/usr/share/espeak-data | ||||
| RELEASE = 1.31 | |||||
| RELEASE = 1.33 | |||||
| BIN_NAME = speak | BIN_NAME = speak | ||||
| BIN2_NAME = espeak | BIN2_NAME = espeak | ||||
| LIB_NAME = libespeak.so | LIB_NAME = libespeak.so | ||||
| mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG) | mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG) | ||||
| .cpp.o: | .cpp.o: | ||||
| $(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c $< | |||||
| $(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $< | |||||
| $(BIN_NAME): $(OBJS1) | $(BIN_NAME): $(OBJS1) | ||||
| $(CXX) -o $@ $(OBJS1) $(LIBS1) | $(CXX) -o $@ $(OBJS1) $(LIBS1) | ||||
| x_%.o: %.cpp | x_%.o: %.cpp | ||||
| $(CXX) $(CXXFLAGS) -Wall -fpic -pedantic \ | $(CXX) $(CXXFLAGS) -Wall -fpic -pedantic \ | ||||
| -I. -D LIBRARY -c $< -o x_$*.o | |||||
| -I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o | |||||
| $(LIB_NAME): $(OBJS2) | $(LIB_NAME): $(OBJS2) | ||||
| $(CXX) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ $(OBJS2) $(LIBS2) | $(CXX) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ $(OBJS2) $(LIBS2) |
| #include "voice.h" | #include "voice.h" | ||||
| #include "spect.h" | #include "spect.h" | ||||
| #ifdef PLATFORM_POSIX | |||||
| #include <unistd.h> | |||||
| #endif | |||||
| #define tNUMBER 1 | #define tNUMBER 1 | ||||
| #define tSTRING 2 | #define tSTRING 2 | ||||
| int resample_wav = 0; | int resample_wav = 0; | ||||
| char fname_temp[100]; | char fname_temp[100]; | ||||
| int scale_factor=0; | int scale_factor=0; | ||||
| int fd_temp; | |||||
| char command[sizeof(path_source)+200]; | char command[sizeof(path_source)+200]; | ||||
| fseek(f,24,SEEK_SET); | fseek(f,24,SEEK_SET); | ||||
| Error("Not mono: ",fname); | Error("Not mono: ",fname); | ||||
| } | } | ||||
| #else | #else | ||||
| sprintf(fname_temp,"%s.wav",tmpnam(NULL)); | |||||
| sprintf(command,"sox \"%s%s.wav\" -r %d -c 1 -w %s polyphase\n",path_source,fname,samplerate,fname_temp); | |||||
| if(system(command) < 0) | |||||
| strcpy(fname_temp,"/tmp/espeakXXXXXX"); | |||||
| if((fd_temp = mkstemp(fname_temp)) >= 0) | |||||
| { | { | ||||
| Error("Failed to resample: ",command); | |||||
| return(0); | |||||
| close(fd_temp); | |||||
| sprintf(command,"sox \"%s%s.wav\" -r %d -c 1 -w %s polyphase\n",path_source,fname,samplerate,fname_temp); | |||||
| if(system(command) < 0) | |||||
| { | |||||
| Error("Failed to resample: ",command); | |||||
| return(0); | |||||
| } | |||||
| } | } | ||||
| f = fopen(fname_temp,"rb"); | f = fopen(fname_temp,"rb"); |
| } | } | ||||
| value = N_HASH_DICT; | value = N_HASH_DICT; | ||||
| fwrite(&value,4,1,f_out); | |||||
| fwrite(&offset_rules,4,1,f_out); | |||||
| Write4Bytes(f_out,value); | |||||
| Write4Bytes(f_out,offset_rules); | |||||
| compile_dictlist_start(); | compile_dictlist_start(); | ||||
| to[size-1] = 0; | to[size-1] = 0; | ||||
| } | } | ||||
| // use the following macros for translation from little endian to host's endianness | |||||
| #ifdef ARCH_BIG | #ifdef ARCH_BIG | ||||
| int reverse_word_bytes(int word) | |||||
| {//============================= | |||||
| // reverse the order of bytes from little-endian to big-endian | |||||
| int ix; | |||||
| int word2 = 0; | |||||
| #define FIX_ENDIAN_USHORT(val) ((unsigned short) ( \ | |||||
| (unsigned short) ((unsigned short) (val) >> 8) | \ | |||||
| (unsigned short) ((unsigned short) (val) << 8))) | |||||
| for(ix=24; ix>=0; ix -= 8) | |||||
| { | |||||
| word2 |= (word >> ix) & 0xff; | |||||
| word2 = word2 << 8; | |||||
| } | |||||
| return(word2); | |||||
| } | |||||
| #define FIX_ENDIAN_UINT(val) ((unsigned int) ( \ | |||||
| (((unsigned int) (val) & (unsigned int) 0x000000ffU) << 24) | \ | |||||
| (((unsigned int) (val) & (unsigned int) 0x0000ff00U) << 8) | \ | |||||
| (((unsigned int) (val) & (unsigned int) 0x00ff0000U) >> 8) | \ | |||||
| (((unsigned int) (val) & (unsigned int) 0xff000000U) >> 24))) | |||||
| #else | |||||
| # define FIX_ENDIAN_USHORT(val) (val) | |||||
| # define FIX_ENDIAN_UINT(val) (val) | |||||
| #endif | #endif | ||||
| size = GetFileLength(fname); | size = GetFileLength(fname); | ||||
| f = fopen(fname,"rb"); | f = fopen(fname,"rb"); | ||||
| if((f == NULL) || (size == 0)) | |||||
| if((f == NULL) || (size <= 0)) | |||||
| { | { | ||||
| if(no_error == 0) | if(no_error == 0) | ||||
| { | { | ||||
| pw = (int *)data_dictlist; | pw = (int *)data_dictlist; | ||||
| length = pw[1]; | |||||
| length = FIX_ENDIAN_UINT(pw[1]); | |||||
| if(size <= (N_HASH_DICT + sizeof(int)*2)) | if(size <= (N_HASH_DICT + sizeof(int)*2)) | ||||
| { | { | ||||
| fprintf(stderr,"Empty _dict file: '%s\n",fname); | fprintf(stderr,"Empty _dict file: '%s\n",fname); | ||||
| return(2); | return(2); | ||||
| } | } | ||||
| if((pw[0] != N_HASH_DICT) || (length <= 0) || (length > 0x8000000)) | |||||
| if((FIX_ENDIAN_UINT(pw[0]) != N_HASH_DICT) || | |||||
| (length <= 0) || (length > 0x8000000)) | |||||
| { | { | ||||
| fprintf(stderr,"Bad data: '%s'\n",fname); | fprintf(stderr,"Bad data: '%s'\n",fname); | ||||
| return(2); | return(2); | ||||
| pw = (unsigned int *)langopts.replace_chars; | pw = (unsigned int *)langopts.replace_chars; | ||||
| while(*pw != 0) | while(*pw != 0) | ||||
| { | { | ||||
| *pw = reverse_word_bytes(*pw); | |||||
| *pw = FIX_ENDIAN_UINT(*pw); | |||||
| pw++; | |||||
| *pw = FIX_ENDIAN_UINT(*pw); | |||||
| pw++; | pw++; | ||||
| } | } | ||||
| #endif | #endif |
| // characters U+00e0 to U+017f | // characters U+00e0 to U+017f | ||||
| const short letter_accents_0e0[] = { | |||||
| const unsigned short letter_accents_0e0[] = { | |||||
| LETTER('a',M_GRAVE,0), // U+00e0 | LETTER('a',M_GRAVE,0), // U+00e0 | ||||
| LETTER('a',M_ACUTE,0), | LETTER('a',M_ACUTE,0), | ||||
| LETTER('a',M_CIRCUMFLEX,0), | LETTER('a',M_CIRCUMFLEX,0), | ||||
| // characters U+0250 to U+029F | // characters U+0250 to U+029F | ||||
| const short letter_accents_250[] = { | |||||
| const unsigned short letter_accents_250[] = { | |||||
| LETTER('a',M_TURNED,0), // U+250 | LETTER('a',M_TURNED,0), // U+250 | ||||
| LETTER(L_ALPHA,0,0), | LETTER(L_ALPHA,0,0), | ||||
| LETTER(L_ALPHA,M_TURNED,0), | LETTER(L_ALPHA,M_TURNED,0), |
| #include "voice.h" | #include "voice.h" | ||||
| #include "translate.h" | #include "translate.h" | ||||
| #ifdef PLATFORM_POSIX | |||||
| #include <unistd.h> | |||||
| #endif | |||||
| #include <locale.h> | #include <locale.h> | ||||
| #define N_XML_BUF 256 | #define N_XML_BUF 256 | ||||
| if((f = fopen(fname,"rb")) != NULL) | if((f = fopen(fname,"rb")) != NULL) | ||||
| { | { | ||||
| int ix; | int ix; | ||||
| int fd_temp; | |||||
| const char *resample; | const char *resample; | ||||
| int header[3]; | int header[3]; | ||||
| else | else | ||||
| resample = "polyphase"; | resample = "polyphase"; | ||||
| sprintf(fname_temp,"%s.wav",tmpnam(NULL)); | |||||
| sprintf(command,"sox \"%s\" -r %d -w -s -c1 %s %s\n", fname, samplerate, fname_temp, resample); | |||||
| if(system(command) == 0) | |||||
| strcpy(fname_temp,"/tmp/espeakXXXXXX"); | |||||
| if((fd_temp = mkstemp(fname_temp)) >= 0) | |||||
| { | { | ||||
| fname = fname_temp; | |||||
| close(fd_temp); | |||||
| // sprintf(fname_temp,"%s.wav",tmpnam(NULL)); | |||||
| sprintf(command,"sox \"%s\" -r %d -w -s -c1 %s %s\n", fname, samplerate, fname_temp, resample); | |||||
| if(system(command) == 0) | |||||
| { | |||||
| fname = fname_temp; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| #include "translate.h" | #include "translate.h" | ||||
| #include "wave.h" | #include "wave.h" | ||||
| const char *version_string = "1.32 04.Mar.08"; | |||||
| const char *version_string = "1.33 06.Mar.08"; | |||||
| const int version_phdata = 0x013200; | const int version_phdata = 0x013200; | ||||
| int option_device_number = -1; | int option_device_number = -1; |
| int ix; | int ix; | ||||
| static char buf[5]; | static char buf[5]; | ||||
| for(ix=0; ix<3; ix++) | |||||
| for(ix=0; ix<4; ix++) | |||||
| buf[ix] = word >> (ix*8); | buf[ix] = word >> (ix*8); | ||||
| buf[4] = 0; | buf[4] = 0; | ||||
| return(buf); | return(buf); |
| case L('t','a'): // Tamil | case L('t','a'): // Tamil | ||||
| { | { | ||||
| static const short stress_lengths_ta[8] = {190, 190, 200, 200, 0, 0, 220, 220}; | |||||
| static const short stress_lengths_ta[8] = {200, 200, 210, 210, 0, 0, 230, 230}; | |||||
| static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 }; | static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 }; | ||||
| tr = new Translator(); | tr = new Translator(); |
| } | } | ||||
| wordx[-1] = c_temp; | wordx[-1] = c_temp; | ||||
| pfix = 1; | |||||
| prefix_chars[0] = 0; | |||||
| n_chars = prefix_type & 0x3f; | |||||
| for(ix=0; ix < n_chars; ix++) // num. of bytes to remove | |||||
| if((prefix_type & SUFX_B) == 0) | |||||
| { | { | ||||
| prefix_chars[pfix++] = *wordx++; | |||||
| for(ix=(prefix_type & 0xf); ix>0; ix--) // num. of characters to remove | |||||
| { | |||||
| wordx++; | |||||
| while((*wordx & 0xc0) == 0x80) wordx++; // for multibyte characters | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| pfix = 1; | |||||
| prefix_chars[0] = 0; | |||||
| n_chars = prefix_type & 0x3f; | |||||
| if((prefix_type & SUFX_B) && (ix == (n_chars-1))) | |||||
| for(ix=0; ix < n_chars; ix++) // num. of bytes to remove | |||||
| { | { | ||||
| prefix_chars[pfix-1] = 0; // discard the last character of the prefix, this is the separator character | |||||
| prefix_chars[pfix++] = *wordx++; | |||||
| if((prefix_type & SUFX_B) && (ix == (n_chars-1))) | |||||
| { | |||||
| prefix_chars[pfix-1] = 0; // discard the last character of the prefix, this is the separator character | |||||
| } | |||||
| } | } | ||||
| prefix_chars[pfix] = 0; | |||||
| } | } | ||||
| prefix_chars[pfix] = 0; | |||||
| c_temp = wordx[-1]; | c_temp = wordx[-1]; | ||||
| wordx[-1] = ' '; | wordx[-1] = ' '; | ||||
| confirm_prefix = 1; | confirm_prefix = 1; | ||||
| if(prefix_type & SUFX_B) | if(prefix_type & SUFX_B) | ||||
| { | { | ||||
| // SUFX_B is used for Turkish, tr_rules contains "(Pb£ | |||||
| // retranslate the prefix part | // retranslate the prefix part | ||||
| char *wordpf; | char *wordpf; | ||||
| char prefix_phonemes2[12]; | char prefix_phonemes2[12]; |
| #include "translate.h" | #include "translate.h" | ||||
| #include "prosodydisplay.h" | #include "prosodydisplay.h" | ||||
| #ifdef PLATFORM_POSIX | |||||
| #include <unistd.h> | |||||
| #endif | |||||
| #include "wx/font.h" | #include "wx/font.h" | ||||
| #include "wx/textctrl.h" | #include "wx/textctrl.h" | ||||
| #include "wx/button.h" | #include "wx/button.h" | ||||
| int clause_tone; | int clause_tone; | ||||
| int clause_count; | int clause_count; | ||||
| FILE *f; | FILE *f; | ||||
| int fd_temp; | |||||
| char fname_temp[100]; | char fname_temp[100]; | ||||
| static int n_ph_list; | static int n_ph_list; | ||||
| static PHONEME_LIST ph_list[N_PH_LIST+1]; | static PHONEME_LIST ph_list[N_PH_LIST+1]; | ||||
| case T_RULES: | case T_RULES: | ||||
| case MENU_SPEAK_RULES: | case MENU_SPEAK_RULES: | ||||
| option_phonemes = 2; | option_phonemes = 2; | ||||
| #ifdef PLATFORM_POSIX | |||||
| strcpy(fname_temp,"/tmp/espeakXXXXXX"); | |||||
| if((fd_temp = mkstemp(fname_temp)) >= 0) | |||||
| { | |||||
| close(fd_temp); | |||||
| if((f = fopen(fname_temp,"w+")) != NULL) | |||||
| { | |||||
| f_trans = f; // write translation rule trace to a temp file | |||||
| } | |||||
| } | |||||
| #else | |||||
| strcpy(fname_temp,tmpnam(NULL)); | strcpy(fname_temp,tmpnam(NULL)); | ||||
| if((f = fopen(fname_temp,"w+")) != NULL) | if((f = fopen(fname_temp,"w+")) != NULL) | ||||
| { | { | ||||
| f_trans = f; // write translation rule trace to a temp file | f_trans = f; // write translation rule trace to a temp file | ||||
| } | } | ||||
| #endif | |||||
| case T_TRANSLATE: | case T_TRANSLATE: | ||||
| case MENU_SPEAK_TRANSLATE: | case MENU_SPEAK_TRANSLATE: | ||||
| option_multibyte = espeakCHARS_AUTO; | option_multibyte = espeakCHARS_AUTO; |
| p = voice->languages; // list of languages+dialects for which this voice is suitable | p = voice->languages; // list of languages+dialects for which this voice is suitable | ||||
| if(strcmp(spec_language,"mbrola")==0) | |||||
| { | |||||
| // only list mbrola voices | |||||
| if(memcmp(voice->identifier,"mb/",3) == 0) | |||||
| return(100); | |||||
| return(0); | |||||
| } | |||||
| if(spec_n_parts == 0) | if(spec_n_parts == 0) | ||||
| { | { | ||||
| score = 100; | score = 100; | ||||
| for(ix=0; ix<n_voices_list; ix++) | for(ix=0; ix<n_voices_list; ix++) | ||||
| { | { | ||||
| vp = voices_list[ix]; | vp = voices_list[ix]; | ||||
| if(((control & 1) == 0) && (memcmp(vp->identifier,"mb/",3) == 0)) | if(((control & 1) == 0) && (memcmp(vp->identifier,"mb/",3) == 0)) | ||||
| continue; | continue; | ||||
| if(embedded_value[EMBED_T] > 0) | if(embedded_value[EMBED_T] > 0) | ||||
| { | { | ||||
| // announcing punctuation | // announcing punctuation | ||||
| amp = embedded_value[EMBED_T] * 10; | |||||
| delay = 130; | |||||
| amp = embedded_value[EMBED_T] * 8; | |||||
| delay = 60; | |||||
| } | } | ||||
| if(delay == 0) | if(delay == 0) | ||||
| echo_head = (delay * samplerate)/1000; | echo_head = (delay * samplerate)/1000; | ||||
| echo_length = echo_head; // ensure completion of echo at the end of speech. Use 1 delay period? | echo_length = echo_head; // ensure completion of echo at the end of speech. Use 1 delay period? | ||||
| if(amp == 0) | |||||
| echo_length = 0; | |||||
| if(amp > 20) | if(amp > 20) | ||||
| echo_length = echo_head * 2; // perhaps allow 2 echo periods if the echo is loud. | echo_length = echo_head * 2; // perhaps allow 2 echo periods if the echo is loud. | ||||