英纳格手表图片:SAPI-TTS中的事件详解-附英语、汉语音素表

来源:百度文库 编辑:中财网 时间:2024/04/29 22:52:28
TTS中相关事件的解释 本文来自 SAPI5.1 /seasun 整理2007-10-29 TTS 引擎通过 Events结构来把事件信息传递给应用程序。应用程序可以调用ISpEventSource::SetInterest 来设置感兴趣的事件。这个函数也可以通过ISpVoice来调用,因为它是继承ISpEventSource的。程序还可以调用ISpEventSource::GetEvents来获得事件的详细信息。以下是与TTS引擎相关的事件,它是SPEVENTENUM的子集。typedef enum SPEVENTENUM{    //--- TTS engine    SPEI_START_INPUT_STREAM     = 1,    SPEI_END_INPUT_STREAM       = 2,    SPEI_VOICE_CHANGE           = 3,   // LPARAM_IS_TOKEN    SPEI_TTS_BOOKMARK           = 4,   // LPARAM_IS_STRING    SPEI_WORD_BOUNDARY          = 5,    SPEI_PHONEME                = 6,    SPEI_SENTENCE_BOUNDARY      = 7,    SPEI_VISEME                 = 8,    SPEI_TTS_AUDIO_LEVEL        = 9} SPEVENTENUM; SPEVENT结构包含了不同的事件各种信息。
typedef struct SPEVENT
{
    WORD         eEventId;    //与SPEVENTENUM对应
    WORD         elParamType;
    ULONG        ulStreamNum;
    ULONGLONG    ullAudioStreamOffset;
    WPARAM       wParam;
    LPARAM       lParam;
} SPEVENT;
 应用程序可以根据不同的事件类型来分析这些信息。结构体中ulStreamNum是对应于ISpVoice::Speak 或者  ISpVoice::SpeakStream 的返回值。 SPEI_START_INPUT_STREAM 当输出对象开始从一个某个流中获取输出内容时发生此事件,eEventId域等于SPEI_START_INPUT_STREAM其他的域无意义。 SPEI_END_INPUT_STREAM当输出对象从某个流中取得最后的输出内容时,发生此事件。其它域无意义。 SPEI_VOICE_CHANGE:当输入的文本或流被XML标签改变其相关属性时发生此事件;每次调用Speak函数时也会发生此事件。更详细的信息参见Object Tokens and Registry Settings white paper。  SPEVENT FieldVoice Change eventeEventIdSPEI_VOICE_CHANGEelParamTypeSPET_LPARAM_IS_TOKENwParam lParamObject token of the new voice.新语音的记号 SPEI_TTS_BOOKMARK:表示获得一个书签标签事件。可以在输入的文本中插入书签指令.SPEVENT FieldBookmark eventeEventIdSPEI_TTS_BOOKMARKelParamTypeSPET_LPARAM_IS_STRINGwParamValue of the bookmark string when converted to a long (_wtol(...) can be used).书签的文字内容lParamNull-terminated copy of the bookmark string.以空字符结束的书签文本。 SPEI_WORD_BOUNDARY: 当到达一个新单词时发生,即表明一个新单词开始SPEVENT FieldWord Boundary eventeEventIdSPEI_WORD_BOUNDARYelParamTypeSPET_LPARAM_IS_UNKNOWNwParamCharacter offset at the beginning of the word being synthesized.本单词第一个字符在本次合成中的偏移量lParamCharacter length of the word in the current input stream being synthesized本单词的长度。SPEI_SENTENCE_BOUNDARY:一个新句子的边界。SPEVENT FieldSentence Boundary eventeEventIdSPEI_SENTENCE_BOUNDARYelParamTypeSPET_LPARAM_IS_UNKNOWNwParamCharacter offset at the beginning of the sentence being synthesized.一个句子弟一个单词的在本次合成流中的偏移量。lParamCharacter length of the sentence in the current input stream being synthesized。这个句子的长度。 SPEI_PHONEME:一个音素的边界SPEVENT FieldPhoneme eventeEventIdSPEI_PHONEMEelParamTypeSPET_LPARAM_IS_UNKNOWNwParamThe high word is the duration, in milliseconds, of the current phoneme.本音素的时间长度(微妙表示)The low word is the PhoneID of the next phoneme.下一个因素的ID值lParamThe low word is the PhoneID of the current phoneme.当前音素的IDThe high word is the SPVFEATURE value associated with the current phoneme.本因素的特征标记 可以参见后文附表中的音素表。(有美国,中国,日本)低字表示SPVFEATURE,包含两个标志:SPVFEATURE_STRESSED-表示当前音素比本单词中的其他音素要强,通常用在需要重读的元音里面。而SPVFEATURE_EMPHASIS表示这个因素“重读单词”的重音音素。强音(Stress)表示一个单词里面的元音部分重读,而强调音(emphasis)表示一个句子中的某个单词要重读。 SPEI_VISEME:表示到达了一个新的嘴形。(译者:每个单词的发音都需要不同的嘴形配合)。SPEVENT FieldViseme eventeEventIdSPEI_VISEMEelParamTypeSPET_LPARAM_IS_UNKNOWNwParamThe high word is the duration, in milliseconds, of the current viseme.当前嘴形持续的时间 The low word is the code for the next viseme.下一个嘴形的代码lParamThe low word is the code of the current viseme.当前嘴形的代码 The high word is the SPVFEATURE value associated with the current viseme (and phoneme).当前嘴形和音素的特征。详细的viseme 列表请参见 SPVISEMES。(见附录) SPEI_TTS_AUDIO_LEVEL:表示音频到达了一个指定的合成量级。SPEVENT FieldAudio Level eventeEventIdSPEI_TTS_AUDIO_LEVELelParamTypeSPET_LPARAM_IS_UNDEFINEDwParamTTS audio level (ULONG).TTS音频的量级lParamNULL  
附录A:美国英语音素表示本文简述了SAPI中音素表示的应用和实现。 符号与数值表示法 应用程序开发人员可以使用英语的音素表示法,根据以下表格来创建一个字典中没有的新单词的发音方法。音素表是由发音的符号表示组成的。开发者可以使用XML标签 来创建一个新的发音,或者创建一个新的发音字典字典。每个因素之间用空格区分。 标签 作用是插入一个新的发音。比如“Hello”可以用以下标签来表示: 为了更精确,还可以加入重音(1) 和次重音符号(2),以及音节符号 。以下加入了重音符号(1) 和音节符号。 American English Phoneme TableSYMExamplePhoneID-syllable boundary (hyphen)1!Sentence terminator (exclamation mark)2&word boundary3,Sentence terminator (comma)4.Sentence terminator (period)5Sentence terminator (question mark)6_Silence (underscore)71Primary stress82Secondary stress9aafather10aecat11ahcut12aodog13awfoul14axago15aybite16bbig17chchin18ddig19dhthen20ehpet21erfur22eyate23ffork24ggut25hhelp26ihfill27iyfeel28jhjoy29kcut30llid31mmat32nno33ngsing34owgo35oytoy36pput37rred38ssit39shshe40ttalk41ththin42uhbook43uwtoo44vvat45wwith46yyard47zzap48zhpleasure49附录B:汉语的音素表 Chinese PhonemesThe following table defines the Chinese language phoneme set.SymbolPhoneIDExample-1Syllable boundary (hyphen)!2Sentence terminator (exclamation mark)&3word boundary,4Sentence terminator (comma).5Sentence terminator (period)6Sentence terminator (question mark)_7Silence (underscore)+8primary stress*9secondary stress110Tone 1211Tone 2312Tone 3413Tone 4514Tone 5a15a 1 fei 1 (rogue)ai16ai 4 ren 2 (lover)an17an 1 quan 2 (safe)ang18ang 1 zang 1 (dirty)ao19jiao 1 ao 4 (proud)ba20ba 4 ba 5 (dad)bai21bai 2 se 4 (white)ban22mu 4 ban 3 (board)bang23bang 3 jia 4 (kidnap)bao24yong 1 bao 4 (embrace)bei25bei 3 fang 1 (north)ben26ben 4 dan 4 (fool)beng27beng 4 tiao 4 (jump)bi28bi 2 zi 5 (nose)bian29bian 4 hua 5 (change)biao30biao 3 ge 2 (table)bie31li 2 bie 2 (part with)bin32bin 1 ke 4 (guest)bing33shi 4 bing 1 (soldier)bo34bo 2 dou 4 (wrestle)bu35bu 4 xing 2 (walk)ca36ca 1 gan 1 (wipe)cai37cai 1 ce 4 (guess)can38can 1 jia 1 (join)cang39cang 1 ying 5 (fly)cao40cao 1 chang 3 (playground)ce41ce 4 liang 2 (measure)cen42cen 1 ci 1 (uneven)ceng43ceng 2 jing 1 (once)cha44jian 3 cha 2 (check)chai45chai 1 hui 3 (demolish)chan46chan 3 ye 4 (industry)chang47jing 1 chang 2 (often)chao48chao 1 yue 4 (exceed)che49qi 4 che 1 (automobile)chen50chen 2 jiu 4 (old)cheng51cheng 2 che 1 (ride)chi52chi 2 dao 4 (late for)chong53chong 1 man 3 (full of)chou54chou 2 hen 4 (hatred)chu55chu 2 fa 3 (division)chuai56chuai 3 ce 4 (guess)chuan57lun 2 chuan 2 (ship)chuang58chuang 4 ye 4 (carve out)chui59tie 3 chui 2 (hammer)chun60chun 1 tian 1 (spring)chuo61wo 4 chuo 4 (dirty)ci62ci 2 qi 4 (porcelain)cong63cong 2 lin 2 (thicket)cou64jin 3 cou 4 (compact)cu65cu 4 xiao 1 (sales promotion)cuan66tao 2 cuan 4 (run away)cui67cui 1 cu 4 (press)cun68xiang 1 cun 1 (country)cuo69cuo 4 wu 4 (error)da70da 4 (big)dai71dai 4 biao 3 (delegate)dan72dan 4 shi 4 (but)dang73dang 1 ran 2 (sure)dao74dao 1 (knife)de75de 5 (function word)dei76dei 3 (must)den77den 4 (yank)deng78ban 3 deng 4 (wooden stool)di79di 2 que 4 (certainly)dia80dia 3 (coquetry voice)dian81dian 3 (dot)diao82diao 4 (hang)die83die 1 dao 3 (tumble)ding84jue 2 ding 4 (decide)diu85diu 1 qi 4 (discard)dong86dong 1 fang 1 (east)dou87zhan 4 dou 4 (struggle)du88du 4 jue 2 (stop)duan89duan 3 (short)dui90dui 4 (right)dun91ting 2 dun 4 (halt)duo92duo 1 yu 2 (unnecessary)e93e 4 (hungry)ei94ei 4 (yes)en95en 1 hui 4 (favor)er96er 3 (ear)fa97fa 1 zhan 3 (development)fan98fan 4 (rice)fang99fang 2 jian 1 (room)fei100fei 1 (fly)fen101fen 1 bie 2 (separate)feng102feng 1 (wind)fo103fo 2 (buddha)fou104fou 3 ding 4 (denial)fu105fu 4 qin 1 (father)ga106gan 1 ga 4 (awkward)gai107ying 1 gai 1 (should)gan108gan 1 jing 4 (neatness)gang109gang 1 cai 2 (just)gao110gao 1 (tall)ge111pin 3 ge 2 (character)gei112gei 3 yu 3 (give)gen113gen 1 (root)geng114geng 4 jia 1 (much more)gong115gong 1 ren 2 (worker)gou116zu 2 gou 4 (enough)gu117gu 4 xiang 1 (hometown)gua118xi 1 gua 1 (watermelon)guai119qi 2 guai 4 (oddness)guan120guan 1 bi 4 (close)guang121guang 1 (light)gui122gui 3 (ghost)gun123gun 4 (stick)guo124guo 4 qu 4 (past)ha125ha 1 (sound of laugh)hai126hai 2 zi 5 (child)han127chu 1 han 4 (sweat)hang128hang 2 xing 2 (sail)hao129hao 3 (good)he130he 2 (river)hei131hei 1 (black)hen132hen 3 (very)heng133heng 2 xiang 4 (landscape orientation)hong134hong 2 (red)hou135hou 2 zi 5 (monkey)hu136hu 2 xu 1 (beard)hua137hua 4 (picture)huai138huai 4 (bad)huan139huan 2 jing 4 (environment)huang140huang 2 se 4 (yellow)hui141hui 1 huang 2 (refulgence)hun142hun 2 zhuo 2 (muddy)huo143huo 3 (fire)ji144ji 2 shi 2 (in time)jia145jia 4 qi 1 (holiday)jian146jian 3 dan 1 (simple)jiang147jiang 1 (river)jiao148jiao 1 tong 1 (traffic)jie149jie 2 ri 4 (feast)jin150jin 3 zhang 1 (strain)jing151gan 1 jing 4 (neatness)jiong152jiong 3 po 4 (embarrassed)jiu153jiu 3 (nine)ju154ju 4 zi 5 (sentence)juan155juan 3 qu 1 (curl)jue156jue 2 ding 4 (decide)jun157jun 1 dui 4 (army)ka158ka 3 che 1 (truck)kai159kai 3 xuan 2 (triumph)kan160kan 4 (see)kang161di 3 kang 4 (resist)kao162kao 3 shi 4 (test)ke163ke 3 (thirsty)kei164kei 1 (scold)ken165ken 3 ding 4 (affirm)keng166keng 1 hai 4 (entrap)kong167kong 1 qi 4 (air)kou168kou 3 (mouth)ku169jian 1 ku 3 (trial)kua170kua 1 jiang 3 (praise)kuai171kuai 4 (fast)kuan172kuan 1 kuo 4 (openness)kuang173kong 1 kuang 4 (void)kui174kui 1 qian 4 (owe)kun175kun 4 nan 2 (hard)kuo176kuo 4 da 4 (enlarge)la177la 4 jiao 1 (hot pepper)lai178lai 2 (come)lan179lan 2 se 4 (blue)lang180lang 2 (wolf)lao181lao 3 (old)le182kuai 4 le 4 (happy)lei183lei 2 (thunder)leng184leng 3 ku 4 (steeliness)li185li 2 (pear)lia186lia 2 (two)lian187lian 3 (face)liang188li 4 liang 4 (power)liao189zuo 2 liao 4 (seasoning)lie190lin 3 lie 4 (severe)lin191lin 3 lie 4 (severe)ling192ling 2 mu 4 (mausoleum)liu193liu 2 dong 4 (flow)lo194lo 5 (function word)long195long 2 (dragon)lou196lou 4 (leak)lu197lu 4 di 4 (land)luan198hun 4 luan 4 (chaos)lue199ce 4 lue 4 (tactic)lun200yi 4 lun 4 (discuss)luo201xia 4 luo 4 (whereabouts)lv202lv 4 se 4 (green)ma203ma 3 (horse)mai204mai 2 zang 4 (bury)man205man 3 zu 2 (satisfy)mang206cong 1 mang 2 (hurry)mao207mao 1 (cat)me208shen 2 me 5 (what)mei209mei 2 you 3 (no)men210wo 3 men 2 (we)meng211meng 4 (dream)mi212hun 1 mi 2 (coma)mian213mian 4 ji 5 (area)miao214miao 4 (temple)mie215mie 4 jue 2 (annihilation)min216ren 2 min 2 (people)ming217ming 2 bai 2 (clearness)miu218huang 1 miu 4 (absurd)mo219mo 4 shui 3 (ink)mou220mou 2 lue 4 (trick)mu221mu 4 biao 1 (target)na222na 4 li 3 (there)nai223nai 3 nai 5 (grandmother)nan224nan 2 fang 1 (south)nang225nang 2 kuo 4 (include)nao226re 4 nao 4 (liveliness)ne227mu 4 ne 4 (numb)nei228nei 4 bu 4 (inside)nen229nen 4 lv 4 (light green)neng230neng 2 gou 4 (be capable of)ni231ni 3 (you)nian232nian 2 (year)niang233gu 1 niang 5 (girl)niao234niao 3 (bird)nie235nie 4 (bite)nin236nin 2 (you)ning237an 1 ning 2 (peace)niu238niu 2 (bull)nong239nong 2 min 2 (farmer)nou240nou 4 (weeding)nu241nu 3 li 4 (try hard)nuan242wen 1 nuan 3 (warm)nue243nue 4 dai 4 (abuse)nuo244nuo 4 yan 2 (promise)nv245nv 3 zi 3 (woman)o246o 5 (function word)ou247ou 1 yang 2 (Chinese first name)pa248hai 4 pa 4 (scare)pai249pai 4 qian 3 (send)pan250pan 4 tu 2 (betrayer)pang251pang 2 da 4 (huge)pao252pao 3 (run)pei253pei 2 ban 4 (accompany)pen254pen 2 di 4 (pan)peng255peng 2 pai 4 (surge)pi256pi 2 fu 1 (skin)pian257qi 1 pian 4 (cheat)piao258piao 4 liang 4 (pretty)pie259pie 1 kai 1 (put aside)pin260pin 2 fan 2 (frequency)ping261ping 2 zi 5 (bottle)po262po 4 huai 4 (damage)pou263pou 2 (hold something with cupped hand)pu264pu 2 tao 5 (grape)qi265qi 3 qiu 2 (beg)qia266qia 4 dang 4 (proper)qian267qian 1 xu 1 (humility)qiang268qiang 2 da 4 (powerful)qiao269qiao 3 miao 4 (artifice)qie270xiu 1 qie 4 (shyness)qin271qin 1 zi 4 (oneself)qing272qing 1 song 1 (easy)qiong273qiong 2 (poverty)qiu274qiu 2 fan 4 (prisoner)qu275qu 1 dong 4 (drive)quan276quan 2 bu 4 (all)que277que 4 ding 4 (ensure)qun278qun 2 zhong 4 (crowd)ran279ran 2 hou 4 (then)rang280tu 3 rang 3 (soil)rao281wei 2 rao 4 (surround)re282re 4 (hot)ren283ren 2 lei 4 (human being)reng284reng 2 ran 2 (all the same)ri285ri 4 chu 1 (sunrise)rong286rong 2 yao 4 (glory)rou287niu 2 rou 4 (beef)ru288ru 2 guo 3 (if)ruan289rou 2 ruan 3 (soft)rui290rui 4 zhi 4 (smart)run291shi 1 run 4 (wetness)ruo292ruo 4 xiao 3 (puniness)sa293sa 1 (three)sai294bi 3 sai 4 (compete)san295fen 1 san 4 (disperse)sang296sang 4 (die)sao297da 3 sao 3 (sweep)se298yan 2 se 4 (color)sen299sen 1 lin 2 (forest)seng300seng 1 lv 3 (monk)sha301sha 1 chang 3 (battlefield)shai302ri 4 shai 4 (be exposed to the sun)shan303shan 4 liang 2 (goodness)shang304shang 4 mian 4 (top)shao305shao 4 nian 2 (youth)she306she 2 (snake)shei307shei 2 (who)shen308shen 2 me 5 (what)sheng309sheng 1 yin 1 (voice)shi310shi 4 fei 1 (dispute)shou311shou 3 (hand)shu312shu 4 mu 4 (tree)shua313shua 1 zi 5 (brush)shuai314shuai 1 da 3 (beat)shuan315men 2 shuan 1 (latch)shuang316shuang 1 (pair)shui317shui 3 (water)shun318shun 4 li 4 (all right)shuo319shuo 1 (say)si320si 4 (four)song321song 4 bie 2 (send-off)sou322sou 1 cha 2 (search)su323su 4 du 4 (speed)suan324suan 4 fa 3 (arithmetic)sui325sui 1 ran 2 (though)sun326sun 3 shi 1 (loss)suo327suo 3 yi 3 (so)ta328ta 1 men 2 (they)tai329tai 4 (too)tan330tan 2 hua 4 (talk)tang331tang 2 (sugar)tao332tao 2 pao 3 (flee)te333te 4 bie 2 (special)tei334tei 1 (very)teng335ben 1 teng 2 (riot)ti336ti 1 zi 5 (ladder)tian337tian 1 (sky)tiao338tiao 4 yue 4 (jump)tie339tie 3 (iron)ting340ting 1 (listen)tong341tong 3 yi 1 (unify)tou342tou 2 (head)tu343tu 3 di 4 (earth)tuan344tuan 2 jie 2 (solidify)tui345tui 1 dong 4 (push)tun346tun 2 ji 1 (store up)tuo347tuo 1 yi 1 (undress)wa348qing 1 wa 1 (frog)wai349wai 4 mian 4 (outside)wan350wan 4 (ten thousands)wang351si 3 wang 2 (death)wei352wei 3 da 4 (great)wen353wen 2 hua 4 (culture)weng354lao 3 weng 1 (oldman)wo355wo 3 (I)wu356wu 2 lun 4 (no matter what)xi357xi 1 fang 1 (west)xia358xia 4 mian 4 (bottom)xian359xian 4 zai 4 (now)xiang360xiang 4 (like)xiao361xiao 3 (small)xie362xie 3 (write)xin363xin 1 (new)xing364xing 2 dong 4 (act)xiong365xiong 2 (bear)xiu366xiu 1 xi 5 (break)xu367xu 1 yao 4 (need)xuan368xuan 1 bu 4 (declare)xue369xue 3 (snow)xun370xun 2 wen 4 (ask for)ya371ya 4 zhou 1 (Asia)yan372yan 4 zi 5 (swallow)yang373tai 4 yang 2 (sun)yao374yao 1 qiu 2 (require)ye375ye 2 ye 5 (grandfather)yi376yi 1 (one)yin377yin 1 yue 4 (music)ying378ying 1 gai 1 (should)yo379yo 5 (function word)yong380yong 3 yuan 3 (forever)you381you 2 yu 2 (due to)yu382yu 2 (fish)yuan383yuan 2 lai 2 (formerly)yue384yue 4 (month)yun385yun 2 (cloud)za386za 2 luan 4 (disorder)zai387zai 4 jian 4 (farewell)zan388zan 2 men 5 (our)zang389ang 1 zang 1 (dirty)zao390zao 3 chen 2 (morning)ze391ze 2 ren 4 (response)zei392zei 2 (thief)zen393zan 4 yang 2 (praise)zeng394zeng 1 jia 1 (add)zha395zha 4 dan 4 (bomb)zhai396qian 4 zhai 4 (owe)zhan397zhan 4 li 4 (stand)zhang398zhang 1 kai 1 (open)zhao399zhao 1 huan 4 (summon)zhe400zhe 4 li 3 (here)zhei401zhei 5 (this)zhen402zhen 1 zheng 4 (real)zheng403zheng 4 yi 4 (justice)zhi404yi 4 zhi 4 (restrain)zhong405zhong 1 guo 2 (China)zhou406si 4 zhou 1 (around)zhu407zhu 1 (pig)zhua408zhua 1 (grab)zhuai409zhuai 4 (pull)zhuan410zhuan 1 (brick)zhuang411zhuang 1 (pretend)zhui412zhui 1 (chase)zhun413zhun 3 (precise)zhuo414zhuo 1 (table)zi415zi 4 (character)zong416zong 3 (total)zou417zou 3 (walk)zu418zu 1 (rent)zuan419zuan 4 (diamond)zui420zui 4 (most)zun421zun 1 (respect)zuo422zuo 4 (sit)  
附录C:嘴型集合SPVISEMES列出了SAPI5的嘴型。这些发音嘴型是建立在迪斯尼的13个嘴形之上的。