Add API function: espeak_TextToPhonemes(). git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@349 d46cf337-b52f-0410-862d-fd96e6ae7743master
ts v x z | ts v x z | ||||
Dictionary en_dict 2013-04-25 | |||||
Dictionary en_dict 2013-04-26 | |||||
0 0# 3 3: @ @- @2 @5 | 0 0# 3 3: @ @- @2 @5 | ||||
@L a a# A: A@ aa aI aI3 | @L a a# A: A@ aa aI aI3 | ||||
ts; v w x z Z Z; | ts; v w x z Z Z; | ||||
Dictionary pt_dict 2013-04-25 | |||||
Dictionary pt_dict 2013-04-26 | |||||
& &/ &U~ &~ @ @- a A | & &/ &U~ &~ @ @- a A | ||||
aI aU e E eI EI eU EU | aI aU e E eI EI eU EU |
_¡ %Inv,3:tI2dEkskl@m'eIS@n | _¡ %Inv,3:tI2dEkskl@m'eIS@n | ||||
_¦ broUk@nb'A@ | _¦ broUk@nb'A@ | ||||
_¨ daIa#r'i:sIs | _¨ daIa#r'i:sIs | ||||
_ª fEmI2nIn'O@dI2n@L | |||||
_« lEft'gIl@mEt | _« lEft'gIl@mEt | ||||
_ makr0n | _ makr0n | ||||
² tu: | |||||
³ Tri: | |||||
_¹ su:p@skrIptw'0n | |||||
_² su:p@skrIptt'u: | |||||
_³ su:p@skrIptT'ri: | |||||
² tu: $native | |||||
³ Tri: $native | |||||
_´ a#kju:taksEnt | _´ a#kju:taksEnt | ||||
_· mId@Ld0t | _· mId@Ld0t | ||||
_¸ sEd'Il@ | _¸ sEd'Il@ | ||||
//_º maskjUlIn'O@dI2n@L | |||||
_º dI2gr'i:z | |||||
_» raIt'gIl@mEt | _» raIt'gIl@mEt | ||||
_¿ %Inv,3:tI2dkw'EstS@n | _¿ %Inv,3:tI2dkw'EstS@n | ||||
foyer fOIeI | foyer fOIeI | ||||
freelance fri:laans | freelance fri:laans | ||||
freon fri:0n | freon fri:0n | ||||
frequent frI2kwEnt $verb | |||||
fricassee frIka#seI | fricassee frIka#seI | ||||
frigate frIg@t | frigate frIg@t | ||||
fringer frIndZ3 // infringer | fringer frIndZ3 // infringer | ||||
Andre 0ndreI | Andre 0ndreI | ||||
Andrea andri@ | Andrea andri@ | ||||
Andreas A:ndr'eI@s | Andreas A:ndr'eI@s | ||||
Angela $1 | |||||
Angela ang@l@ | |||||
Anita $alt3 | Anita $alt3 | ||||
Anthony ant@ni | Anthony ant@ni | ||||
Anton ant0n | Anton ant0n |
ery (A 3j | ery (A 3j | ||||
_v) ery ErI2 | _v) ery ErI2 | ||||
qu) ery i@rI | qu) ery i@rI | ||||
_x) er (o i@r | |||||
z) er (o i@r | z) er (o i@r | ||||
_C) er (o_ i@r | _C) er (o_ i@r | ||||
er (rA E | er (rA E |
doce $alt2 | doce $alt2 | ||||
doutora $alt2 | doutora $alt2 | ||||
doze $alt2 | doze $alt2 | ||||
droga $alt | |||||
dueto $alt2 | dueto $alt2 | ||||
elixir eliSir | elixir eliSir | ||||
emprego $alt2 $noun | emprego $alt2 $noun | ||||
rota $alt $noun | rota $alt $noun | ||||
rubores $alt2 | rubores $alt2 | ||||
rumores $alt2 | rumores $alt2 | ||||
sabonete $alt2 | |||||
sabonete $alt2 | |||||
sabores $alt2 | sabores $alt2 | ||||
saibro s'aIbRU | saibro s'aIbRU | ||||
saleta $alt2 | saleta $alt2 | ||||
?1 line l'ain | ?1 line l'ain | ||||
layout l'eI,aUt | layout l'eI,aUt | ||||
?2 login logiN | ?2 login logiN | ||||
?2 logo l'OgU | |||||
?1 lock l'Ok | ?1 lock l'Ok | ||||
mail m'eIl | mail m'eIl | ||||
mails m'eIls | mails m'eIls |
i) e (r_ E | i) e (r_ E | ||||
@s) e (r_ E | @s) e (r_ E | ||||
qu) e (r_ E | |||||
qu) e (r_ E | |||||
ib) e (rL04_ E | ib) e (rL04_ E | ||||
d) e (rL04_ E | d) e (rL04_ E | ||||
f) e (rL02_ E | f) e (rL02_ E | ||||
e (quL02_ E | e (quL02_ E | ||||
e (rbL04_ E | |||||
e (rbL04_ E | |||||
e (rgL04_ E | e (rgL04_ E | ||||
e (rsL04_ E | e (rsL04_ E | ||||
e (ssL04_ E | e (ssL04_ E | ||||
e (ss_ E // stress and english words | e (ss_ E // stress and english words | ||||
?2 ection (_ 'EkS&~N | ?2 ection (_ 'EkS&~N | ||||
?2 ee (n_ i | |||||
?2 ee (n_ i | |||||
e (stL04_ E | e (stL04_ E | ||||
e (strL04_ E | e (strL04_ E | ||||
tiv) e (L05_ E // es- | tiv) e (L05_ E // es- | ||||
viv) e (L05_ e | viv) e (L05_ e | ||||
_com) e (L05_ e | _com) e (L05_ e | ||||
s_colh) e (res_ E | |||||
_cos) e (L05_ e | _cos) e (L05_ e | ||||
_pud) e (L05_ E | _pud) e (L05_ E | ||||
_coub) e (L05_ E | _coub) e (L05_ E | ||||
_interromp) e (L07_ e | _interromp) e (L07_ e | ||||
_troux) e (L07_ E | _troux) e (L07_ E | ||||
_ens) e (bL03_ E | _ens) e (bL03_ E | ||||
_enver) e (dL03_ E | |||||
_amanc) e (bL03_ E | _amanc) e (bL03_ E | ||||
qu) e (brL04_ E | qu) e (brL04_ E | ||||
_cel) e (brL04_ E | _cel) e (brL04_ E | ||||
_boch) e (chL04_ e | _boch) e (chL04_ e | ||||
_on) e (rL04_ E | |||||
_ex) e (crL04_ E | |||||
_ex) e (crL04_ E | |||||
_enr) e (dL01_ E | _enr) e (dL01_ E | ||||
_v) e (dL03_ E | _v) e (dL03_ E | ||||
_arr) e (dL03_ E | _arr) e (dL03_ E | ||||
_depr) e (dL03_ E | _depr) e (dL03_ E | ||||
_hosp) e (dL03_ E | _hosp) e (dL03_ E | ||||
_enver) e (dL03_ E | |||||
_gr) e (gL03_ e | _gr) e (gL03_ e | ||||
_gal) e (gL03_ e | _gal) e (gL03_ e | ||||
_pel) e (gL03_ e | _pel) e (gL03_ e | ||||
_g) e (rL04_ E | _g) e (rL04_ E | ||||
_z) e (rL04_ E | _z) e (rL04_ E | ||||
qu) e (rL04_ E // re- | qu) e (rL04_ E // re- | ||||
_on) e (rL04_ E | |||||
_op) e (rL04_ E | _op) e (rL04_ E | ||||
gen) e (rL04_ E // de- re- | gen) e (rL04_ E // de- re- | ||||
_alt) e (rL04_ E | _alt) e (rL04_ E | ||||
_persev) e (rL04_ E | _persev) e (rL04_ E | ||||
_recup) e (rL04_ E | _recup) e (rL04_ E | ||||
_refrig) e (rL04_ E | _refrig) e (rL04_ E | ||||
_ex) e (rcL02_ E | |||||
_ex) e (rcL02_ E | |||||
_alic) e (rcL02_ E | _alic) e (rcL02_ E | ||||
_p) e (rdL02_ E | _p) e (rdL02_ E | ||||
_l) e (rdL03_ E | _l) e (rdL03_ E | ||||
_h) e (rdL04_ E | _h) e (rdL04_ E | ||||
_des) e (rdL04_ E | _des) e (rdL04_ E | ||||
s_colh) e (res_ E | |||||
_) e (rgL03_ e | _) e (rgL03_ e | ||||
_so) e (rgL03_ e | |||||
_re) e (rgL03_ e | _re) e (rgL03_ e | ||||
_so) e (rgL03_ e | |||||
_bez) e (rrL03_ e | _bez) e (rrL03_ e | ||||
v) e (rtL03_ e // con- re- in- | v) e (rtL03_ e // con- re- in- | ||||
_f) e (rvL03_ e | _f) e (rvL03_ e | ||||
óCC) o (CA_ o | óCC) o (CA_ o | ||||
úC) o (CA_ o | úC) o (CA_ o | ||||
úCC) o (CA_ o | úCC) o (CA_ o | ||||
?2 otion (_ 'owS&~N | |||||
?2 otion (_ 'owS&~N | |||||
//sort | //sort | ||||
_f) o (L05_ o | _f) o (L05_ o | ||||
_pormen) o (L05_ O | _pormen) o (L05_ O | ||||
_esn) o (bL04_ O | _esn) o (bL04_ O | ||||
_engl) o (bL04_ O | _engl) o (bL04_ O | ||||
_sal) o (brL03_ o | _sal) o (brL03_ o | ||||
_env) o (ltL03_ o | |||||
_) o (cL03_ o | _) o (cL03_ o | ||||
_m) o (fL01_ O | _m) o (fL01_ O | ||||
_m) o (fL02_ O | _m) o (fL02_ O | ||||
_s) o (frL02_ O | _s) o (frL02_ O | ||||
l) o (gL04_ O // dialoga, etc. | |||||
r) o (gL04_ O // inter- | r) o (gL04_ O // inter- | ||||
v) o (gL04_ O // advoga, etc. | |||||
_j) o (gL04_ O | _j) o (gL04_ O | ||||
af) o (gL04_ O // des- | af) o (gL04_ O // des- | ||||
_adv) o (gL04_ O | |||||
_ref) o (gL04_ O | _ref) o (gL04_ O | ||||
_ap) oi (L01_ OI | _ap) oi (L01_ OI | ||||
_ap) oi (L02_ OI | _ap) oi (L02_ OI | ||||
_emp) o (lgL04_ O | _emp) o (lgL04_ O | ||||
_) o (lhL04_ O | _) o (lhL04_ O | ||||
m) o (lhL04_ O | m) o (lhL04_ O | ||||
_env) o (ltL03_ o | |||||
ent) o (pL02_ O | ent) o (pL02_ O | ||||
_c) o (pL03_ O | _c) o (pL03_ O | ||||
_t) o (pL04_ O | _t) o (pL04_ O | ||||
u (a u | u (a u | ||||
g) u (a+ w | g) u (a+ w | ||||
q) u (a+ w | q) u (a+ w | ||||
u (eC u | |||||
u (ei u | |||||
u (eC u | |||||
u (ei u | |||||
r) u (_A u | r) u (_A u | ||||
u (L04_ 'u | u (L04_ 'u | ||||
ui (_ 'uI | ui (_ 'uI | ||||
u (iu w | u (iu w | ||||
u (iCK u | u (iCK u | ||||
u (éC u | |||||
u (íC u | |||||
u (éC u | |||||
u (íC u | |||||
uy uI | uy uI | ||||
ul (K uw | ul (K uw | ||||
u (lh+ u | u (lh+ u | ||||
g) u (Y | g) u (Y | ||||
_m) ui (tA_ 'wiN | _m) ui (tA_ 'wiN | ||||
?2 ution (_ 'uS&~N | |||||
?2 ution (_ 'uS&~N | |||||
.group ú | .group ú |
[Setup] | [Setup] | ||||
AppName=eSpeak | AppName=eSpeak | ||||
AppVerName=eSpeak version 1.47.06 | |||||
AppVerName=eSpeak version 1.47.08 | |||||
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.47.06 | |||||
AppVerName=eSpeakEdit version 1.47.08 | |||||
DefaultDirName={pf}\eSpeak | DefaultDirName={pf}\eSpeak | ||||
DefaultGroupName=eSpeak | DefaultGroupName=eSpeak | ||||
OutputBaseFilename=setup_espeakedit | OutputBaseFilename=setup_espeakedit |
{"$stem", 0x30}, // must have a suffix | {"$stem", 0x30}, // must have a suffix | ||||
{"$atend", 0x31}, // use this pronunciation if at end of clause | {"$atend", 0x31}, // use this pronunciation if at end of clause | ||||
{"$atstart", 0x32}, // use this pronunciation at start of clause | {"$atstart", 0x32}, // use this pronunciation at start of clause | ||||
{"$native", 0x33}, // not if we've switched translators | |||||
// doesn't set dictionary_flags | // doesn't set dictionary_flags | ||||
{"$?", 100}, // conditional rule, followed by byte giving the condition number | {"$?", 100}, // conditional rule, followed by byte giving the condition number |
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if(dictionary_flags2 & FLAG_NATIVE) | |||||
{ | |||||
if(tr != translator) | |||||
continue; // don't use if we've switched translators | |||||
} | |||||
if(dictionary_flags & FLAG_ALT2_TRANS) | if(dictionary_flags & FLAG_ALT2_TRANS) | ||||
{ | { | ||||
// language specific | // language specific |
EVT_MENU(MENU_OPT_SPEED, MyFrame::OnOptions) | EVT_MENU(MENU_OPT_SPEED, MyFrame::OnOptions) | ||||
EVT_MENU(MENU_OPT_PUNCT, MyFrame::OnOptions) | EVT_MENU(MENU_OPT_PUNCT, MyFrame::OnOptions) | ||||
EVT_MENU(MENU_OPT_SPELL, MyFrame::OnOptions) | EVT_MENU(MENU_OPT_SPELL, MyFrame::OnOptions) | ||||
EVT_MENU(MENU_OPT_SPELL2, MyFrame::OnOptions) | |||||
EVT_MENU(MENU_PATH0, MyFrame::OnOptions) | EVT_MENU(MENU_PATH0, MyFrame::OnOptions) | ||||
EVT_MENU(MENU_PATH1, MyFrame::OnOptions) | EVT_MENU(MENU_PATH1, MyFrame::OnOptions) | ||||
EVT_MENU(MENU_PATH2, MyFrame::OnOptions) | EVT_MENU(MENU_PATH2, MyFrame::OnOptions) | ||||
break; | break; | ||||
case MENU_OPT_SPELL: | case MENU_OPT_SPELL: | ||||
transldlg->t_source->SetValue(_T("<say-as interpret-as=\"characters\">\n")); | |||||
transldlg->t_source->SetInsertionPointEnd(); | |||||
notebook->SetSelection(1); | |||||
break; | |||||
case MENU_OPT_SPELL2: | |||||
transldlg->t_source->SetValue(_T("<say-as interpret-as=\"tts:char\">\n")); | transldlg->t_source->SetValue(_T("<say-as interpret-as=\"tts:char\">\n")); | ||||
transldlg->t_source->SetInsertionPointEnd(); | transldlg->t_source->SetInsertionPointEnd(); | ||||
notebook->SetSelection(1); | notebook->SetSelection(1); |
MENU_OPT_SPEED, | MENU_OPT_SPEED, | ||||
MENU_OPT_PUNCT, | MENU_OPT_PUNCT, | ||||
MENU_OPT_SPELL, | MENU_OPT_SPELL, | ||||
MENU_OPT_SPELL2, | |||||
MENU_PATHS, | MENU_PATHS, | ||||
MENU_PATH0, | MENU_PATH0, | ||||
MENU_PATH1, | MENU_PATH1, |
option_menu = new wxMenu; | option_menu = new wxMenu; | ||||
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu); | option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu); | ||||
option_menu->Append(MENU_OPT_SPEED, _("Speed...")); | option_menu->Append(MENU_OPT_SPEED, _("Speed...")); | ||||
option_menu->AppendSeparator(); | |||||
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctuation")); | option_menu->Append(MENU_OPT_PUNCT, _("Speak punctuation")); | ||||
option_menu->Append(MENU_OPT_SPELL, _("Speak character names")); | |||||
option_menu->Append(MENU_OPT_SPELL, _("Speak characters")); | |||||
option_menu->Append(MENU_OPT_SPELL2, _("Speak character name")); | |||||
// TOOLS | // TOOLS | ||||
vowelchart_menu = new wxMenu; | vowelchart_menu = new wxMenu; |
} | } | ||||
} | } | ||||
letter = towlower2(letter); | letter = towlower2(letter); | ||||
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1); | |||||
// is this a subscript or superscript letter ? | |||||
for(ix=0; (c = derived_letters[ix]) != 0; ix+=2) | |||||
if(ph_buf[0] == 0) | |||||
{ | { | ||||
if(c > letter) | |||||
break; | |||||
if(c == letter) | |||||
// is this a subscript or superscript letter ? | |||||
for(ix=0; (c = derived_letters[ix]) != 0; ix+=2) | |||||
{ | { | ||||
c = derived_letters[ix+1]; | |||||
letter = c & 0x3fff; | |||||
if((modifier = modifiers[c >> 14]) != NULL) | |||||
if(c > letter) | |||||
break; | |||||
if(c == letter) | |||||
{ | { | ||||
Lookup(tr, modifier, capital); | |||||
if(capital[0] == 0) | |||||
c = derived_letters[ix+1]; | |||||
letter = c & 0x3fff; | |||||
if((modifier = modifiers[c >> 14]) != NULL) | |||||
{ | { | ||||
capital[2] = SetTranslator2("en"); // overwrites previous contents of translator2 | |||||
Lookup(translator2, modifier, &capital[3]); | |||||
if(capital[3] != 0) | |||||
Lookup(tr, modifier, capital); | |||||
if(capital[0] == 0) | |||||
{ | { | ||||
capital[0] = phonPAUSE; | |||||
capital[1] = phonSWITCH; | |||||
len = strlen(&capital[3]); | |||||
capital[len+3] = phonSWITCH; | |||||
capital[len+4] = phontab_1; | |||||
capital[len+5] = 0; | |||||
capital[2] = SetTranslator2("en"); // overwrites previous contents of translator2 | |||||
Lookup(translator2, modifier, &capital[3]); | |||||
if(capital[3] != 0) | |||||
{ | |||||
capital[0] = phonPAUSE; | |||||
capital[1] = phonSWITCH; | |||||
len = strlen(&capital[3]); | |||||
capital[len+3] = phonSWITCH; | |||||
capital[len+4] = phontab_1; | |||||
capital[len+5] = 0; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1); | |||||
} | } | ||||
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1); | |||||
if(ph_buf[0] == phonSWITCH) | if(ph_buf[0] == phonSWITCH) | ||||
{ | { |
return(towupper(c)); | return(towupper(c)); | ||||
// check whether a previous character code is the upper-case equivalent of this character | // check whether a previous character code is the upper-case equivalent of this character | ||||
if(towlower2(c-32) == c) | |||||
if(towlower2(c-32) == (int)c) | |||||
return(c-32); // yes, use it | return(c-32); // yes, use it | ||||
if(towlower2(c-1) == c) | |||||
if(towlower2(c-1) == (int)c) | |||||
return(c-1); | return(c-1); | ||||
for(ix=0; wchar_toupper[ix] != 0; ix+=2) | for(ix=0; wchar_toupper[ix] != 0; ix+=2) | ||||
{ | { | ||||
if(wchar_toupper[ix] == c) | |||||
if(wchar_toupper[ix] == (int)c) | |||||
return(wchar_toupper[ix+1]); | return(wchar_toupper[ix+1]); | ||||
} | } | ||||
return(c); // no | return(c); // no |
ESPEAK_API void espeak_TextToPhonemes(const void *text, char *buffer, int size, int textmode, int phonememode) | ESPEAK_API void espeak_TextToPhonemes(const void *text, char *buffer, int size, int textmode, int phonememode) | ||||
{//============================================================================================================== | {//============================================================================================================== | ||||
/* phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator | /* phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator | ||||
bit 4: 0=eSpeak phoneme names, 1=IPA | |||||
bits 4-7: 0=eSpeak phoneme names, 1=IPA | |||||
*/ | */ | ||||
option_multibyte = textmode & 7; | option_multibyte = textmode & 7; | ||||
TranslateClause(translator, NULL, text, NULL, NULL); | TranslateClause(translator, NULL, text, NULL, NULL); |
Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics. | 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. | Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names. | ||||
Revision 8 26.Apr.2013 | |||||
Added function espeak_TextToPhonemes(). | |||||
*/ | */ | ||||
/********************/ | /********************/ | ||||
/* Initialization */ | /* Initialization */ | ||||
char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes. | char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes. | ||||
} id; | } id; | ||||
} espeak_EVENT; | } espeak_EVENT; | ||||
/* | |||||
/* | |||||
When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called. | When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called. | ||||
In PLAYBACK mode, the callback function is called as soon as an event happens. | In PLAYBACK mode, the callback function is called as soon as an event happens. | ||||
For example suppose that the following message is supplied to espeak_Synth: | |||||
For example suppose that the following message is supplied to espeak_Synth: | |||||
"hello, hello." | "hello, hello." | ||||
* Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function : | * Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function : | ||||
** Block 1: | ** Block 1: | ||||
<audio data> + | |||||
<audio data> + | |||||
List of events: SENTENCE + WORD + LIST_TERMINATED | List of events: SENTENCE + WORD + LIST_TERMINATED | ||||
** Block 2: | ** Block 2: | ||||
<audio data> + | <audio data> + | ||||
List of events: WORD + END + LIST_TERMINATED | List of events: WORD + END + LIST_TERMINATED | ||||
typedef enum { | typedef enum { | ||||
/* PLAYBACK mode: plays the audio data, supplies events to the calling program*/ | /* PLAYBACK mode: plays the audio data, supplies events to the calling program*/ | ||||
AUDIO_OUTPUT_PLAYBACK, | |||||
AUDIO_OUTPUT_PLAYBACK, | |||||
/* RETRIEVAL mode: supplies audio data and events to the calling program */ | /* RETRIEVAL mode: supplies audio data and events to the calling program */ | ||||
AUDIO_OUTPUT_RETRIEVAL, | AUDIO_OUTPUT_RETRIEVAL, | ||||
/* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */ | /* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */ | ||||
AUDIO_OUTPUT_SYNCHRONOUS, | AUDIO_OUTPUT_SYNCHRONOUS, | ||||
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback); | ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback); | ||||
/* Must be called before any synthesis functions are called. | /* Must be called before any synthesis functions are called. | ||||
This specifies a function in the calling program which is called when a buffer of | This specifies a function in the calling program which is called when a buffer of | ||||
speech sound data has been produced. | |||||
speech sound data has been produced. | |||||
The callback function is of the form: | The callback function is of the form: | ||||
start of the text. | start of the text. | ||||
position_type: Determines whether "position" is a number of characters, words, or sentences. | position_type: Determines whether "position" is a number of characters, words, or sentences. | ||||
Values: | |||||
Values: | |||||
end_position: If set, this gives a character position at which speaking will stop. A value | end_position: If set, this gives a character position at which speaking will stop. A value | ||||
of zero indicates no end position. | of zero indicates no end position. | ||||
espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language. | espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language. | ||||
espeakCHARS_AUTO 8 bit or UTF8 (this is the default) | espeakCHARS_AUTO 8 bit or UTF8 (this is the default) | ||||
espeakCHARS_WCHAR Wide characters (wchar_t) | espeakCHARS_WCHAR Wide characters (wchar_t) | ||||
espeakCHARS_16BIT 16 bit characters. | |||||
espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored. | espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored. | ||||
espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then | espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then | ||||
this pause is suppressed. | this pause is suppressed. | ||||
unique_identifier: message identifier; helpful for identifying later | |||||
unique_identifier: message identifier; helpful for identifying later | |||||
data supplied to the callback. | data supplied to the callback. | ||||
user_data: pointer which will be passed to the callback function. | user_data: pointer which will be passed to the callback function. | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
For the other parameters, see espeak_Synth() | For the other parameters, see espeak_Synth() | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
If key_name is a single character, it speaks the name of the character. | If key_name is a single character, it speaks the name of the character. | ||||
Otherwise, it speaks key_name as a text string. | Otherwise, it speaks key_name as a text string. | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
extern "C" | extern "C" | ||||
#endif | #endif | ||||
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character); | ESPEAK_API espeak_ERROR espeak_Char(wchar_t character); | ||||
/* Speak the name of the given character | |||||
/* Speak the name of the given character | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal | espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal | ||||
espeakPUNCTUATION: which punctuation characters to announce: | espeakPUNCTUATION: which punctuation characters to announce: | ||||
value in espeak_PUNCT_TYPE (none, all, some), | |||||
value in espeak_PUNCT_TYPE (none, all, some), | |||||
see espeak_GetParameter() to specify which characters are announced. | see espeak_GetParameter() to specify which characters are announced. | ||||
espeakCAPITALS: announce capital letters by: | espeakCAPITALS: announce capital letters by: | ||||
espeakWORDGAP: pause between words, units of 10mS (at the default speed) | espeakWORDGAP: pause between words, units of 10mS (at the default speed) | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
punctlist: A list of character codes, terminated by a zero character. | punctlist: A list of character codes, terminated by a zero character. | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout. | stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout. | ||||
*/ | */ | ||||
#ifdef __cplusplus | |||||
extern "C" | |||||
#endif | |||||
ESPEAK_API void espeak_TextToPhonemes(const void *text, char *buffer, int size, int textmode, int phonememode); | |||||
/* Translates text into phonemes. Call espeak_SetVoiceByName() first, to select a language. | |||||
text: The text to translate, terminated by a zero character. | |||||
buffer: Output buffer for the phoneme translation. | |||||
size: Size of the output buffer in bytes. | |||||
textmode: Type of character codes, one of: | |||||
espeakCHARS_UTF8 UTF8 encoding | |||||
espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language. | |||||
espeakCHARS_AUTO 8 bit or UTF8 (this is the default) | |||||
espeakCHARS_WCHAR Wide characters (wchar_t) | |||||
espeakCHARS_16BIT 16 bit characters. | |||||
phonememode: bits0-3: | |||||
0= just phonemes. | |||||
1= include ties (U+361) for phoneme names of more than one letter. | |||||
2= include zero-width-joiner for phoneme names of more than one letter. | |||||
3= separate phonemes with underscore characters. | |||||
bits 4-7: | |||||
0= eSpeak's ascii phoneme names. | |||||
1= International Phonetic Alphabet (as UTF-8 characters). | |||||
*/ | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" | extern "C" | ||||
#endif | #endif | ||||
unsigned char gender; // 0=none 1=male, 2=female, | unsigned char gender; // 0=none 1=male, 2=female, | ||||
unsigned char age; // 0=not specified, or age in years | unsigned char age; // 0=not specified, or age in years | ||||
unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties | unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties | ||||
unsigned char xx1; // for internal use | |||||
unsigned char xx1; // for internal use | |||||
int score; // for internal use | int score; // for internal use | ||||
void *spare; // for internal use | void *spare; // for internal use | ||||
} espeak_VOICE; | } espeak_VOICE; | ||||
/* Searches for a voice with a matching "name" field. Language is not considered. | /* Searches for a voice with a matching "name" field. Language is not considered. | ||||
"name" is a UTF8 string. | "name" is a UTF8 string. | ||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
Return: EE_OK: operation achieved | |||||
EE_BUFFER_FULL: the command can not be buffered; | |||||
you may try after a while to call the function again. | you may try after a while to call the function again. | ||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
function returns, the audio output is fully stopped and the synthesizer is ready to | function returns, the audio output is fully stopped and the synthesizer is ready to | ||||
synthesize a new message. | synthesize a new message. | ||||
Return: EE_OK: operation achieved | |||||
Return: EE_OK: operation achieved | |||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
#endif | #endif | ||||
ESPEAK_API espeak_ERROR espeak_Synchronize(void); | ESPEAK_API espeak_ERROR espeak_Synchronize(void); | ||||
/* This function returns when all data have been spoken. | /* This function returns when all data have been spoken. | ||||
Return: EE_OK: operation achieved | |||||
Return: EE_OK: operation achieved | |||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
#endif | #endif | ||||
ESPEAK_API espeak_ERROR espeak_Terminate(void); | ESPEAK_API espeak_ERROR espeak_Terminate(void); | ||||
/* last function to be called. | /* last function to be called. | ||||
Return: EE_OK: operation achieved | |||||
Return: EE_OK: operation achieved | |||||
EE_INTERNAL_ERROR. | EE_INTERNAL_ERROR. | ||||
*/ | */ | ||||
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.47.07b 25.Apr.13"; | |||||
const char *version_string = "1.47.08 26.Apr.13"; | |||||
const int version_phdata = 0x014701; | const int version_phdata = 0x014701; | ||||
int option_device_number = -1; | int option_device_number = -1; |
#define FLAG_ONLY 0x4000 | #define FLAG_ONLY 0x4000 | ||||
#define FLAG_ONLY_S 0x8000 | #define FLAG_ONLY_S 0x8000 | ||||
#define FLAG_STEM 0x10000 // must have a suffix | #define FLAG_STEM 0x10000 // must have a suffix | ||||
#define FLAG_ATEND 0x20000 /* use this pronunciation if at end of clause */ | |||||
#define FLAG_ATEND 0x20000 // use this pronunciation if at end of clause | |||||
#define FLAG_ATSTART 0x40000 // use this pronunciation if at start of clause | #define FLAG_ATSTART 0x40000 // use this pronunciation if at start of clause | ||||
#define FLAG_NATIVE 0x80000 // not if we've switched translators | |||||
#define FLAG_LOOKUP_SYMBOL 0x40000000 // to indicate called from Lookup() | #define FLAG_LOOKUP_SYMBOL 0x40000000 // to indicate called from Lookup() | ||||
#define BITNUM_FLAG_ALLCAPS 0x2a | #define BITNUM_FLAG_ALLCAPS 0x2a |