diff --git a/dictsource/en_list b/dictsource/en_list index bff93f72..eb7f0f7e 100644 --- a/dictsource/en_list +++ b/dictsource/en_list @@ -17,6 +17,7 @@ // ?8 Use full vowel, not schwa in some word endings // $alt use strong ending +// $alt2 use weak ending // letter names, as they are spoken as a single character in text @@ -297,6 +298,7 @@ _17 s'Ev@nti:n _18 'eIti:n _19 n'aInti:n _2X tw'Enti +?3 _2X tw'Eni _3X T'3:ti ?5 _3X T'IRti _4X f'o@ti @@ -306,6 +308,7 @@ _7X s'Ev@nti ?7 _7X s'@v@nti _8X 'eIti _9X n'aInti + _0C h'Vndr@d _0M1 T'aUz@nd _0M2 m'Ili@n @@ -628,6 +631,7 @@ askance a#skaans askew a#skju: ass as assess a#sEs +asus eIs@s atlas atl@s atop a#t0p attache at'aSeI $only @@ -702,6 +706,7 @@ bizarre bIz'A@ bizzare bIz'A@ blancmange bl@m0nZ blase blA:zeI +bleh blEh blockade $2 blouse blaUz bluest blu:@st @@ -776,10 +781,13 @@ capitol kapIt@L caprice ka#pr'i:s caramel kar@mEl caravan kar@van +carburetor kA@b@r'Et3 +?3 carburetor kA@b@reIt3 career k@r'i@3 caress k@rEs carpel kA@p@l cascade $2 +cashier kaS'i@3 cashmere kaSm'i@3 catastrophe ka#tastr@f%i catarrh k@tA@ @@ -808,6 +816,8 @@ chapel tSap@L charade Sa#rA:d charismatic karIsm'atIk charit tSarIt // charitable +charlatan SA@l@t@n +chassis SaSi chateau SatoU chemise SEm'i:z chevrolet SEvr@leI @@ -929,6 +939,7 @@ corollary $2 corporal kO@pr@L corporate kO@p@r@t corps kO@ $only +corral k@r'al cosmos k0zm0s countered kaUnt3d coupon ku:p0n @@ -1076,6 +1087,7 @@ educe I2dju:s edwardian Edw'O@di@n efile i:faIl egg Eg // egging +egregious Igr'i:dZ@s eh eI eid i:d el ,El $only @@ -1087,6 +1099,7 @@ elicit I2lIsI2t élite Il'i:t embed Emb'Ed ember Emb3 +emphasis Emf@sIs empire $1 emu i:mju: enroute 0nr'u:t @@ -1163,6 +1176,7 @@ familiar f@mIli@3 famine famIn farewell $2 fasten faas@n +fatigue fa#ti:g fathom faD@m (faux pas) f'oU||p'A: favorite feIv@-rI2t // sp. @@ -1207,6 +1221,7 @@ foretell fo@t'El forever $2 forewarn $2 formid fO@m'Id // formidable +formica fO@m'aIk@ fortunate fO@tS@n@t fortune fO@tSu:n foyer fOIeI @@ -1253,6 +1268,7 @@ gilead g'IlIad gimme gImi giraffe dZI2raaf goin ,goUI2n $only // for goin' +gonna g,@n@ goodbye $2 goodday $2 goodnight $2 @@ -1337,8 +1353,6 @@ huzza h@z'A: huzzah h@z'A: hyperbola haIp'3:b@l@ hyperbole haIp'3:b@li -hypothesis haIp'0T@sIs -hypotheses haIp'0T@si:z hypotenuse haIp'0t@nju:s hypoxia haIp'0ksi@ @@ -1347,6 +1361,7 @@ icon aIk0n iconbar aIk0nbA@ idly aIdlI ignoramus Igno@r'eIm@s +illiterate $alt2 imagine I2madZI2n impedance Imp'i:d@ns imperative Imp'Er@tIv @@ -1450,7 +1465,7 @@ laity leI@ti landowner l'and,oUn3 las ,las $only ?3 las ,lA:s $only -lasagne l@zanj@ +lasagna l@zanj@ laser leIz3 lasso las'u: latte lateI @@ -1484,6 +1499,7 @@ lingerie l0nZ@ri linen lInI2n liqueur lI2kjU@ liter li:t3 +literate $alt2 literature lItrI2tS3 live laIv $onlys live lIv $verb @@ -1546,6 +1562,8 @@ meant mEnt meadow mEdoU mediaeval mEdI'i:v@L medicine mEds@n +melee mEleI +?3 melee meIleI melon mEl@n menus mEnju:z memo mEmoU @@ -1624,6 +1642,7 @@ myrtle m3:t@L naif naI'i:f naïve naI'i:v +naivete naI'i:v@teI naked neIkI#d nasa nasa# nascent neIs@nt @@ -1749,6 +1768,7 @@ paltry pO:ltrI panacea pana#s'i:@ panache $2 pancreas pankri@s +papaya pa#paI;@ parabola p@rab@l@ paralysis p@ral@sIs parameter p@ramI2t3 @@ -1907,6 +1927,7 @@ rabid reIbId radar reIdA@ radish radIS ragged ragI#d +raiment reIm@nt rainforest r'eInf,0rI2st rajah rA:dZA: rapier reIpi@3 @@ -2141,6 +2162,7 @@ society s@saI@ti sofa soUf@ soiree swA:reI sojourn soUdZ3:n +solder s0ld3 soldier soUldZ3 solemn s0l@m solicit s@lIsI2t // solicited,ing @@ -2155,7 +2177,7 @@ soundbite saUndbaIt souvenir su:v@n'i@3 sorbet sO@beI soyabean sOI@bi:n -spaghetti spag'Eti +spaghetti spa#gEti spasm spas@m specific sp@sIfIk specimen spEsI2m@n @@ -2209,8 +2231,6 @@ suspect sVspEkt $onlys suspect $verb symbol sImb@L sync sINk -synthesis sInT@sIs $only -synthesise sInT@saIz tableau tabloU tablet tabl@t @@ -2559,12 +2579,13 @@ Chile tSIli Cincinnati sInsIn'ati Cologne k@loUn Columbus $2 -Congo $1 +Congo k0NgoU Connecticut k@nEtI2k@t Copenhagen koUp@nh'eIg@n Cruz kru:z Cyprus saIpr@s Dahomey $2 +Dallas dal@s Damascus da#mask@s Dakota da#koUt@ Danish deInIS @@ -2909,6 +2930,7 @@ Loinnir lVni@ Lois loUIs Louis lu:i Louise lu:w'i:z +Luigi lu:'i:dZi Luis lu:Is Lupe lu:peI Madeline mad@lI2n @@ -2926,7 +2948,7 @@ Matthew maTju: Maurice m0rIs Mavis meIvIs Megan mEg@n -Melissa $2 +Melissa m@lIs@ Michele mI2SEl Michelle mI2SEl Miguel mi:Q'El @@ -2959,6 +2981,7 @@ Pamela pam@l@ Pandora $2 Patricia pa#trIS@ Penelope p@nEl@pi +Persephone p3s'Ef@ni Phoebe fi:bi: Rachael reItS@L Rachel reItS@L @@ -2966,6 +2989,7 @@ Raul raU'u:l Rees ri:s Reese ri:s Reggie rEdZi +Remus ri:m@s Reynold rEn@Ld Rhys ri:s Rihanna rI'A:n@ @@ -3023,11 +3047,13 @@ Dante danteI Disney dIzni Dolce d0ltSeI Dvorak d@-vo@Zak +Folger foUldZ3 Gibson gIbs@n Guinness gInIs Hades heIdi:z Mackenna m@kEn@ Mackenzie m@kEnzi +Medusa $2 Montague m0nt@gju: Niro ni@roU Patel pa#tEl @@ -3043,6 +3069,7 @@ Ubuntu u:b'u:ntu: Wii wi:: Yaesu jeIsu: Yamaha jam@hA: +zeus zju:s zhivago ZI2vA:goU diff --git a/dictsource/en_rules b/dictsource/en_rules index a7d00fa6..86c55efe 100644 --- a/dictsource/en_rules +++ b/dictsource/en_rules @@ -34,6 +34,7 @@ .L02 i y .L03 a i o u // vowel, not 'e' .L05 c g k +.L06 s z .L10 grap log met scop // scientific endings @@ -724,6 +725,7 @@ st) an (_ an m) an (_ an hum) an (_ @n + &) an (ty_ @n &) an (t_ @n ?8 &) an (t_ a#n pl) an (t_ an @@ -746,6 +748,7 @@ @) aneous 'eIni@s p) an (el an &) an (ese @n + _) ane (s anI an (gul 'an &) ani (_ 'A:nI an (ia 'eIn @@ -848,6 +851,7 @@ _) arr (@ a#r _) arr (ant ar _) arr (o ar + _) arro (g ar@ ar (i_ 'A:r ?3 @) ar (io_ 'ar _b) ar (L02t ar @@ -1039,6 +1043,7 @@ .group at _g) ator eIt3 + &) ate (_$w_alt2 @t pal) ate (_ @t consul) ate (_ @t macul) ate (_ @t @@ -1552,6 +1557,7 @@ @@e) d (_S1 d // suffix db (_ d,i:bi: ddh d + dh (K d dj dZ dg (_ dZ dg (C dZ @@ -1603,7 +1609,7 @@ de (law dE de (leg dE de (lica dE - de (ll dE + _) de (ll dE de (lph dE _) de (lt dE delu (g dElju: @@ -2233,6 +2239,7 @@ j) eo (p E _l) eo i@ p) eo (pl i: + _) eor eI3 @) eosis i:'oUsIs &) eous (_ =i@s th) eo (@ I2@ @@ -2410,9 +2417,12 @@ es (tate I2s @) esc (enC 'Es pr) es (ent Ez - magn) es (i 'i:z + es (iA i:z es (ian_ 'i:z es (ic 'i:z + th) eses (_ @si:z + th) esis (_ @sIs + th) es (iL06e_ @s r) esis (_ 'i:sIs es (ive 'i:s esque 'Esk @@ -2427,6 +2437,7 @@ Cr) es (t Es v) es (t+ Es harv) es (t Is + esti (m EstI# v) es (ty @s .group et @@ -2474,6 +2485,7 @@ .group ev _) ev I2v + _) eva (ne Ev@ _) eve i:v _) even i:v@n _) eve (nt I2vE @@ -2579,6 +2591,7 @@ _) g (ilK g g (ilC g l) ging dZI2N + _) g (iz g g (y dZ exa) gg (er dZ ght t @@ -2656,6 +2669,7 @@ _) hypo (@P4 h,aIpoU _) hypo (cr hIp0 hypo (de h,aIp@ + hypo (thes haIp'0 hypo (thet h,aIp@ .group i @@ -2693,6 +2707,7 @@ &) ial (_ =I2@l i (ani_ I _) i (b aI + i (ba_ 'i: @) ibab aIb@b l) i (bel aI l) i (ber I @@ -2818,6 +2833,7 @@ ize (d_ aIz i (zen I2 iz (er_ aIz + i (zon_ 'aI p) izz (a i:t|s @@ -3075,6 +3091,7 @@ _) in (fo_ In _) infra (P5 ,Infr@ _) infra (c %Infra + in (ga_ 'IN in (got IN _) in (gro IN _) in (jur In @@ -3209,8 +3226,9 @@ .group io - io (_ =I2oU -?7 io (_ =i:oU + &) io (_ =I2oU +?7 &) io (_ =i:oU + io (_ i:oU b) io aIoU b) io (logy aI0 card) io I2oU @@ -3445,6 +3463,7 @@ _) ki (lC@ kI2 _) ki (ll@ kI _) kilo (@ kIl@ + kinesis k@n'i:sI#s kuan kwan ku (ch ku: kuwait ku:w'eIt @@ -3653,6 +3672,8 @@ ninth naInT n (Co_ =n _) non (@P3 n,0n + nonchala (n n0nS@l@ +?3 nonchala (n n0nS@l'A: _) nurse (B n3:s .group ng @@ -3786,7 +3807,7 @@ oer oU@ _) oe (s i: &) oe (s_S2 z - oe (soph I2 + oesopha I2s0f@ p) oe (t oUI f) oe (tA i: p) oe (ti oUE @@ -3924,6 +3945,7 @@ t) ol (er 0l m) ol (ec @l m) ol (ecule 0l + &) ol (enC @l old oUld w) olf Ulf p) olice @li:s @@ -4504,6 +4526,7 @@ per (cei p3 per (culi p3 per (cus p3 + _) peregrin pEr@grIn per (fec p3 per (iph p@r perme (a p3:mI @@ -4641,6 +4664,7 @@ qu (_ k quay ki: jac) qu k + mes) qui (t k'i: li) quor k3 quy kwI @@ -4707,6 +4731,7 @@ un) rede (C ,ri:dI2 re (dem+ rI2 _) re (dC rE + _) re (dolen rE _) re (dr r%i: _) re (eduP2 r%i: _) re (emP2 r%i: @@ -4805,6 +4830,7 @@ sch (o sk sch (C S sch (_ S + _e) sch S ?3 sch (ed sk _) sch (il S _) scar (A ske@ @@ -5003,6 +5029,7 @@ _) tian tjan &) tial S@L &) ti (ali SI + i) tia (liL06 S@ &) tien S@n &) tience S@ns &) tion S=@n @@ -5126,7 +5153,7 @@ _l) u (a u: r) u (aC+ u: u (a_ =ju: - s) ua (d weI + s) ua (de weI s) uag weIdZ @g) ua (ge wI u (al_ ju: @@ -5265,6 +5292,7 @@ fl) ui (d u:I dr) ui (d u:I c) uisine wIzi:n + c) uis wIz rc) ui (t I rc) ui (tous ''ju:I g) ui (ta I2 diff --git a/dictsource/hu_list b/dictsource/hu_list index 5fe96b04..7a508cd8 100644 --- a/dictsource/hu_list +++ b/dictsource/hu_list @@ -4801,7 +4801,63 @@ kipróbálni $unstressend váltana $unstressend találtam $unstressend (sem biztosak) SEm_'||bistoSAk $unstressend +kaphatnak $unstressend +költ $unstressend +hivatalt $unstressend +támogatással $unstressend +ugyanis $unstressend +bizonyítják $unstressend +ösztönzése $unstressend +elvégezze $unstressend +intézet $unstressend +takarítani $unstressend +bízza $unstressend +bízna $unstressend +filmekkel $unstressend +lejátszóhoz $unstressend +filmeket $unstressend +vesződni $unstressend +(legkényelmesebb az) lEgke:n^ElmESEb:_||Az $unstressend +sejtem $unstressend +vonalat $unstressend +ragaszkodni $unstressend +(mellett az) mEl:Et:_||Az $unstressend +(a felület) A'||fElylEt $unstressend +terveket $unstressend +tervek $unstressend +közben $unstressend +menetrendet $unstressend +(az indoklást) Az_'||indokla:St $unstressend +hóbort $unstressend +fogom $unstressend +(az adatokat) Az_'||AdAtokAt $unstressend +zajlik $unstressend +kütyüt $unstressend +tartok $unstressend +(törvényt is) tYR2ve:n^t_||iS $unstressend +ülésen $unstressend +jogszabály $unstressend +törvényjavaslatról $unstressend +rövid $unstressend +vonulhatnának $unstressend +(horderejű kérdésben) hoR2dER2Ejy:_||ke:R2de:SbEn $unstressend +törvényjavaslatához $unstressend +(miniszter volt) ministER2||volt $unstressend +szavazatot $unstressend +(rendelkezést is) REndElkEze:St_||iS $unstressend +(lehetővé tenné) lEhEtY:ve:_||tEn:e: $unstressend +(indítványnak van) indi:tva:n^nAk_||vAn $unstressend +(ellenére is biztosítaná) El:Ene:R2E_||iS_||bistoSi:tAna: $unstressend +emelni $unstressend +(csak ki) tSAk_||ki $unstressend +indítványokról $unstressend +(a módosítások) A'||mo:doSi:ta:Sok $unstressend +közölni $unstressend +tudjanak $unstressend +piacot $unstressend +rakott $unstressend +(ott van) ot:_||vAn $unstressend // word pairs diff --git a/dictsource/ta_rules b/dictsource/ta_rules index d743f9d5..eb8c4bfc 100644 --- a/dictsource/ta_rules +++ b/dictsource/ta_rules @@ -2053,7 +2053,6 @@ _டெட்_) ப (ாடி b _) ப (ாதித்த b _) ப (ாதிப்படை b _) ப (ாதிப்படைகி b - _) ப (ாதிப்படைய b _) ப (ாதிப்படையுமெ b _) ப (ாதிப்படைவ b _) ப (ாதிப்பதா b diff --git a/phsource/ph_kazakh b/phsource/ph_kazakh index a3f2139a..2537b429 100644 --- a/phsource/ph_kazakh +++ b/phsource/ph_kazakh @@ -123,3 +123,17 @@ phoneme X lengthmod 3 WAV(ufric/x2, 60) endphoneme + +phoneme L + import_phoneme sq/ll +// import_phoneme base/l- +endphoneme + +phoneme l + liquid + IF nextPhW(isFlag1) THEN + ELSE + ChangePhoneme(L) // Hard + ENDIF + CALL base/l +endphoneme diff --git a/src/dictionary.cpp b/src/dictionary.cpp index 6371c8c4..012d23b2 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -524,27 +524,33 @@ unsigned short ipa1[96] = { }; -static void WritePhMnemonic(char **buf, PHONEME_TAB *ph, PHONEME_LIST *plist) -{//======================================================================================= +char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa) +{//===================================================================================== int c; int mnem; int len; int first; int ix = 0; - char *phon_out; + char *p; unsigned int ipa_control=0; // first byte of ipa string may control the phoneme name interpretation. 0x20 = ignore this phoneme PHONEME_DATA phdata; - phon_out = *buf; - if(ph->code == phonEND_WORD) { // ignore phon_out[0] = 0; - return; + return(phon_out); } - if(option_phonemes == 3) + if(ph->code == phonSWITCH) + { + // the tone_ph field contains a phoneme table number + p = phoneme_tab_list[plist->tone_ph].name; + sprintf(phon_out, "(%s)", p); + return(phon_out + strlen(phon_out)); + } + + if(use_ipa) { // has an ipa name been defined for this phoneme ? phdata.ipa_string[0] = 0; @@ -568,8 +574,9 @@ static void WritePhMnemonic(char **buf, PHONEME_TAB *ph, PHONEME_LIST *plist) } if(ipa_control >= 0x20) { - *buf += ix; - return; // 0x20 = ignore phoneme + phon_out = &phon_out[ix]; + *phon_out = 0; + return(phon_out); // 0x20 = ignore phoneme } } } @@ -580,7 +587,7 @@ static void WritePhMnemonic(char **buf, PHONEME_TAB *ph, PHONEME_LIST *plist) if((c == '/') && (option_phoneme_variants==0)) break; // discard phoneme variant indicator - if(option_phonemes == 3) + if(use_ipa) { // convert from ascii to ipa if(first && (c == '_')) @@ -605,13 +612,15 @@ static void WritePhMnemonic(char **buf, PHONEME_TAB *ph, PHONEME_LIST *plist) first = 0; } - *buf += ix; + phon_out = &phon_out[ix]; + *phon_out = 0; + return(phon_out); } // end of WritePhMnemonic -void GetTranslatedPhonemeString(char *phon_out, int n_phon_out) -{//============================================================ +void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa) +{//========================================================================= /* Can be called after a clause has been translated into phonemes, in order to display the clause in phoneme mnemonic form. */ @@ -622,7 +631,6 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out) int phon_out_ix=0; int stress; unsigned int c; - char *p; char *buf; char phon_buf[30]; PHONEME_LIST *plist; @@ -646,7 +654,7 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out) c = 0; if(stress > 5) stress = 5; - if(option_phonemes == 3) + if(use_ipa) { c = 0x2cc; // ipa, secondary stress if(stress > 3) @@ -664,30 +672,22 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out) } } - if(plist->ph->code == phonSWITCH) - { - // the tone_ph field contains a phoneme table number - p = phoneme_tab_list[plist->tone_ph].name; + buf = WritePhMnemonic(buf, plist->ph, plist, use_ipa); - sprintf(buf, "(%s)", p); - buf += (strlen(p) + 2); - } - else + if(plist->ph->code != phonSWITCH) { - WritePhMnemonic(&buf, plist->ph, plist); - if(plist->synthflags & SFLAG_LENGTHEN) { - WritePhMnemonic(&buf, phoneme_tab[phonLENGTHEN], NULL); + buf = WritePhMnemonic(buf, phoneme_tab[phonLENGTHEN], NULL, use_ipa); } if((plist->synthflags & SFLAG_SYLLABLE) && (plist->type != phVOWEL)) { // syllablic consonant - WritePhMnemonic(&buf, phoneme_tab[phonSYLLABIC], NULL); + buf = WritePhMnemonic(buf, phoneme_tab[phonSYLLABIC], NULL, use_ipa); } if(plist->tone_ph > 0) { - WritePhMnemonic(&buf, phoneme_tab[plist->tone_ph], NULL); + buf = WritePhMnemonic(buf, phoneme_tab[plist->tone_ph], NULL, use_ipa); } } diff --git a/src/extras.cpp b/src/extras.cpp index 615d414b..453a545b 100644 --- a/src/extras.cpp +++ b/src/extras.cpp @@ -134,7 +134,13 @@ int TestSynthCallback(short *wav, int numsamples, espeak_EVENT *events) fprintf(f_events,"'%s'\n",events->id.name); else if(type==espeakEVENT_PHONEME) - fprintf(f_events,"[%s]\n",WordToString(events->id.number)); + { + char buf[10]; +// fprintf(f_events,"[%s]\n",WordToString(events->id.number)); //old version, only 4 characters bytes + memcpy(buf, events->id.string, 8); + buf[8] = 0; + fprintf(f_events,"[%s]\n", buf); + } else fprintf(f_events,"%d\n",events->id.number); @@ -2309,7 +2315,7 @@ if(control==2) fprintf(f_events,"Type Audio Text Length Id\n"); fclose(f_events); - espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL,1000,NULL,1); + espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, 1000, NULL, espeakINITIALIZE_PHONEME_IPA); espeak_SetSynthCallback(TestSynthCallback); espeak_SetUriCallback(TestUriCallback); diff --git a/src/speak.cpp b/src/speak.cpp index deccfbf7..35d756da 100644 --- a/src/speak.cpp +++ b/src/speak.cpp @@ -282,7 +282,7 @@ static void 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, int value2, unsigned char *out_ptr) {//====================================================================================== // Do nothing in the command-line version. if(type == 2) diff --git a/src/speak_lib.cpp b/src/speak_lib.cpp index 187a22ed..3d0cba88 100644 --- a/src/speak_lib.cpp +++ b/src/speak_lib.cpp @@ -543,12 +543,13 @@ static const char* label[] = { #endif -void MarkerEvent(int type, unsigned int char_position, int value, unsigned char *out_ptr) -{//====================================================================================== - // type: 1=word, 2=sentence, 3=named mark, 4=play audio, 5=end +void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr) +{//================================================================================================== + // type: 1=word, 2=sentence, 3=named mark, 4=play audio, 5=end, 7=phoneme ENTER("MarkerEvent"); espeak_EVENT *ep; double time; + PHONEME_TAB *ph; if((event_list == NULL) || (event_list_ix >= (n_event_list-2))) return; @@ -574,7 +575,17 @@ void MarkerEvent(int type, unsigned int char_position, int value, unsigned char if((type == espeakEVENT_MARK) || (type == espeakEVENT_PLAY)) ep->id.name = &namedata[value]; else + if(type == espeakEVENT_PHONEME) + { + int *p; + p = (int *)(ep->id.string); + p[0] = value; + p[1] = value2; + } + else + { ep->id.number = value; + } } // end of MarkerEvent @@ -769,7 +780,7 @@ ENTER("espeak_Initialize"); option_phonemes = 0; option_mbrola_phonemes = 0; - option_phoneme_events = (options & 1); + option_phoneme_events = (options & (espeakINITIALIZE_PHONEME_EVENTS | espeakINITIALIZE_PHONEME_IPA)); VoiceReset(0); // SetVoiceByName("default"); diff --git a/src/speak_lib.h b/src/speak_lib.h index 8cf7f807..fb749415 100644 --- a/src/speak_lib.h +++ b/src/speak_lib.h @@ -34,7 +34,7 @@ #define ESPEAK_API #endif -#define ESPEAK_API_REVISION 6 +#define ESPEAK_API_REVISION 7 /* Revision 2 Added parameter "options" to eSpeakInitialize() @@ -50,6 +50,11 @@ Revision 5 Revision 6 Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL + +Revision 7 24.Dec.2011 + Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics. + Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names. + */ /********************/ /* Initialization */ @@ -84,8 +89,9 @@ typedef struct { int sample; // sample id (internal use) void* user_data; // pointer supplied by the calling program union { - int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic. + int number; // used for WORD and SENTENCE events. const char *name; // used for MARK and PLAY events. UTF8 string + char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes. } id; } espeak_EVENT; /* @@ -164,6 +170,7 @@ typedef enum { } espeak_ERROR; #define espeakINITIALIZE_PHONEME_EVENTS 0x0001 +#define espeakINITIALIZE_PHONEME_IPA 0x0002 #define espeakINITIALIZE_DONT_EXIT 0x8000 #ifdef __cplusplus @@ -178,6 +185,7 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, cons path: The directory which contains the espeak-data directory, or NULL for the default location. options: bit 0: 1=allow espeakEVENT_PHONEME events. + bit 1: 1= espeakEVENT_PHONEME events give IPA phoneme names, not eSpeak phoneme names bit 15: 1=don't exit if espeak_data is not found (used for --help) Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR). diff --git a/src/synth_mbrola.cpp b/src/synth_mbrola.cpp index e0ae20a0..fe6fe556 100644 --- a/src/synth_mbrola.cpp +++ b/src/synth_mbrola.cpp @@ -488,7 +488,11 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr len = (80 * speed.wav_factor)/256; if(ph->code != phonEND_WORD) - DoMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, ph->mnemonic); + { + char phoneme_name[16]; + WritePhMnemonic(phoneme_name, p->ph, p, option_phoneme_events & espeakINITIALIZE_PHONEME_IPA); + DoPhonemeMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, phoneme_name); + } ptr += sprintf(ptr,"%s\t",WordToString(name)); diff --git a/src/synthdata.cpp b/src/synthdata.cpp index fe2148c0..09dace9a 100644 --- a/src/synthdata.cpp +++ b/src/synthdata.cpp @@ -35,7 +35,7 @@ #include "translate.h" #include "wave.h" -const char *version_string = "1.46.10 21.Dec.11"; +const char *version_string = "1.46.11 24.Dec.11"; const int version_phdata = 0x014600; int option_device_number = -1; @@ -675,7 +675,7 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, if(control & 0x100) { - // change phonemes pass + // "change phonemes" pass plist->ph = phoneme_tab[plist->phcode]; } ph = plist->ph; diff --git a/src/synthesize.cpp b/src/synthesize.cpp index 5c845228..3334ad60 100644 --- a/src/synthesize.cpp +++ b/src/synthesize.cpp @@ -1211,10 +1211,27 @@ void DoMarker(int type, int char_posn, int length, int value) // Type 1=word, 2=sentence, 3=named marker, 4=play audio, 5=end if(WcmdqFree() > 5) { - wcmdq[wcmdq_tail][0] = WCMD_MARKER; - wcmdq[wcmdq_tail][1] = type; - wcmdq[wcmdq_tail][2] = (char_posn & 0xffffff) | (length << 24); - wcmdq[wcmdq_tail][3] = value; + wcmdq[wcmdq_tail][0] = WCMD_MARKER + (type << 8); + wcmdq[wcmdq_tail][1] = (char_posn & 0xffffff) | (length << 24); + wcmdq[wcmdq_tail][2] = value; + WcmdqInc(); + } +} // end of DoMarker + + +void DoPhonemeMarker(int type, int char_posn, int length, char *name) +{//================================================================== +// This could be used to return an index to the word currently being spoken +// Type 7=phoneme + int *p; + + if(WcmdqFree() > 5) + { + wcmdq[wcmdq_tail][0] = WCMD_MARKER + (type << 8); + wcmdq[wcmdq_tail][1] = (char_posn & 0xffffff) | (length << 24); + p = (int *)name; + wcmdq[wcmdq_tail][2] = p[0]; // up to 8 bytes of UTF8 characters + wcmdq[wcmdq_tail][3] = p[1]; WcmdqInc(); } } // end of DoMarker @@ -1319,6 +1336,8 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) unsigned char *pitch_env=NULL; unsigned char *amp_env; PHONEME_TAB *ph; + int use_ipa=0; + char phoneme_name[16]; static int sourceix=0; PHONEME_DATA phdata; @@ -1330,6 +1349,9 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) if(option_quiet) return(0); + if(option_phoneme_events & espeakINITIALIZE_PHONEME_IPA) + use_ipa = 1; + if(mbrola_name[0] != 0) return(MbrolaGenerate(phoneme_list,n_ph,resume)); @@ -1405,7 +1427,8 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) if(option_phoneme_events && (p->type != phVOWEL) && (p->ph->code != phonEND_WORD)) { // Note, for vowels, do the phoneme event after the vowel-start - DoMarker(espeakEVENT_PHONEME, sourceix, 0, p->ph->mnemonic); + WritePhMnemonic(phoneme_name, p->ph, p, use_ipa); + DoPhonemeMarker(espeakEVENT_PHONEME, sourceix, 0, phoneme_name); } switch(p->type) @@ -1712,7 +1735,8 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) if(option_phoneme_events) { - DoMarker(espeakEVENT_PHONEME, sourceix, 0, p->ph->mnemonic); + WritePhMnemonic(phoneme_name, p->ph, p, use_ipa); + DoPhonemeMarker(espeakEVENT_PHONEME, sourceix, 0, phoneme_name); } fmtp.fmt_addr = phdata.sound_addr[pd_FMT]; @@ -1896,7 +1920,11 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control) if((option_phonemes > 0) || (phoneme_callback != NULL)) { - GetTranslatedPhonemeString(translator->phon_out,sizeof(translator->phon_out)); + int use_ipa = 0; + if(option_phonemes == 3) + use_ipa = 1; + + GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa); if(option_phonemes > 0) { fprintf(f_trans,"%s\n",translator->phon_out); diff --git a/src/synthesize.h b/src/synthesize.h index 946e04c3..6a2994ee 100644 --- a/src/synthesize.h +++ b/src/synthesize.h @@ -475,7 +475,7 @@ int WavegenInitSound(); void WavegenInit(int rate, int wavemult_fact); float polint(float xa[],float ya[],int n,float x); int WavegenFill(int fill_zeros); -void MarkerEvent(int type, unsigned int char_position, int value, unsigned char *out_ptr); +void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr); extern unsigned char *wavefile_data; @@ -559,7 +559,7 @@ int MbrolaFill(int length, int resume, int amplitude); void MbrolaReset(void); void DoEmbedded(int *embix, int sourceix); void DoMarker(int type, int char_posn, int length, int value); -//int DoSample(PHONEME_TAB *ph1, PHONEME_TAB *ph2, int which, int length_mod, int amp); +void DoPhonemeMarker(int type, int char_posn, int length, char *name); int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp); int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); int PauseLength(int pause, int control); diff --git a/src/translate.h b/src/translate.h index 0f0a9826..6e310798 100644 --- a/src/translate.h +++ b/src/translate.h @@ -639,7 +639,7 @@ int IsDigit(unsigned int c); int IsAlpha(unsigned int c); int isspace2(unsigned int c); int towlower2(unsigned int c); -void GetTranslatedPhonemeString(char *phon_out, int n_phon_out); +void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa); Translator *SelectTranslator(const char *name); int SetTranslator2(const char *name); @@ -679,6 +679,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix void SetVoiceStack(espeak_VOICE *v, const char *variant_name); void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_DATA *phdata); void InterpretPhoneme2(int phcode, PHONEME_DATA *phdata); +char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa); extern FILE *f_trans; // for logging extern FILE *f_logespeak; diff --git a/src/transldlg.cpp b/src/transldlg.cpp index f9b4003a..fce227c1 100644 --- a/src/transldlg.cpp +++ b/src/transldlg.cpp @@ -408,6 +408,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event) char phon_out[N_PH_LIST*2]; int clause_tone; int clause_count; + int use_ipa = 0; FILE *f; int fd_temp; char fname_temp[100]; @@ -459,6 +460,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event) t_phonetic->SetDefaultStyle(style_phonetic_large); translate_text = 3; + use_ipa = 1; break; case T_PROCESS: @@ -468,7 +470,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event) myframe->OnProsody(event); } prosodycanvas->LayoutData(ph_list,n_ph_list); - option_phoneme_events = 1; + option_phoneme_events = espeakINITIALIZE_PHONEME_EVENTS; option_log_frames = 1; MakeWave2(ph_list,n_ph_list); option_log_frames = 0; @@ -495,7 +497,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event) CalcPitches(translator,clause_tone); CalcLengths(translator); - GetTranslatedPhonemeString(translator->phon_out,sizeof(translator->phon_out)); + GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa); if(clause_count++ > 0) strcat(phon_out," ||"); strcat(phon_out,translator->phon_out); diff --git a/src/wavegen.cpp b/src/wavegen.cpp index 31043e4c..01f5dabb 100644 --- a/src/wavegen.cpp +++ b/src/wavegen.cpp @@ -261,8 +261,11 @@ unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1] = { #ifdef LOG_FRAMES -static void LogMarker(int type, int value) -{//======================================= +static void LogMarker(int type, int value, int value2) +{//=================================================== + char buf[20]; + int *p; + if(option_log_frames == 0) return; @@ -272,7 +275,13 @@ static void LogMarker(int type, int value) if(f_log) { if(type == espeakEVENT_PHONEME) - fprintf(f_log,"Phoneme [%s]\n",WordToString(value)); + { + p = (int *)buf; + p[0] = value; + p[1] = value2; + buf[8] = 0; + fprintf(f_log,"Phoneme [%s]\n", buf); + } else fprintf(f_log,"\n"); fclose(f_log); @@ -1630,7 +1639,7 @@ void WavegenSetVoice(voice_t *v) } WavegenSetEcho(); SetPitchFormants(); - MarkerEvent(espeakEVENT_SAMPLERATE,0,wvoice->samplerate,out_ptr); + MarkerEvent(espeakEVENT_SAMPLERATE, 0, wvoice->samplerate, 0, out_ptr); // WVoiceChanged(wvoice); } @@ -1862,6 +1871,7 @@ int WavegenFill2(int fill_zeros) long *q; int length; int result; + int marker_type; static int resume=0; static int echo_complete=0; @@ -1889,7 +1899,7 @@ int WavegenFill2(int fill_zeros) q = wcmdq[wcmdq_head]; length = q[1]; - switch(q[0]) + switch(q[0] & 0xff) { case WCMD_PITCH: SetPitch(length,(unsigned char *)q[2],q[3] >> 16,q[3] & 0xffff); @@ -1946,13 +1956,14 @@ int WavegenFill2(int fill_zeros) #endif case WCMD_MARKER: - MarkerEvent(q[1],q[2],q[3],out_ptr); + marker_type = q[0] >> 8; + MarkerEvent(marker_type, q[1],q[2],q[3],out_ptr); #ifdef LOG_FRAMES - LogMarker(q[1],q[3]); + LogMarker(marker_type, q[2], q[3]); #endif - if(q[1] == 1) + if(marker_type == 1) // word marker { - current_source_index = q[2] & 0xffffff; + current_source_index = q[1] & 0xffffff; } break;