intonation: changed comma intonation for intonation type 2. intonation: adjusted exclamation (make the nuclear syllable emphasized). intonation: split intonation table into body and nucleus parts. lang-zh: only length tones 2,3 at end of sentence. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@137 d46cf337-b52f-0410-862d-fd96e6ae7743master
| E~ i i: o O O~ u W | E~ i i: o O O~ u W | ||||
| w^i W~ y Y | w^i W~ y Y | ||||
| * : ; b c d dZ f | |||||
| g h j k l L m n | |||||
| N n2 n^ p r R s S | |||||
| t t2 tS v w z Z z2 | |||||
| z3 | |||||
| * : ; b c d D dZ | |||||
| f g h j k l L m | |||||
| n N n2 n^ p p2 r R | |||||
| s S t t2 tS v w z | |||||
| Z z2 z3 | |||||
| Dictionary hi_dict | Dictionary hi_dict | ||||
| uai y | uai y | ||||
| (u) : f h j k kh l | (u) : f h j k kh l | ||||
| m n N p ph r s s. | |||||
| S; t th ts ts. ts. tS; tS; | |||||
| tsh v w x z z. | |||||
| m n N p ph r s S# | |||||
| s. S; t th ts ts. ts. tS; | |||||
| tS; tsh v w x z z. | |||||
| Dictionary jbo_dict | Dictionary jbo_dict |
| // 2006-11-18 Gilles Casse <[email protected]> | // 2006-11-18 Gilles Casse <[email protected]> | ||||
| // | // | ||||
| // Updated 2008-01-29 Michel Such <[email protected]> | |||||
| // Updated 2008-02-06 Michel Such <[email protected]> | |||||
| // | // | ||||
| // * Numbers, a few abbreviations and exceptions. | // * Numbers, a few abbreviations and exceptions. | ||||
| // | // | ||||
| ?2 des dez2 $u+ $nounf | ?2 des dez2 $u+ $nounf | ||||
| à $u $brk | |||||
| à $u | |||||
| au $u $brk | au $u $brk | ||||
| aux $u $brk | aux $u $brk | ||||
| pour $u | pour $u | ||||
| en $u | en $u | ||||
| (en effet) A~nEf'E $brk | (en effet) A~nEf'E $brk | ||||
| (en suspens) A~||sysp'A~ | |||||
| vers $u | vers $u | ||||
| avec $u | avec $u | ||||
| consent kO~s'A~t2 | consent kO~s'A~t2 | ||||
| scient si | scient si | ||||
| bénéficient benefisi $verb | bénéficient benefisi $verb | ||||
| charisme karism | |||||
| concurrent kO~kyR'A~ | concurrent kO~kyR'A~ | ||||
| content kO~t@-t2 $verb | content kO~t@-t2 $verb | ||||
| couvent k'uvt2 $verb | couvent k'uvt2 $verb | ||||
| mens mA~z2 | |||||
| sens sA~s | sens sA~s | ||||
| sens sA~z2 $verb | |||||
| c'est sEt2 $u+ | c'est sEt2 $u+ | ||||
| qu'à ka | qu'à ka | ||||
| m'y mi $verbf | m'y mi $verbf | ||||
| boy bOj | boy bOj | ||||
| byte bajt | byte bajt | ||||
| bytes bajts | bytes bajts | ||||
| cleaner kli:n@r | |||||
| (cyber link) sibEr||link | (cyber link) sibEr||link | ||||
| debian dEbjAn | debian dEbjAn | ||||
| driver drajv@rz2 | driver drajv@rz2 | ||||
| emacspeak Emakspi:k | emacspeak Emakspi:k | ||||
| espeak @spi:k | espeak @spi:k | ||||
| ethernet etERnEt | ethernet etERnEt | ||||
| exit egzit | |||||
| firefox faj@RfOks | firefox faj@RfOks | ||||
| (fire wire) faj@R||wajr | |||||
| firewire faj@Rwajr | |||||
| google gu:g'@l | google gu:g'@l | ||||
| girl g@Rl | girl g@Rl | ||||
| gnome gnom | gnome gnom | ||||
| gnu gnu | gnu gnu | ||||
| hamburger _!A~b@rg@r | |||||
| insight insajt | insight insajt | ||||
| internet E~tERnEt | internet E~tERnEt | ||||
| (internet explorer) E~tErn'Et||EksplOr'@r | (internet explorer) E~tErn'Et||EksplOr'@r | ||||
| klaxon klaksOn | |||||
| leader li:d@R | leader li:d@R | ||||
| light lajt | light lajt | ||||
| link link | link link | ||||
| new nj'u | new nj'u | ||||
| news nj'uz | news nj'uz | ||||
| night najt | night najt | ||||
| not nOt | |||||
| ok oke | ok oke | ||||
| open Op'@n | open Op'@n | ||||
| outlook autluk | outlook autluk | ||||
| sun s@n | sun s@n | ||||
| sunlight s@nlajt | sunlight s@nlajt | ||||
| (text aloud) tEkst||@lawd | (text aloud) tEkst||@lawd | ||||
| then DEn $u | |||||
| thunderbird f@ndERb@Rd | thunderbird f@ndERb@Rd | ||||
| ubuntu ubuntu | ubuntu ubuntu | ||||
| update @pd'E:jt | update @pd'E:jt | ||||
| upload @plod | upload @plod | ||||
| viavoice viavOjs | viavoice viavOjs | ||||
| while wajll | |||||
| windows windoz | windows windoz | ||||
| word wWRd | word wWRd | ||||
| wright _^_EN | wright _^_EN | ||||
| // 2006-11-18 Gilles Casse <[email protected]> | // 2006-11-18 Gilles Casse <[email protected]> | ||||
| // | // | ||||
| // Updated: 2008-02-04 Michel Such <[email protected]> | |||||
| // Updated: 2008-02-06 Michel Such <[email protected]> | |||||
| // | // | ||||
| // * The rules are based on Cicero TTS. | // * The rules are based on Cicero TTS. | ||||
| // | // | ||||
| a (il_ a | a (il_ a | ||||
| aie (me E // paiement | aie (me E // paiement | ||||
| ai E // aile | ai E // aile | ||||
| a (lk O // talk | |||||
| a (ll_ O // football handball | |||||
| am (b A~ // jambon | am (b A~ // jambon | ||||
| am (p A~ // camp | am (p A~ // camp | ||||
| am (m a // programmation | am (m a // programmation | ||||
| cch k // bacchanale | cch k // bacchanale | ||||
| cc (Y ks // accéder | cc (Y ks // accéder | ||||
| cc k // occuper | cc k // occuper | ||||
| ar) ch (éo k // archéologue | |||||
| ar) ch (ét k // archétype architecte | ar) ch (ét k // archétype architecte | ||||
| _A) ch (o_ k // écho | _A) ch (o_ k // écho | ||||
| _eu) ch (ari k // eucharistie | |||||
| or) ch (esC k // orchestre | or) ch (esC k // orchestre | ||||
| or) ch (iC k // orchidée | or) ch (iC k // orchidée | ||||
| sy) ch (o k // psycho | sy) ch (o k // psycho | ||||
| _) ch (ao k // chaos, chaotique | |||||
| _) ch (or k // chorale | _) ch (or k // chorale | ||||
| ch (r k // chrétien | ch (r k // chrétien | ||||
| ch (l k | ch (l k | ||||
| Csan) d (_ d | Csan) d (_ d | ||||
| _tan) d (_ d // stand | _tan) d (_ d // stand | ||||
| Ctan) d (_ d | Ctan) d (_ d | ||||
| for) d (_ d | |||||
| lor) d (_ d | |||||
| Can) d (_ t2 // grand ami, grand marchand | Can) d (_ t2 // grand ami, grand marchand | ||||
| Cen) d (_ t2 | Cen) d (_ t2 | ||||
| .group e | .group e | ||||
| e (Ce_ E | e (Ce_ E | ||||
| eau o // bateau cheveaux | eau o // bateau cheveaux | ||||
| Cr) ea (m i: // stream | |||||
| Cl) ea (n i: // clean | |||||
| j) e (a // Jean Jeanne | j) e (a // Jean Jeanne | ||||
| sp) ea (k i: // speak speaker | sp) ea (k i: // speak speaker | ||||
| p) ect (_ E // suspect | p) ect (_ E // suspect | ||||
| _pi) ed e // pied | _pi) ed e // pied | ||||
| ee i: // meeting | ee i: // meeting | ||||
| _cl) ef (_ e // clef | _cl) ef (_ e // clef | ||||
| k) e (r_ @ // maker | |||||
| Ck) e (r_ @ // worker, talker | |||||
| eaC) e (r_ @ // speaker, streamer | |||||
| ooC) e (r_ @ // scooter | |||||
| ein (C E~ // peindre | ein (C E~ // peindre | ||||
| ein (_ E~ | ein (_ E~ | ||||
| e (il E // vieille | e (il E // vieille | ||||
| Ci) en (C E~ // tien | Ci) en (C E~ // tien | ||||
| Ci) en (c A~ // science | Ci) en (c A~ // science | ||||
| _am) en (_ En // amen | |||||
| AA) en (_ E~ | AA) en (_ E~ | ||||
| AC) en (_ E~ // examen | |||||
| C) en (_ En // amen, abdomen, golden | |||||
| xam) en (_ E~ // examen | |||||
| CA) en (_ E~ // rien | CA) en (_ E~ // rien | ||||
| CC) en (_ E~ | |||||
| en (s_ A~ | en (s_ A~ | ||||
| en (CA A~ // pentathlon | en (CA A~ // pentathlon | ||||
| en (CC A~ // entre | en (CC A~ // entre | ||||
| en (ch_ En // french | en (ch_ En // french | ||||
| sp) ens (_ Ens // suspens | |||||
| éC) ens (_ A~z2 // dépens démens | |||||
| _C) er (_ ER // fer | _C) er (_ ER // fer | ||||
| _Ch) er (_ ER // cher | _Ch) er (_ ER // cher | ||||
| _) h (ai _! // haine haillon | _) h (ai _! // haine haillon | ||||
| _) h (al _! // halte | _) h (al _! // halte | ||||
| _) h (amea _! // hameau | _) h (amea _! // hameau | ||||
| _) h (amb _! // hamburger | |||||
| _) h (amp _! // hampe | _) h (amp _! // hampe | ||||
| _) h (an _! // hanche | _) h (an _! // hanche | ||||
| _) h (app _! // happer | _) h (app _! // happer | ||||
| _) h (ibo _! // hibou | _) h (ibo _! // hibou | ||||
| _) h (ide _! // hideux | _) h (ide _! // hideux | ||||
| _) h (oll _! // hollandais | _) h (oll _! // hollandais | ||||
| _) h (oma _! // homard | |||||
| _) h (ong _! // hongrois | _) h (ong _! // hongrois | ||||
| _) h (ont _! // honte | _) h (ont _! // honte | ||||
| _) h (ord _! // horde | _) h (ord _! // horde | ||||
| o (mm O // comme | o (mm O // comme | ||||
| radi) o (C o // radiophonique | radi) o (C o // radiophonique | ||||
| dr) o (me_ O // vélodrome | dr) o (me_ O // vélodrome | ||||
| ph) o (ne_ O // téléphone | |||||
| om (b O~ // bombe | om (b O~ // bombe | ||||
| om (p O~ // pompe | om (p O~ // pompe | ||||
| n) om (_ O~ // nom | n) om (_ O~ // nom | ||||
| onh (A On // bonhomme | onh (A On // bonhomme | ||||
| _b) on (_A On // liaison: bon élève | _b) on (_A On // liaison: bon élève | ||||
| _m) on (_A O~n // mon appui | |||||
| _s) on (_A O~n | |||||
| _t) on (_A O~n | |||||
| _b) on (_h O~n2 // liaison: bon hiver | |||||
| _C) on (_ O~n2 // mon appui, mon histoire, mon havre | |||||
| _c) on (_ O~ // no comment | |||||
| z) o (ne_ o // amazone | z) o (ne_ o // amazone | ||||
| c) o (ne_ o | c) o (ne_ o | ||||
| h) o (ne_ o | h) o (ne_ o | ||||
| ph) o (ne_ O // téléphone | |||||
| r) o (ne_ o | r) o (ne_ o | ||||
| z) o (nes_ o | |||||
| c) o (nes_ o | |||||
| h) o (nes_ o | |||||
| r) o (nes_ o | |||||
| alc) oo (l O // alcool | alc) oo (l O // alcool | ||||
| oo (Ce u // boomer | |||||
| C) oot ut // bootable football | |||||
| z) oo o // zoo | z) oo o // zoo | ||||
| z) oo (l oo // zoologue | |||||
| z) oo (m u // zoom | |||||
| oo (X u // pool | oo (X u // pool | ||||
| _gal) op (_ o // galop | _gal) op (_ o // galop | ||||
| _sir) op (_ o // sirop | _sir) op (_ o // sirop | ||||
| _tr) op (_ o // trop | |||||
| _tr) op (_ op2 // trop | |||||
| v) ost (_ o // Prévost | v) ost (_ o // Prévost | ||||
| o (sA o // poser | o (sA o // poser | ||||
| ot (_ o // mot dépots | ot (_ o // mot dépots | ||||
| c) oup (_ u // beaucoup | |||||
| l) oup (_ u // loups | |||||
| C) ou (nd aw // sound, found | |||||
| _C) oup (_ u // coup, loup | |||||
| uC) oup (_ up2 // beaucoup | |||||
| ou u // hibou brouillard | ou u // hibou brouillard | ||||
| .group q | .group q | ||||
| q k // coq | q k // coq | ||||
| _a) qu (a ku // aquarium | |||||
| _a) qu (if ku // aquifère | |||||
| _a) qu (a kw // aquarium | |||||
| _a) qu (if kw // aquifère | |||||
| _A) qu (idist ky // équidistant | _A) qu (idist ky // équidistant | ||||
| _A) qu (ilat ky // équilatéralt | |||||
| _C) qu (a ku // squale square | |||||
| _A) qu (a ku // équateur | |||||
| _A) qu (ilat ky // équilatéral | |||||
| _C) qu (a kw // squale square | |||||
| _A) qu (a kw // équateur | |||||
| _) qu (artz kw // quartz | |||||
| qu k // quatre | qu k // quatre | ||||
| _) que (_ k@ // que | _) que (_ k@ // que | ||||
| _) qu' (P3 k // qu'il | _) qu' (P3 k // qu'il | ||||
| uc) un (_ W~n2 // aucun | uc) un (_ W~n2 // aucun | ||||
| un (_ W~n2 // un avion | un (_ W~n2 // un avion | ||||
| fl) ux (_ y // flux, reflux | |||||
| g) u (A // fatigue | g) u (A // fatigue | ||||
| g) u (ï y // ambiguïté | g) u (ï y // ambiguïté | ||||
| g) u (ë y // ambiguë | g) u (ë y // ambiguë |
| // (D will match on a digit and also if no digit is present. (special for tone | // (D will match on a digit and also if no digit is present. (special for tone | ||||
| language). | language). | ||||
| // 儿 兒 erhua | |||||
| .group a | .group a | ||||
| a A | a A | ||||
| ai ai | ai ai | ||||
| ue yE //üe | ue yE //üe | ||||
| ui uei | ui uei | ||||
| u (DnK u@ | u (DnK u@ | ||||
| k) u (DnK wu@ | |||||
| _h) u (DnK wu@ | |||||
| t) u (DnK wu@ | |||||
| uo uo | uo uo | ||||
| L01) u y /// j,q,x,y + u | L01) u y /// j,q,x,y + u |
| gender male | gender male | ||||
| dictrules 1 | dictrules 1 | ||||
| intonation 3 | |||||
| intonation 2 |
| name Mandarin test | |||||
| name Mandarin | |||||
| language zh | language zh | ||||
| gender male | gender male | ||||
| words 1 | words 1 | ||||
| pitch 80 118 | |||||
| //for some dialects | //for some dialects | ||||
| //[en]: replace ng with n | //[en]: replace ng with n | ||||
| //[zh]: 无后鼻音,ng读成n | |||||
| //[zh]: 锟睫猴拷锟斤拷锟斤拷锟斤拷ng锟斤拷锟絥 | |||||
| //replace 0 N n | //replace 0 N n | ||||
| //[en]: replace rfx consonants | //[en]: replace rfx consonants | ||||
| //[zh]: 无卷舌音,r读成l或z,er读成e | |||||
| //[zh]: 锟睫撅拷锟斤拷锟斤拷锟斤拷r锟斤拷锟絣锟斤拷z锟斤拷er锟斤拷锟絜 | |||||
| //replace 0 ts.h tsh | //replace 0 ts.h tsh | ||||
| //replace 0 ts. ts | //replace 0 ts. ts | ||||
| //replace 0 s. s | //replace 0 s. s | ||||
| //replace 0 @r @ | //replace 0 @r @ | ||||
| //[en]: replace beginning n or l | //[en]: replace beginning n or l | ||||
| //[zh]: 不分nl,n读成l或l读成n | |||||
| //[zh]: 锟斤拷锟斤拷nl锟斤拷n锟斤拷锟絣锟斤拷l锟斤拷锟絥 | |||||
| //replace 2 n l | //replace 2 n l | ||||
| //replace 2 l n | //replace 2 l n | ||||
| //[en]: replace beginning w with v | //[en]: replace beginning w with v | ||||
| //[zh]: w读成v | |||||
| //[zh]: w锟斤拷锟絭 | |||||
| //replace 0 w v | //replace 0 w v |
| eo 13 111 | eo 13 111 | ||||
| jbo 4 112 | jbo 4 112 | ||||
| fi 40 130 | fi 40 130 | ||||
| fr 43 124 | |||||
| fr_ca 11 124 | |||||
| fr 44 125 | |||||
| fr_ca 11 125 | |||||
| hi 50 135 | hi 50 135 | ||||
| ta 15 137 | ta 15 137 | ||||
| hu 23 115 | hu 23 115 | ||||
| is 32 124 | is 32 124 | ||||
| vi 42 137 | vi 42 137 | ||||
| zhy 40 132 | zhy 40 132 | ||||
| zh 62 147 | |||||
| zh 64 148 | |||||
| sw 14 108 | sw 14 108 | ||||
| th 50 142 | th 50 142 | ||||
| id 14 120 | id 14 120 | ||||
| [dZ;] ru | [dZ;] ru | ||||
| dzh/xdz_pzd [J] base | dzh/xdz_pzd [J] base | ||||
| [J2] hi | [J2] hi | ||||
| envelope/i_risefall [11] zh | |||||
| envelope/p_214 [214] zh | envelope/p_214 [214] zh | ||||
| [5] th | [5] th | ||||
| envelope/p_451 [3] th | envelope/p_451 [3] th | ||||
| [7] vi | [7] vi | ||||
| [1] zhy | [1] zhy | ||||
| [4] zhy | [4] zhy | ||||
| [11] zh | |||||
| [21] zh | [21] zh | ||||
| [51] zh | [51] zh | ||||
| [22] zh | [22] zh | ||||
| n/ni [(i)] base | n/ni [(i)] base | ||||
| [n] zh | [n] zh | ||||
| nn/inn [(i)] base | nn/inn [(i)] base | ||||
| [N] zh | |||||
| n/nj [n] base | n/nj [n] base | ||||
| [n.] base | [n.] base | ||||
| [n^] base | [n^] base | ||||
| ufric/sh_pzd_ [S;] base | ufric/sh_pzd_ [S;] base | ||||
| [Z;] base | [Z;] base | ||||
| ufric/sh_rfx [s.] base | ufric/sh_rfx [s.] base | ||||
| [s.] zh | |||||
| ufric/sh_sr [S#] zh | |||||
| ufric/sh_sr.wav [S] sr | ufric/sh_sr.wav [S] sr | ||||
| [Z] sr | [Z] sr | ||||
| [dZ] sr | [dZ] sr | ||||
| ustop/null [?] base | ustop/null [?] base | ||||
| ustop/p [p] base | ustop/p [p] base | ||||
| [p] fr | [p] fr | ||||
| [p2] fr | |||||
| [ph] hi | [ph] hi | ||||
| [p] zhy | [p] zhy | ||||
| [ph] th | [ph] th | ||||
| ustop/p_ [p] base | ustop/p_ [p] base | ||||
| [p] fr | [p] fr | ||||
| [p2] fr | |||||
| [ph] hi | [ph] hi | ||||
| [ph] zh | [ph] zh | ||||
| ustop/percus10 [(X1] base | ustop/percus10 [(X1] base | ||||
| [a:] cs | [a:] cs | ||||
| [a:] la | [a:] la | ||||
| [a] is | [a] is | ||||
| [A] zh | |||||
| vowel/a#_3 [a2] en | vowel/a#_3 [a2] en | ||||
| [a2] en_n | [a2] en_n | ||||
| [a2] en_us | [a2] en_us | ||||
| [A] no | [A] no | ||||
| [A:] no | [A:] no | ||||
| [aa] zhy | [aa] zhy | ||||
| [A] zh | |||||
| vowel/aa# [0] en_wi | vowel/aa# [0] en_wi | ||||
| [a2] fi | [a2] fi | ||||
| vowel/aa_2 [A:] en | vowel/aa_2 [A:] en | ||||
| [U] ta | [U] ta | ||||
| [U] tr | [U] tr | ||||
| vowel/uu_3 [u] af | vowel/uu_3 [u] af | ||||
| [y] zh | |||||
| vowel/uu_4 [U] fi | vowel/uu_4 [U] fi | ||||
| [U] sv | [U] sv | ||||
| vowel/uu_bck [U] en_n | vowel/uu_bck [U] en_n |
| phoneme A~ | phoneme A~ | ||||
| vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
| length 180 | length 180 | ||||
| formants vnasal/aa_n2 | |||||
| formants vnasal/aa_n2 // silent unless followed by vowel | |||||
| endphoneme | endphoneme | ||||
| endphoneme | endphoneme | ||||
| phoneme p2 // silent unless followed by vowel | |||||
| beforenotvowel NULL | |||||
| vls blb stop | |||||
| vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11 | |||||
| vowelout f1=0 f2=1000 -500 -350 f3=-300 80 rms=22 | |||||
| lengthmod 2 | |||||
| wave ustop/p%45 | |||||
| before _ ustop/p_%45 | |||||
| endphoneme | |||||
| phoneme r | phoneme r | ||||
| vcd uvl frc starttype r endtype r | vcd uvl frc starttype r endtype r | ||||
| vowelin f1=0 f2=800 -100 100 f3=-400 100 | vowelin f1=0 f2=800 -100 100 f3=-400 100 | ||||
| endphoneme | endphoneme | ||||
| phoneme 11 // tone: low level | phoneme 11 // tone: low level | ||||
| stress | stress | ||||
| tone 12 9 envelope/p_fall NULL | |||||
| tone 12 9 envelope/i_risefall NULL | |||||
| endphoneme | endphoneme | ||||
| phoneme 21 // tone: low fall | phoneme 21 // tone: low fall | ||||
| vowelin f1=1 f2=1700 0 200 f3=-300 80 f4 | vowelin f1=1 f2=1700 0 200 f3=-300 80 f4 | ||||
| vowelout f1=1 f2=1700 0 200 f3=-300 80 f4 rms=30 | vowelout f1=1 f2=1700 0 200 f3=-300 80 f4 rms=30 | ||||
| lengthmod 2 | lengthmod 2 | ||||
| wave ustop/k_unasp_ | |||||
| wave ustop/k_unasp_%75 | |||||
| endphoneme | endphoneme | ||||
| phoneme kh | phoneme kh | ||||
| wave ufric/sh_pzd | wave ufric/sh_pzd | ||||
| endphoneme | endphoneme | ||||
| phoneme S# | |||||
| vls pla frc sibilant | |||||
| vowelin f1=0 f2=2700 400 600 f3=300 80 | |||||
| lengthmod 2 | |||||
| wave ufric/sh_sr%20 | |||||
| endphoneme | |||||
| phoneme s. | |||||
| vls pla frc sibilant | |||||
| vowelin f1=0 f2=1800 -100 300 f3=-300 80 | |||||
| vowelout f1=0 f2=1800 -100 300 f3=-300 80 | |||||
| length 100 | |||||
| lengthmod 3 | |||||
| wave ufric/sh_rfx%60 // quieter | |||||
| before _ ufric/sh_rfx%50 | |||||
| endphoneme | |||||
| phoneme ts | phoneme ts | ||||
| vls alv afr sibilant | vls alv afr sibilant | ||||
| vowelin f1=0 f2=1700 -300 300 f3=-100 80 | vowelin f1=0 f2=1700 -300 300 f3=-100 80 | ||||
| vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20 | vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20 | ||||
| lengthmod 2 | lengthmod 2 | ||||
| wave ustop/ts_unasp%50 | |||||
| wave ustop/ts_unasp%70 | |||||
| endphoneme | endphoneme | ||||
| phoneme tsh | phoneme tsh | ||||
| phoneme N //should be more different from n | phoneme N //should be more different from n | ||||
| vcd vel nasal | vcd vel nasal | ||||
| vowelout f1=2 f2=1900 200 400 f3=400 80 len=50 rms=15 brk | |||||
| vowelout f1=2 f2=1900 0 300 f3=400 80 len=50 rms=15 brk | |||||
| formants NULL | formants NULL | ||||
| before _ nn/nn2_ | before _ nn/nn2_ | ||||
| after _ nn/_nn | after _ nn/_nn | ||||
| lengthmod 7 | lengthmod 7 | ||||
| after (i) nn/inn | |||||
| // after (i) nn/inn | |||||
| endphoneme | endphoneme | ||||
| phoneme a | phoneme a | ||||
| phoneme A | phoneme A | ||||
| vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
| length 250 | length 250 | ||||
| formants vowel/aa | |||||
| formants vowel/a_3 | |||||
| before N vowel/aa_2 | before N vowel/aa_2 | ||||
| endphoneme | endphoneme | ||||
| phoneme u@ | phoneme u@ | ||||
| vowel starttype (u) endtype (@) | vowel starttype (u) endtype (@) | ||||
| length 250 | |||||
| length 230 | |||||
| formants vdiph2/o@ | formants vdiph2/o@ | ||||
| endphoneme | endphoneme | ||||
| endphoneme | endphoneme | ||||
| phoneme y | phoneme y | ||||
| vowel starttype (i) endtype (i) | |||||
| vowel starttype (i) endtype (u) | |||||
| length 250 | length 250 | ||||
| formants vowel/y_2 | formants vowel/y_2 | ||||
| before N vowel/uu_3 | |||||
| endphoneme | endphoneme | ||||
| phoneme yu //try more before N | phoneme yu //try more before N |
| extern void MakeVowelLists(void); | extern void MakeVowelLists(void); | ||||
| extern void FindPhonemesUsed(void); | extern void FindPhonemesUsed(void); | ||||
| extern void DrawEnvelopes(); | extern void DrawEnvelopes(); | ||||
| extern int LoadEnvelope2(FILE *f, const char *fname); | |||||
| extern int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname, int flags); | extern int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname, int flags); | ||||
| static int markers_used[8]; | static int markers_used[8]; | ||||
| int n_envelopes = 0; | int n_envelopes = 0; | ||||
| char envelope_paths[N_ENVELOPES][80]; | char envelope_paths[N_ENVELOPES][80]; | ||||
| unsigned char envelope_dat[N_ENVELOPES][ENV_LEN]; | unsigned char envelope_dat[N_ENVELOPES][ENV_LEN]; | ||||
| FILE *f_phdata; | |||||
| int LoadSpect(const char *path, int control); | int LoadSpect(const char *path, int control); | ||||
| int LoadWavefile(FILE *f, const char *fname); | int LoadWavefile(FILE *f, const char *fname); | ||||
| int LoadEnvelope(FILE *f, const char *fname); | int LoadEnvelope(FILE *f, const char *fname); | ||||
| int LoadEnvelope2(FILE *f, const char *fname); | |||||
| int LoadDataFile(const char *path, int control); | int LoadDataFile(const char *path, int control); | ||||
| int AddSpect(int phcode, int *list, int control); | int AddSpect(int phcode, int *list, int control); | ||||
| void AddSpectList(int *list, int control); | void AddSpectList(int *list, int control); | ||||
| FILE *f_in; | FILE *f_in; | ||||
| FILE *f_phdata; | |||||
| FILE *f_phcontents; | FILE *f_phcontents; | ||||
| FILE *f_errors; | FILE *f_errors; | ||||
| FILE *f_phindex; | FILE *f_phindex; | ||||
| } // end of CPhonemeFiles | } // end of CPhonemeFiles | ||||
| //#define MAKE_ENVELOPES | |||||
| #ifdef MAKE_ENVELOPES | |||||
| #define ENV_LEN 128 | |||||
| void MakeEnvelope(unsigned char *env, float *points_x, float *points_y) | |||||
| {//==================================================================== | |||||
| int ix = -1; | |||||
| int x,y; | |||||
| for(x=0; x<ENV_LEN; x++) | |||||
| { | |||||
| if(x > points_x[ix+4]) | |||||
| ix++; | |||||
| y = (int)polint(&points_x[ix],&points_y[ix],4,x); | |||||
| if(y < 0) y = 0; | |||||
| if(y > 255) y = 255; | |||||
| env[x] = y; | |||||
| } | |||||
| } | |||||
| static float env1_x[]={0,0x30,0x40,ENV_LEN}; | |||||
| static float env1_y[]={0,200,255,255}; | |||||
| static float env2_x[]={0,0x28,0x48,0x60,ENV_LEN}; | |||||
| static float env2_y[]={255,0xe0,0xc0,0x60,0}; | |||||
| static float env3_x[]={0,0x18,0x30,ENV_LEN}; | |||||
| static float env3_y[]={0,0x28,0x50,255}; | |||||
| static float env4_x[]={0,0x20,0x40,0x60,ENV_LEN}; | |||||
| static float env4_y[]={255,0x70,0,0x70,255}; | |||||
| static float env5_x[]={0,0x20,0x40,0x58,0x70,ENV_LEN}; | |||||
| static float env5_y[]={0,0x28,0x50,0xa0,0xf0,255}; | |||||
| static float env6_x[]={0,0x20,0x38,0x60,ENV_LEN}; | |||||
| static float env6_y[]={255,0xe8,0xd0,0x68,0}; | |||||
| static float env7_x[]={0,0x20,0x40,0x60,ENV_LEN}; // 214 | |||||
| static float env7_y[]={85,42,0,128,255}; | |||||
| static float env8_x[]={0,0x20,0x40,0x60,ENV_LEN}; // 211 | |||||
| static float env8_y[]={255,130,20,10,0}; | |||||
| static float env9_x[]={0,0x20,0x40,0x60,ENV_LEN}; // 51 fall | |||||
| static float env9_y[]={255,210,140,70,0}; | |||||
| static float enva3_x[]={0,44,64,84,ENV_LEN}; // amp env for broken tone | |||||
| static float enva3_y[]={255,255,160,255,255}; | |||||
| static float enva6_x[]={0,44,64,80,ENV_LEN}; // amp env for drop tone | |||||
| static float enva6_y[]={255,255,255,250,50}; | |||||
| unsigned char env_test[ENV_LEN]; | |||||
| void MakeEnvFile(char *fname, float *x, float *y, int source) | |||||
| {//========================================================== | |||||
| static char hdr[12] = {'P','I','T','C','H','E','N','V',80,0,120,0}; | |||||
| FILE *f; | |||||
| int ix; | |||||
| MakeEnvelope(env_test,x,y); | |||||
| f = fopen(fname,"wb"); | |||||
| if(source) | |||||
| { | |||||
| for(ix=0; ix<128; ix++) | |||||
| { | |||||
| fprintf(f,"0x%.2x,",env_test[ix]); | |||||
| if((ix & 7) == 7) | |||||
| fprintf(f,"\n"); | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| fwrite(hdr,12,1,f); | |||||
| fwrite(env_test,128,1,f); | |||||
| } | |||||
| fclose(f); | |||||
| } | |||||
| void make_envs() | |||||
| {//============= | |||||
| MakeEnvFile("p_level",env1_x,env1_y,0); | |||||
| MakeEnvFile("p_rise",env5_x,env5_y,0); | |||||
| MakeEnvFile("p_fall",env9_x,env9_y,0); | |||||
| MakeEnvFile("p_214",env7_x,env7_y,0); | |||||
| MakeEnvFile("p_211",env8_x,env8_y,0); | |||||
| MakeEnvFile("vi_2",env2_x,env2_y,0); | |||||
| MakeEnvFile("vi_5",env3_x,env3_y,0); | |||||
| MakeEnvFile("p_fallrise",env4_x,env4_y,0); | |||||
| MakeEnvFile("vi_6",env6_x,env6_y,0); | |||||
| MakeEnvFile("vi_5amp",enva3_x,enva3_y,0); | |||||
| MakeEnvFile("vi_6amp",enva6_x,enva6_y,0); | |||||
| } | |||||
| #endif | |||||
| int Compile::LoadEnvelope2(FILE *f, const char *fname) | |||||
| int LoadEnvelope2(FILE *f, const char *fname) | |||||
| {//=================================================== | {//=================================================== | ||||
| int ix; | int ix; | ||||
| int n; | int n; |
| #define PITCHrise 1 | #define PITCHrise 1 | ||||
| #define PITCHfrise 2 // and 3 must be for the varient preceded by 'r' | #define PITCHfrise 2 // and 3 must be for the varient preceded by 'r' | ||||
| #define PITCHfrise2 4 // and 5 must be the 'r' variant | #define PITCHfrise2 4 // and 5 must be the 'r' variant | ||||
| #define PITCHdrop 6 | |||||
| #define PITCHdrop2 8 | |||||
| //#define PITCHsemi_r 10 | |||||
| //#define PITCH1fall 11 | |||||
| //#define PITCH1fall2 12 | |||||
| #define PITCHrisefall 6 | |||||
| /* 0 fall */ | /* 0 fall */ | ||||
| unsigned char env_fall[128] = { | unsigned char env_fall[128] = { | ||||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x04, 0x04, 0x05, 0x06, 0x07, 0x08, | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x04, 0x04, 0x05, 0x06, 0x07, 0x08, | ||||
| 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20 }; | 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20 }; | ||||
| /* | |||||
| unsigned char env_drop[128] = { | |||||
| 0xff, 0xf9, 0xf4, 0xee, 0xe9, 0xe4, 0xdf, 0xda, 0xd5, 0xd0, 0xcb, 0xc6, 0xc1, 0xbc, 0xb8, 0xb3, | |||||
| 0xaf, 0xaa, 0xa6, 0xa2, 0x9d, 0x99, 0x95, 0x91, 0x8d, 0x89, 0x85, 0x81, 0x7d, 0x79, 0x76, 0x72, | |||||
| 0x6f, 0x6b, 0x68, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52, 0x4f, 0x4c, 0x49, 0x46, 0x44, 0x41, | |||||
| 0x3e, 0x3c, 0x39, 0x37, 0x35, 0x33, 0x30, 0x2e, 0x2c, 0x2a, 0x28, 0x27, 0x25, 0x23, 0x21, 0x20, | |||||
| 0x1e, 0x1d, 0x1b, 0x1a, 0x19, 0x18, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x10, 0x0f, 0x0e, | |||||
| 0x0e, 0x0d, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, | |||||
| 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x12, 0x13, 0x14, | |||||
| 0x15, 0x16, 0x17, 0x19, 0x1a, 0x1b, 0x1d, 0x1e, 0x20, 0x21, 0x23, 0x24, 0x26, 0x28, 0x2a, 0x2c }; | |||||
| unsigned char env_r_drop[128] = { | |||||
| 0xcf, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc8, 0xc6, 0xc5, 0xc3, 0xc1, 0xbe, 0xbc, 0xb9, 0xb7, 0xb4, | |||||
| 0xb1, 0xae, 0xab, 0xa8, 0xa5, 0xa2, 0x9e, 0x9b, 0x97, 0x94, 0x90, 0x8c, 0x89, 0x85, 0x81, 0x7d, | |||||
| 0x79, 0x75, 0x71, 0x6d, 0x69, 0x65, 0x61, 0x5d, 0x59, 0x55, 0x51, 0x4e, 0x4a, 0x46, 0x42, 0x3e, | |||||
| 0x3b, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2e, 0x2c, 0x2b, 0x29, 0x27, 0x25, 0x24, 0x22, 0x21, 0x1f, | |||||
| 0x1e, 0x1c, 0x1b, 0x1a, 0x19, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x11, 0x10, 0x0f, 0x0e, | |||||
| 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, | |||||
| 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0e, 0x0f, 0x0f, 0x10, 0x11, 0x12, 0x13, | |||||
| 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x23, 0x24, 0x26, 0x28 }; | |||||
| unsigned char env_drop2[128] = { | |||||
| 0xff, 0xfc, 0xf9, 0xf6, 0xf3, 0xf0, 0xed, 0xea, 0xe7, 0xe5, 0xe2, 0xdf, 0xdc, 0xda, 0xd7, 0xd5, | |||||
| 0xd2, 0xcf, 0xcd, 0xca, 0xc8, 0xc5, 0xc3, 0xc0, 0xbe, 0xbc, 0xb9, 0xb7, 0xb4, 0xb2, 0xb0, 0xae, | |||||
| 0xab, 0xa9, 0xa7, 0xa5, 0xa3, 0xa1, 0x9f, 0x9d, 0x9b, 0x99, 0x97, 0x95, 0x93, 0x91, 0x8f, 0x8d, | |||||
| 0x8b, 0x89, 0x88, 0x86, 0x84, 0x83, 0x81, 0x7f, 0x7e, 0x7c, 0x7a, 0x79, 0x77, 0x76, 0x74, 0x73, | |||||
| 0x71, 0x70, 0x6f, 0x6d, 0x6c, 0x6a, 0x69, 0x68, 0x67, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, | |||||
| 0x5e, 0x5d, 0x5c, 0x5b, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55, 0x54, 0x54, 0x53, 0x52, 0x51, 0x51, | |||||
| 0x50, 0x4f, 0x4f, 0x4e, 0x4e, 0x4d, 0x4d, 0x4c, 0x4c, 0x4b, 0x4b, 0x4a, 0x4a, 0x4a, 0x49, 0x49, | |||||
| 0x49, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x48 }; | |||||
| unsigned char env_r_drop2[128] = { | |||||
| 0xcf, 0xce, 0xcd, 0xcd, 0xcc, 0xcb, 0xcb, 0xca, 0xc9, 0xc8, 0xc7, 0xc6, 0xc5, 0xc4, 0xc3, 0xc2, | |||||
| 0xc1, 0xc0, 0xbf, 0xbd, 0xbc, 0xbb, 0xba, 0xb8, 0xb7, 0xb6, 0xb4, 0xb3, 0xb2, 0xb0, 0xaf, 0xad, | |||||
| 0xac, 0xaa, 0xa9, 0xa7, 0xa6, 0xa4, 0xa3, 0xa1, 0x9f, 0x9e, 0x9c, 0x9a, 0x99, 0x97, 0x96, 0x94, | |||||
| 0x92, 0x91, 0x8f, 0x8d, 0x8c, 0x8a, 0x88, 0x87, 0x85, 0x83, 0x82, 0x80, 0x7e, 0x7d, 0x7b, 0x7a, | |||||
| 0x78, 0x76, 0x75, 0x73, 0x72, 0x70, 0x6f, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0x68, 0x67, 0x66, | |||||
| 0x65, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5f, 0x5e, 0x5d, 0x5c, 0x5b, 0x5b, 0x5a, 0x59, 0x58, | |||||
| 0x58, 0x57, 0x56, 0x56, 0x55, 0x54, 0x54, 0x53, 0x52, 0x52, 0x51, 0x51, 0x50, 0x4f, 0x4f, 0x4e, | |||||
| 0x4e, 0x4d, 0x4d, 0x4c, 0x4c, 0x4b, 0x4b, 0x4b, 0x4a, 0x4a, 0x49, 0x49, 0x49, 0x48, 0x48, 0x48 }; | |||||
| // 10 semi_r | |||||
| unsigned char env_semi_r[128] = { | |||||
| 0x00, 0x01, 0x02, 0x04, 0x05, 0x07, 0x08, 0x09, 0x0b, 0x0c, 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15, | |||||
| 0x17, 0x18, 0x1a, 0x1b, 0x1d, 0x1f, 0x20, 0x22, 0x23, 0x25, 0x27, 0x28, 0x2a, 0x2c, 0x2d, 0x2f, | |||||
| 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b, 0x3d, 0x3f, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, | |||||
| 0x52, 0x54, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65, 0x67, 0x69, 0x6c, 0x6e, 0x70, 0x72, | |||||
| 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x87, 0x89, 0x8b, 0x8d, 0x8f, 0x90, | |||||
| 0x92, 0x94, 0x96, 0x97, 0x99, 0x9b, 0x9c, 0x9e, 0x9f, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, | |||||
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, | |||||
| 0xb4, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb8 }; | |||||
| // 11 drop3 | |||||
| unsigned char env_drop3[128] = { | |||||
| 0xff, 0xf8, 0xf2, 0xec, 0xe7, 0xe1, 0xdb, 0xd5, 0xd0, 0xca, 0xc5, 0xc0, 0xbb, 0xb5, 0xb1, 0xac, | |||||
| 0xa7, 0xa3, 0x9e, 0x9b, 0x97, 0x93, 0x90, 0x8c, 0x89, 0x86, 0x83, 0x80, 0x7d, 0x7b, 0x78, 0x76, | |||||
| 0x73, 0x71, 0x6f, 0x6d, 0x6b, 0x68, 0x66, 0x64, 0x62, 0x5f, 0x5d, 0x5b, 0x59, 0x57, 0x56, 0x54, | |||||
| 0x52, 0x50, 0x4e, 0x4d, 0x4b, 0x49, 0x48, 0x46, 0x44, 0x43, 0x41, 0x40, 0x3e, 0x3d, 0x3b, 0x3a, | |||||
| 0x39, 0x37, 0x35, 0x34, 0x32, 0x31, 0x2f, 0x2d, 0x2c, 0x2a, 0x29, 0x28, 0x26, 0x25, 0x23, 0x22, | |||||
| 0x21, 0x1f, 0x1e, 0x1d, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, | |||||
| 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x0a, 0x09, 0x08, 0x08, 0x07, 0x06, 0x06, 0x05, 0x05, 0x04, | |||||
| 0x04, 0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | |||||
| // 12 r_drop3 | |||||
| unsigned char env_r_drop3[128] = { | |||||
| 0xcf, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc8, 0xc7, 0xc5, 0xc4, 0xc2, 0xc0, 0xbe, 0xbc, 0xba, 0xb8, | |||||
| 0xb5, 0xb3, 0xb1, 0xae, 0xac, 0xa9, 0xa6, 0xa4, 0xa1, 0x9e, 0x9b, 0x98, 0x95, 0x92, 0x8f, 0x8c, | |||||
| 0x89, 0x86, 0x83, 0x80, 0x7d, 0x7a, 0x76, 0x73, 0x70, 0x6d, 0x6a, 0x67, 0x63, 0x60, 0x5d, 0x5a, | |||||
| 0x57, 0x54, 0x51, 0x4e, 0x4b, 0x48, 0x45, 0x43, 0x40, 0x3d, 0x3b, 0x39, 0x37, 0x36, 0x34, 0x33, | |||||
| 0x32, 0x30, 0x2f, 0x2d, 0x2c, 0x2b, 0x2a, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, | |||||
| 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, | |||||
| 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0c, 0x0b, 0x0b, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07, 0x06, | |||||
| 0x06, 0x05, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }; | |||||
| */ | |||||
| // long vowel fall | |||||
| static unsigned char env_long_fall[128] = { | |||||
| 254,249,250,251,252,253,254,254, 255,255,255,255,254,254,253,252, | |||||
| 251,250,249,247,244,242,238,234, 230,225,221,217,213,209,206,203, | |||||
| 199,195,191,187,183,179,175,172, 168,165,162,159,156,153,150,148, | |||||
| 145,143,140,138,136,134,132,130, 128,126,123,120,117,114,111,107, | |||||
| 104,100,96,91, 86,82,77,73, 70,66,63,60, 58,55,53,51, | |||||
| 49,47,46,45, 43,42,40,38, 36,34,31,28, 26,24,22,20, | |||||
| 18,16,14,12, 11,10,9,8, 8,8,8,8, 9,8,8,8, | |||||
| 8,8,7,7, 6,6,6,5, 4,4,3,3, 2,1,1,0 }; | |||||
| unsigned char *envelope_data[16] = { | |||||
| env_fall, env_rise, env_frise, env_r_frise, | |||||
| static unsigned char env_risefall[128] = { | |||||
| 0x98, 0x99, 0x99, 0x9a, 0x9c, 0x9d, 0x9f, 0xa1, 0xa4, 0xa7, 0xa9, 0xac, 0xb0, 0xb3, 0xb6, 0xba, | |||||
| 0xbe, 0xc1, 0xc5, 0xc9, 0xcd, 0xd1, 0xd4, 0xd8, 0xdc, 0xdf, 0xe3, 0xe6, 0xea, 0xed, 0xf0, 0xf2, | |||||
| 0xf5, 0xf7, 0xf9, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfd, | |||||
| 0xfb, 0xfa, 0xf8, 0xf6, 0xf3, 0xf1, 0xee, 0xec, 0xe9, 0xe6, 0xe4, 0xe0, 0xdd, 0xda, 0xd7, 0xd3, | |||||
| 0xd0, 0xcc, 0xc8, 0xc4, 0xc0, 0xbc, 0xb8, 0xb4, 0xb0, 0xac, 0xa7, 0xa3, 0x9f, 0x9a, 0x96, 0x91, | |||||
| 0x8d, 0x88, 0x84, 0x7f, 0x7b, 0x76, 0x72, 0x6d, 0x69, 0x65, 0x60, 0x5c, 0x58, 0x54, 0x50, 0x4c, | |||||
| 0x48, 0x44, 0x40, 0x3c, 0x39, 0x35, 0x32, 0x2f, 0x2b, 0x28, 0x26, 0x23, 0x20, 0x1d, 0x1a, 0x17, | |||||
| 0x15, 0x12, 0x0f, 0x0d, 0x0a, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; | |||||
| static unsigned char env_rise2[128] = { | |||||
| 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x06, 0x06, | |||||
| 0x07, 0x08, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, | |||||
| 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1f, 0x20, 0x22, 0x23, 0x25, 0x26, 0x28, 0x29, 0x2b, | |||||
| 0x2d, 0x2f, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x47, 0x49, 0x4b, | |||||
| 0x4e, 0x50, 0x52, 0x55, 0x57, 0x5a, 0x5d, 0x5f, 0x62, 0x65, 0x67, 0x6a, 0x6d, 0x70, 0x73, 0x76, | |||||
| 0x79, 0x7c, 0x7f, 0x82, 0x86, 0x89, 0x8c, 0x90, 0x93, 0x96, 0x9a, 0x9d, 0xa0, 0xa3, 0xa6, 0xa9, | |||||
| 0xac, 0xaf, 0xb2, 0xb5, 0xb8, 0xbb, 0xbe, 0xc1, 0xc4, 0xc7, 0xca, 0xcd, 0xd0, 0xd3, 0xd6, 0xd9, | |||||
| 0xdc, 0xdf, 0xe2, 0xe4, 0xe7, 0xe9, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfb, 0xfd }; | |||||
| static unsigned char env_fall2[128] = { | |||||
| 0xfe, 0xfe, 0xfd, 0xfd, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xf8, 0xf8, 0xf7, 0xf7, 0xf6, 0xf6, | |||||
| 0xf5, 0xf4, 0xf4, 0xf3, 0xf3, 0xf2, 0xf2, 0xf1, 0xf0, 0xf0, 0xef, 0xee, 0xee, 0xed, 0xec, 0xeb, | |||||
| 0xea, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, 0xe1, 0xe0, 0xde, 0xdd, 0xdc, 0xdb, | |||||
| 0xd9, 0xd8, 0xd6, 0xd5, 0xd3, 0xd2, 0xd0, 0xce, 0xcc, 0xcb, 0xc9, 0xc7, 0xc5, 0xc3, 0xc0, 0xbe, | |||||
| 0xbc, 0xb9, 0xb7, 0xb5, 0xb2, 0xaf, 0xad, 0xaa, 0xa7, 0xa4, 0xa1, 0x9e, 0x9a, 0x97, 0x94, 0x90, | |||||
| 0x8d, 0x89, 0x85, 0x81, 0x7d, 0x79, 0x75, 0x71, 0x6d, 0x68, 0x64, 0x61, 0x5e, 0x5b, 0x57, 0x54, | |||||
| 0x51, 0x4d, 0x4a, 0x46, 0x43, 0x40, 0x3c, 0x39, 0x35, 0x32, 0x2e, 0x2a, 0x27, 0x23, 0x1f, 0x1c, | |||||
| 0x18, 0x14, 0x11, 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 }; | |||||
| static unsigned char env_fallrise3[128] = { | |||||
| 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfd, 0xfc, 0xfa, 0xf8, 0xf6, 0xf4, 0xf1, 0xee, 0xeb, | |||||
| 0xe8, 0xe5, 0xe1, 0xde, 0xda, 0xd6, 0xd2, 0xcd, 0xc9, 0xc4, 0xbf, 0xba, 0xb6, 0xb0, 0xab, 0xa6, | |||||
| 0xa1, 0x9c, 0x96, 0x91, 0x8b, 0x86, 0x80, 0x7b, 0x75, 0x6f, 0x6a, 0x64, 0x5f, 0x59, 0x54, 0x4f, | |||||
| 0x49, 0x44, 0x3f, 0x3a, 0x35, 0x30, 0x2b, 0x26, 0x22, 0x1d, 0x19, 0x15, 0x11, 0x0d, 0x0a, 0x07, | |||||
| 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x04, 0x05, | |||||
| 0x07, 0x09, 0x0b, 0x0d, 0x10, 0x12, 0x15, 0x18, 0x1b, 0x1e, 0x22, 0x25, 0x29, 0x2d, 0x31, 0x35, | |||||
| 0x3a, 0x3e, 0x43, 0x48, 0x4c, 0x51, 0x57, 0x5b, 0x5e, 0x62, 0x65, 0x68, 0x6b, 0x6e, 0x71, 0x74, | |||||
| 0x76, 0x78, 0x7b, 0x7c, 0x7e, 0x80, 0x81, 0x82, 0x83, 0x83, 0x84, 0x84, 0x83, 0x83, 0x82, 0x81 }; | |||||
| static unsigned char env_fallrise4[128] = { | |||||
| 0x72, 0x72, 0x71, 0x71, 0x70, 0x6f, 0x6d, 0x6c, 0x6a, 0x68, 0x66, 0x64, 0x61, 0x5f, 0x5c, 0x5a, | |||||
| 0x57, 0x54, 0x51, 0x4e, 0x4b, 0x48, 0x45, 0x42, 0x3f, 0x3b, 0x38, 0x35, 0x32, 0x2f, 0x2c, 0x29, | |||||
| 0x26, 0x23, 0x20, 0x1d, 0x1b, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0e, 0x0c, 0x0b, 0x0a, 0x09, 0x08, | |||||
| 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, | |||||
| 0x07, 0x07, 0x08, 0x09, 0x0a, 0x0c, 0x0d, 0x0f, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1b, 0x1d, 0x20, | |||||
| 0x23, 0x26, 0x29, 0x2c, 0x2f, 0x33, 0x37, 0x3b, 0x3f, 0x43, 0x47, 0x4c, 0x51, 0x56, 0x5b, 0x60, | |||||
| 0x65, 0x6a, 0x6f, 0x74, 0x79, 0x7f, 0x84, 0x89, 0x8f, 0x95, 0x9b, 0xa1, 0xa7, 0xad, 0xb3, 0xba, | |||||
| 0xc0, 0xc7, 0xce, 0xd5, 0xdc, 0xe3, 0xea, 0xf1, 0xf5, 0xf7, 0xfa, 0xfc, 0xfd, 0xfe, 0xff, 0xff }; | |||||
| static unsigned char env_risefallrise[128] = { | |||||
| 0x7f, 0x7f, 0x7f, 0x80, 0x81, 0x83, 0x84, 0x87, 0x89, 0x8c, 0x8f, 0x92, 0x96, 0x99, 0x9d, 0xa1, | |||||
| 0xa5, 0xaa, 0xae, 0xb2, 0xb7, 0xbb, 0xc0, 0xc5, 0xc9, 0xcd, 0xd2, 0xd6, 0xda, 0xde, 0xe2, 0xe6, | |||||
| 0xea, 0xed, 0xf0, 0xf3, 0xf5, 0xf8, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xfd, 0xfc, 0xfb, 0xf9, | |||||
| 0xf7, 0xf4, 0xf0, 0xec, 0xe7, 0xe2, 0xdc, 0xd5, 0xce, 0xc6, 0xbd, 0xb4, 0xa9, 0x9e, 0x92, 0x88, | |||||
| 0x82, 0x7d, 0x77, 0x72, 0x6c, 0x66, 0x60, 0x5a, 0x54, 0x4e, 0x49, 0x42, 0x3c, 0x37, 0x32, 0x2d, | |||||
| 0x28, 0x24, 0x1f, 0x1b, 0x18, 0x14, 0x11, 0x0e, 0x0c, 0x09, 0x07, 0x06, 0x05, 0x04, 0x04, 0x04, | |||||
| 0x04, 0x05, 0x06, 0x08, 0x0a, 0x0d, 0x10, 0x14, 0x18, 0x1d, 0x23, 0x29, 0x2f, 0x37, 0x3e, 0x47, | |||||
| 0x50, 0x5a, 0x64, 0x70, 0x7c, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x93 }; | |||||
| unsigned char *envelope_data[18] = { | |||||
| env_fall, | |||||
| env_rise, | |||||
| env_frise, env_r_frise, | |||||
| env_frise2, env_r_frise2, | env_frise2, env_r_frise2, | ||||
| env_risefall, env_risefall, | |||||
| env_long_fall, env_long_fall, env_fall, env_fall, | |||||
| env_fall, env_fall, env_fall, env_fall, | |||||
| env_fall, env_fall | |||||
| env_fallrise3, env_fallrise3, | |||||
| env_fallrise4, env_fallrise4, | |||||
| env_fall2, env_fall2, | |||||
| env_rise2, env_rise2, | |||||
| env_risefallrise, env_risefallrise | |||||
| }; | }; | ||||
| static short oflow_test2[] = {20, 0, 20, 0, 20}; | static short oflow_test2[] = {20, 0, 20, 0, 20}; | ||||
| static short back_emf[] = {35, 32, 0}; | static short back_emf[] = {35, 32, 0}; | ||||
| typedef struct { | |||||
| unsigned char pitch_env0; /* pitch envelope, tonic syllable at end */ | |||||
| unsigned char tonic_max0; | |||||
| unsigned char tonic_min0; | |||||
| unsigned char pitch_env1; /* followed by unstressed */ | |||||
| unsigned char tonic_max1; | |||||
| unsigned char tonic_min1; | |||||
| #define N_TONE_HEAD_TABLE 13 | |||||
| #define N_TONE_NUCLEUS_TABLE 13 | |||||
| typedef struct { | |||||
| unsigned char pre_start; | unsigned char pre_start; | ||||
| unsigned char pre_end; | unsigned char pre_end; | ||||
| char n_overflow; | char n_overflow; | ||||
| short *overflow; | short *overflow; | ||||
| short *backwards; | |||||
| unsigned char tail_start; | |||||
| unsigned char tail_end; | |||||
| unsigned char tail_shape; | |||||
| } TONE_TABLE; | |||||
| #define N_TONE_TABLE 13 | |||||
| static TONE_TABLE tone_table[N_TONE_TABLE] = { | |||||
| {PITCHfall, 30, 5, PITCHfall, 30, 8, // 0 statement | |||||
| 20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 12, 7, 0}, | |||||
| {PITCHfrise, 35,8, PITCHfrise2, 35,10, // 1 comma | |||||
| 20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 23, 0}, | |||||
| {PITCHfrise, 39,10, PITCHfrise2, 36,10, // 2 question | |||||
| 20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 28, 0}, | |||||
| {PITCHfall, 41, 4, PITCHfall, 41, 27, // 3 exclamation | |||||
| 20, 25, 36, 22, drops_0, 3, 4, 5, oflow_emf, back_emf, 16, 4, 0}, | |||||
| {PITCHfall, 38, 2, PITCHfall, 42, 30, // 4 statement, emphatic | |||||
| 20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 15, 5, 0}, | |||||
| } TONE_HEAD; | |||||
| {PITCHfall, 28, 5, PITCHfall, 28, 9, // 5 statement, less intonation | |||||
| 20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less, NULL, 12, 7, 0}, | |||||
| {PITCHfrise2, 32,8, PITCHfrise2, 28,9, // 6 comma, less intonation | |||||
| 20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less, NULL, 10,16, 0}, | |||||
| {PITCHfrise2, 28, 7, PITCHfall, 29, 14, // 7 comma, less intonation, less rise | |||||
| 20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less, NULL, 14, 8, 0}, | |||||
| {PITCHrise, 30, 20, PITCHfall, 19, 14, // 8 pitch raises at end of sentence | |||||
| 20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 20, 26, 0}, | |||||
| {PITCHfrise, 35,11, PITCHfrise2, 32,10, // 9 comma | |||||
| 20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 19, 24, 0}, | |||||
| typedef struct { | |||||
| unsigned char pitch_env0; /* pitch envelope, tonic syllable at end */ | |||||
| unsigned char tonic_max0; | |||||
| unsigned char tonic_min0; | |||||
| {PITCHfrise, 39, 15, PITCHfall, 28, 14, // 10 question | |||||
| 20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 20, 36, 0}, | |||||
| unsigned char pitch_env1; /* followed by unstressed */ | |||||
| unsigned char tonic_max1; | |||||
| unsigned char tonic_min1; | |||||
| {PITCHfall, 28, 6, PITCHfall, 28, 10, // 11 test | |||||
| 20, 25, 24, 22, drops_0, 3, 3, 5, oflow_less, NULL, 12, 6, 0}, | |||||
| short *backwards; | |||||
| {PITCHfall, 35, 9, PITCHfall, 35, 12, // 12 test | |||||
| 19, 26, 36, 20, drops_0, 2, 4, 5, oflow_test2, NULL, 16, 10, 0}, | |||||
| unsigned char tail_start; | |||||
| unsigned char tail_end; | |||||
| unsigned char flags; | |||||
| } TONE_NUCLEUS; | |||||
| #define T_EMPH 1 | |||||
| static TONE_HEAD tone_head_table[N_TONE_HEAD_TABLE] = { | |||||
| {20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 0 statement | |||||
| {20, 25, 34, 20, drops_0, 3, 3, 5, oflow}, // 1 comma | |||||
| {20, 25, 34, 20, drops_0, 3, 3, 5, oflow}, // 2 question | |||||
| {20, 25, 36, 22, drops_0, 3, 4, 5, oflow_emf}, // 3 exclamation | |||||
| {20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 4 statement, emphatic | |||||
| {20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less}, // 5 statement, less intonation | |||||
| {20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less}, // 6 comma, less intonation | |||||
| {20, 25, 32, 24, drops_0, 4, 3, 5, oflow_less}, // 7 comma, less intonation, less rise | |||||
| {20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 8 pitch raises at end of sentence | |||||
| {20, 25, 34, 20, drops_0, 3, 3, 5, oflow}, // 9 comma | |||||
| {20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 10 question | |||||
| {20, 25, 24, 22, drops_0, 3, 3, 5, oflow_less}, // 11 test | |||||
| {19, 26, 36, 20, drops_0, 2, 4, 5, oflow_test2}, // 12 test | |||||
| }; | |||||
| static TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = { | |||||
| {PITCHfall, 30, 5, PITCHfall, 30, 8, NULL, 12, 7, 0}, // 0 statement | |||||
| {PITCHfrise, 35, 8, PITCHfrise2, 35,10, NULL, 15, 23, 0}, // 1 comma | |||||
| {PITCHfrise, 39,10, PITCHfrise2, 36,10, NULL, 15, 28, 0}, // 2 question | |||||
| // {PITCHfall, 41, 4, PITCHfall, 41,27, NULL, 16, 4, T_EMPH}, // 3 exclamation | |||||
| {PITCHfall, 43, 3, PITCHfall, 45,35, NULL, 35, 4, T_EMPH}, // 3 exclamation | |||||
| // {PITCHrisefall,47, 8, PITCHrise, 48,30, NULL, 48, 5, T_EMPH}, // 3 exclamation | |||||
| {PITCHfall, 38, 2, PITCHfall, 42,30, NULL, 15, 5, 0}, // 4 statement, emphatic | |||||
| {PITCHfall, 28, 5, PITCHfall, 28, 9, NULL, 12, 7, 0}, // 5 statement, less intonation | |||||
| {PITCHfrise, 30, 8, PITCHfrise2, 30,10, NULL, 13, 20, 0}, // 6 comma, less intonation | |||||
| {PITCHfrise2, 28, 7, PITCHfall, 29,14, NULL, 14, 8, 0}, // 7 comma, less intonation, less rise | |||||
| {PITCHrise, 30,20, PITCHfall, 19,14, NULL, 20, 26, 0}, // 8 pitch raises at end of sentence | |||||
| {PITCHfrise, 35,11, PITCHfrise2, 32,10, NULL, 19, 24, 0}, // 9 comma | |||||
| {PITCHfrise, 39,15, PITCHfall, 28,14, NULL, 20, 36, 0}, // 10 question | |||||
| {PITCHfall, 28, 6, PITCHfall, 28,10, NULL, 12, 6, 0}, // 11 test | |||||
| {PITCHfall, 35, 9, PITCHfall, 35,12, NULL, 16, 10, 0}, // 12 test | |||||
| }; | }; | ||||
| unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS] = { | unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS] = { | ||||
| {0,1,2,3,0,4}, | {0,1,2,3,0,4}, | ||||
| {0,1,2,3,0,4}, | {0,1,2,3,0,4}, | ||||
| {5,6,2,0,0,4}, | |||||
| {5,7,1,0,0,4}, | |||||
| {5,6,2,3,0,4}, | |||||
| {5,7,1,3,0,4}, | |||||
| {8,9,10,3,0,0}, | {8,9,10,3,0,0}, | ||||
| {8,8,10,3,0,0}, | {8,8,10,3,0,0}, | ||||
| {11,11,11,11,0,0}, // 6 test | {11,11,11,11,0,0}, // 6 test | ||||
| static int calc_pitch_segment(int ix, int end_ix, TONE_TABLE *t, int min_stress, int continuing) | |||||
| static int calc_pitch_segment(int ix, int end_ix, TONE_HEAD *th, TONE_NUCLEUS *tn, int min_stress, int continuing) | |||||
| /**********************************************************************************************/ | /**********************************************************************************************/ | ||||
| /* Calculate pitches until next RESET or tonic syllable, or end. | /* Calculate pitches until next RESET or tonic syllable, or end. | ||||
| Increment pitch if stress is >= min_stress. | Increment pitch if stress is >= min_stress. | ||||
| static short continue_tab[5] = {-13, 16, 10, 4, 0}; | static short continue_tab[5] = {-13, 16, 10, 4, 0}; | ||||
| drops = t->body_drops; | |||||
| drops = th->body_drops; | |||||
| if(continuing) | if(continuing) | ||||
| { | { | ||||
| overflow = 0; | overflow = 0; | ||||
| n_overflow = 5; | n_overflow = 5; | ||||
| overflow_tab = continue_tab; | overflow_tab = continue_tab; | ||||
| increment = (t->body_end - t->body_start) << 8; | |||||
| increment = increment / (t->body_max_steps -1); | |||||
| increment = (th->body_end - th->body_start) << 8; | |||||
| increment = increment / (th->body_max_steps -1); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| n_overflow = t->n_overflow; | |||||
| overflow_tab = t->overflow; | |||||
| n_overflow = th->n_overflow; | |||||
| overflow_tab = th->overflow; | |||||
| initial = 1; | initial = 1; | ||||
| } | } | ||||
| overflow = 0; | overflow = 0; | ||||
| n_steps = n_primary = count_increments(ix,end_ix,min_stress); | n_steps = n_primary = count_increments(ix,end_ix,min_stress); | ||||
| if(n_steps > t->body_max_steps) | |||||
| n_steps = t->body_max_steps; | |||||
| if(n_steps > th->body_max_steps) | |||||
| n_steps = th->body_max_steps; | |||||
| if(n_steps > 1) | if(n_steps > 1) | ||||
| { | { | ||||
| increment = (t->body_end - t->body_start) << 8; | |||||
| increment = (th->body_end - th->body_start) << 8; | |||||
| increment = increment / (n_steps -1); | increment = increment / (n_steps -1); | ||||
| } | } | ||||
| else | else | ||||
| increment = 0; | increment = 0; | ||||
| pitch = t->body_start << 8; | |||||
| pitch = th->body_start << 8; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| pitch += increment; | pitch += increment; | ||||
| else | else | ||||
| { | { | ||||
| pitch = (t->body_end << 8) - (increment * overflow_tab[overflow++])/16; | |||||
| pitch = (th->body_end << 8) - (increment * overflow_tab[overflow++])/16; | |||||
| if(overflow >= n_overflow) | if(overflow >= n_overflow) | ||||
| { | { | ||||
| overflow = 0; | overflow = 0; | ||||
| overflow_tab = t->overflow; | |||||
| overflow_tab = th->overflow; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| n_steps--; | n_steps--; | ||||
| n_primary--; | n_primary--; | ||||
| if((t->backwards) && (n_primary < 2)) | |||||
| if((tn->backwards) && (n_primary < 2)) | |||||
| { | { | ||||
| pitch = t->backwards[n_primary] << 8; | |||||
| pitch = tn->backwards[n_primary] << 8; | |||||
| } | } | ||||
| } | } | ||||
| { | { | ||||
| /* unstressed, drop pitch if preceded by PRIMARY */ | /* unstressed, drop pitch if preceded by PRIMARY */ | ||||
| if((syllable_tab[ix-1].stress & 0x3f) >= SECONDARY) | if((syllable_tab[ix-1].stress & 0x3f) >= SECONDARY) | ||||
| set_pitch(syl,pitch - (t->body_lower_u << 8), drops[stress]); | |||||
| set_pitch(syl,pitch - (th->body_lower_u << 8), drops[stress]); | |||||
| else | else | ||||
| set_pitch(syl,pitch,drops[stress]); | set_pitch(syl,pitch,drops[stress]); | ||||
| } | } | ||||
| drop = -increment; | drop = -increment; | ||||
| if(drop < min_drop[stress]) | if(drop < min_drop[stress]) | ||||
| drop = min_drop[stress]; | drop = min_drop[stress]; | ||||
| pitch += increment; | pitch += increment; | ||||
| set_pitch(syl,pitch,drop); | |||||
| if(drop > 0x900) | |||||
| drop = 0x900; | |||||
| set_pitch(syl, pitch, drop); | |||||
| } | } | ||||
| ix++; | ix++; | ||||
| static int calc_pitches(int start, int end, int group_tone) | |||||
| /**********************************************************/ | |||||
| /* Calculate pitch values for the vowels in this tone group */ | |||||
| static int calc_pitches(int start, int end, int head_tone, int nucleus_tone) | |||||
| //=========================================================================== | |||||
| // Calculate pitch values for the vowels in this tone group | |||||
| { | { | ||||
| int ix; | int ix; | ||||
| TONE_TABLE *t; | |||||
| TONE_HEAD *th; | |||||
| TONE_NUCLEUS *tn; | |||||
| int drop; | int drop; | ||||
| int continuing = 0; | int continuing = 0; | ||||
| if(start > 0) | if(start > 0) | ||||
| continuing = 1; | continuing = 1; | ||||
| t = &tone_table[group_tone]; | |||||
| th = &tone_head_table[head_tone]; | |||||
| tn = &tone_nucleus_table[nucleus_tone]; | |||||
| ix = start; | ix = start; | ||||
| /* vowels before the first primary stress */ | /* vowels before the first primary stress */ | ||||
| if(number_pre > 0) | if(number_pre > 0) | ||||
| { | { | ||||
| ix = calc_pitch_segment2(ix, ix+number_pre, t->pre_start, t->pre_end, 0); | |||||
| ix = calc_pitch_segment2(ix, ix+number_pre, th->pre_start, th->pre_end, 0); | |||||
| } | } | ||||
| /* body of tonic segment */ | /* body of tonic segment */ | ||||
| { | { | ||||
| tone_posn = tone_posn2; // put tone on the penultimate stressed word | tone_posn = tone_posn2; // put tone on the penultimate stressed word | ||||
| } | } | ||||
| ix = calc_pitch_segment(ix,tone_posn, t, PRIMARY, continuing); | |||||
| ix = calc_pitch_segment(ix,tone_posn, th, tn, PRIMARY, continuing); | |||||
| if(no_tonic) | if(no_tonic) | ||||
| return(0); | return(0); | ||||
| /* tonic syllable */ | /* tonic syllable */ | ||||
| /******************/ | /******************/ | ||||
| if(tn->flags & T_EMPH) | |||||
| { | |||||
| syllable_tab[ix].flags |= SYL_EMPHASIS; | |||||
| } | |||||
| if(number_tail == 0) | if(number_tail == 0) | ||||
| { | { | ||||
| tone_pitch_env = t->pitch_env0; | |||||
| drop = t->tonic_max0 - t->tonic_min0; | |||||
| set_pitch(&syllable_tab[ix++],t->tonic_min0 << 8,drop << 8); | |||||
| tone_pitch_env = tn->pitch_env0; | |||||
| drop = tn->tonic_max0 - tn->tonic_min0; | |||||
| set_pitch(&syllable_tab[ix++],tn->tonic_min0 << 8,drop << 8); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| tone_pitch_env = t->pitch_env1; | |||||
| drop = t->tonic_max1 - t->tonic_min1; | |||||
| set_pitch(&syllable_tab[ix++],t->tonic_min1 << 8,drop << 8); | |||||
| tone_pitch_env = tn->pitch_env1; | |||||
| drop = tn->tonic_max1 - tn->tonic_min1; | |||||
| set_pitch(&syllable_tab[ix++],tn->tonic_min1 << 8,drop << 8); | |||||
| } | } | ||||
| syllable_tab[tone_posn].env = tone_pitch_env; | syllable_tab[tone_posn].env = tone_pitch_env; | ||||
| /* tail, after the tonic syllable */ | /* tail, after the tonic syllable */ | ||||
| /**********************************/ | /**********************************/ | ||||
| calc_pitch_segment2(ix, end, t->tail_start, t->tail_end, 0); | |||||
| calc_pitch_segment2(ix, end, tn->tail_start, tn->tail_end, 0); | |||||
| return(tone_pitch_env); | return(tone_pitch_env); | ||||
| } /* end of calc_pitches */ | } /* end of calc_pitches */ | ||||
| } | } | ||||
| } | } | ||||
| phoneme_list[final_stressed].tone = 7; | |||||
| // language specific, changes to tones | // language specific, changes to tones | ||||
| if(translator_name == L('v','i')) | if(translator_name == L('v','i')) | ||||
| { | { | ||||
| tone_promoted = 0; | tone_promoted = 0; | ||||
| } | } | ||||
| if(ix == final_stressed) | |||||
| { | |||||
| if((tph->mnemonic == 0x3535 ) || (tph->mnemonic == 0x3135)) | |||||
| { | |||||
| // change sentence final tone 1 or 4 to stress 6, not 7 | |||||
| phoneme_list[final_stressed].tone = 6; | |||||
| } | |||||
| } | |||||
| if(prev_tph->mnemonic == 0x343132) // [214] | if(prev_tph->mnemonic == 0x343132) // [214] | ||||
| { | { | ||||
| if(tph->mnemonic == 0x343132) // [214] | if(tph->mnemonic == 0x343132) // [214] | ||||
| } | } | ||||
| } | } | ||||
| phoneme_list[final_stressed].tone = 7; | |||||
| } // end of Translator::CalcPitches_Tone | } // end of Translator::CalcPitches_Tone | ||||
| count_pitch_vowels(st_start, ix, n_st); | count_pitch_vowels(st_start, ix, n_st); | ||||
| if((ix < n_st) || (clause_type == 0)) | if((ix < n_st) || (clause_type == 0)) | ||||
| calc_pitches(st_start, ix, group_tone_emph); // split into > 1 tone groups, use emphatic tone | |||||
| calc_pitches(st_start, ix, group_tone_emph, group_tone_emph); // split into > 1 tone groups, use emphatic tone | |||||
| else | else | ||||
| calc_pitches(st_start, ix, group_tone); | |||||
| calc_pitches(st_start, ix, group_tone, group_tone); | |||||
| st_start = ix; | st_start = ix; | ||||
| } | } | ||||
| // end of clause after this syllable, indicated by a phonPAUSE_CLAUSE phoneme | // end of clause after this syllable, indicated by a phonPAUSE_CLAUSE phoneme | ||||
| st_clause_end = st_ix+1; | st_clause_end = st_ix+1; | ||||
| count_pitch_vowels(st_start, st_clause_end, st_clause_end); | count_pitch_vowels(st_start, st_clause_end, st_clause_end); | ||||
| calc_pitches(st_start, st_clause_end, group_tone_comma); | |||||
| calc_pitches(st_start, st_clause_end, group_tone_comma, group_tone_comma); | |||||
| st_start = st_clause_end; | st_start = st_clause_end; | ||||
| } | } | ||||
| } | } | ||||
| if(st_start < st_ix) | if(st_start < st_ix) | ||||
| { | { | ||||
| count_pitch_vowels(st_start, st_ix, n_st); | count_pitch_vowels(st_start, st_ix, n_st); | ||||
| calc_pitches(st_start, st_ix, group_tone); | |||||
| calc_pitches(st_start, st_ix, group_tone, group_tone); | |||||
| } | } | ||||
| file_menu->Append(SPECTSEQ_SAVE, _("&Save")); | file_menu->Append(SPECTSEQ_SAVE, _("&Save")); | ||||
| file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As")); | file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As")); | ||||
| file_menu->Append(SPECTSEQ_SAVESELECT, _("Save Selection")); | file_menu->Append(SPECTSEQ_SAVESELECT, _("Save Selection")); | ||||
| // file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope")); | |||||
| file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope")); | |||||
| file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); | file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); | ||||
| // file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | // file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | ||||
| } | } |
| menu_envelopes->Append(0x101,_T("Rise")); | menu_envelopes->Append(0x101,_T("Rise")); | ||||
| menu_envelopes->Append(0x102,_T("Fall-rise")); | menu_envelopes->Append(0x102,_T("Fall-rise")); | ||||
| menu_envelopes->Append(0x103,_T("Fall-rise (R)")); | menu_envelopes->Append(0x103,_T("Fall-rise (R)")); | ||||
| menu_envelopes->Append(0x104,_T("Fall-2")); | |||||
| menu_envelopes->Append(0x106,_T("Fall-3")); | |||||
| menu_envelopes->Append(0x104,_T("Fall-rise 2")); | |||||
| menu_envelopes->Append(0x105,_T("Fall-rise 2(R)")); | |||||
| menu_envelopes->Append(0x106,_T("Rise-fall")); | |||||
| menu_envelopes->Append(0x108,_T("Fall-rise 3")); | |||||
| menu_envelopes->Append(0x10a,_T("Fall-rise 4")); | |||||
| menu_envelopes->Append(0x10c,_T("Fall 2")); | |||||
| menu_envelopes->Append(0x10e,_T("Rise 2")); | |||||
| menu_envelopes->Append(0x110,_T("Rise-fall-rise")); | |||||
| menu_prosody = new wxMenu; | menu_prosody = new wxMenu; | ||||
| menu_prosody->Append(1,_T("Pitch envelope"),menu_envelopes); | menu_prosody->Append(1,_T("Pitch envelope"),menu_envelopes); | ||||
| for(ix=0; ix<=width; ix+=4) | for(ix=0; ix<=width; ix+=4) | ||||
| { | { | ||||
| x = int((ix * 127.9)/width); | x = int((ix * 127.9)/width); | ||||
| pitch = ph->pitch1 + (pitchr * env[x])/256; | |||||
| pitch = p1 + (pitchr * env[x])/256; | |||||
| y = y1-int(pitch * scaley); | y = y1-int(pitch * scaley); | ||||
| if(ix > 0) | if(ix > 0) | ||||
| dc.DrawLine(x1+ix-4,y2,x1+ix,y); | dc.DrawLine(x1+ix-4,y2,x1+ix,y); |
| {"x-low",20}, | {"x-low",20}, | ||||
| {"low",50}, | {"low",50}, | ||||
| {"medium",100}, | {"medium",100}, | ||||
| {"high",125}, | |||||
| {"x-high",150}, | |||||
| {"high",140}, | |||||
| {"x-high",180}, | |||||
| {NULL, -1}}; | {NULL, -1}}; | ||||
| static const MNEM_TAB *mnem_tabs[5] = { | static const MNEM_TAB *mnem_tabs[5] = { |
| { | { | ||||
| // tonic syllable, include a constant component so it doesn't decrease directly with speed | // tonic syllable, include a constant component so it doesn't decrease directly with speed | ||||
| length_mod += 20; | length_mod += 20; | ||||
| if(emphasized) | |||||
| length_mod += 10; | |||||
| } | } | ||||
| else | else | ||||
| if(emphasized) | if(emphasized) | ||||
| // set pitch for pre-vocalic part | // set pitch for pre-vocalic part | ||||
| if(pitch_start - last_pitch > 8) // was 9 | if(pitch_start - last_pitch > 8) // was 9 | ||||
| last_pitch = pitch_start - 8; | last_pitch = pitch_start - 8; | ||||
| prev->pitch1 = last_pitch; | prev->pitch1 = last_pitch; | ||||
| prev->pitch2 = pitch_start; | prev->pitch2 = pitch_start; | ||||
| if(last_pitch < pitch_start) | if(last_pitch < pitch_start) |
| int Save(wxOutputStream& stream, int selection); | int Save(wxOutputStream& stream, int selection); | ||||
| int Load(wxInputStream& stream); | int Load(wxInputStream& stream); | ||||
| void Draw(wxDC &dc, int start_y, int end_y); | void Draw(wxDC &dc, int start_y, int end_y); | ||||
| void MakePitchenv(PitchEnvelope &pitch); | |||||
| void MakePitchenv(PitchEnvelope &pitch, int start_frame, int end_frame); | |||||
| void MakeWave(int start, int end, PitchEnvelope &pitch); | void MakeWave(int start, int end, PitchEnvelope &pitch); | ||||
| void InterpolatePeaks(int on); | void InterpolatePeaks(int on); |
| void SpectDisplay::SavePitchenv(PitchEnvelope &pitch) | void SpectDisplay::SavePitchenv(PitchEnvelope &pitch) | ||||
| {//============================================== | |||||
| {//================================================== | |||||
| // save the pitch envelope | // save the pitch envelope | ||||
| int ix; | int ix; | ||||
| FILE *f_env; | |||||
| wxString filename; | wxString filename; | ||||
| char fname[200]; | |||||
| filename = wxFileSelector(_T("(Save pitch envelope"),path_pitches,_T(""),_T(""),_T("*"),wxSAVE); | filename = wxFileSelector(_T("(Save pitch envelope"),path_pitches,_T(""),_T(""),_T("*"),wxSAVE); | ||||
| if(filename.IsEmpty()) | if(filename.IsEmpty()) | ||||
| return; | return; | ||||
| wxFileOutputStream stream(filename); | |||||
| if(stream.Ok() == FALSE) | |||||
| strcpy(fname, filename.mb_str(wxConvLocal)); | |||||
| f_env = fopen(fname,"w"); | |||||
| if(f_env == NULL) | |||||
| { | { | ||||
| wxLogError(_T("Failed to write '%s'"),filename.c_str()); | |||||
| wxLogError(_T("Failed to write ")+filename); | |||||
| return; | return; | ||||
| } | } | ||||
| wxDataOutputStream s(stream); | |||||
| s.Write32(FILEID1_PITCHENV); | |||||
| s.Write32(FILEID2_PITCHENV); | |||||
| s.Write16(pitch.pitch1); // Hz | |||||
| s.Write16(pitch.pitch2); // Hz | |||||
| for(ix=0; ix<128; ix++) | for(ix=0; ix<128; ix++) | ||||
| s.Write8(pitch.env[ix]); | |||||
| { | |||||
| fprintf(f_env," 0x%.2x,",pitch.env[ix]); | |||||
| if((ix & 0xf) == 0xf) | |||||
| fprintf(f_env,"\n"); | |||||
| } | |||||
| fclose(f_env); | |||||
| } // end of SpectDisplay::SavePitchenv | } // end of SpectDisplay::SavePitchenv | ||||
| setlocale(LC_NUMERIC,"C"); // read numbers in the form 1.23456 | setlocale(LC_NUMERIC,"C"); // read numbers in the form 1.23456 | ||||
| spectseq->Load(stream); | spectseq->Load(stream); | ||||
| spectseq->name = leaf; | spectseq->name = leaf; | ||||
| spectseq->MakePitchenv(spectseq->pitchenv); | |||||
| spectseq->MakePitchenv(spectseq->pitchenv,0,spectseq->numframes-1); | |||||
| if(event.GetId() == MENU_SPECTRUM) | if(event.GetId() == MENU_SPECTRUM) | ||||
| path_spectload = path.GetPath(); | path_spectload = path.GetPath(); |
| } // end of CopyDown | } // end of CopyDown | ||||
| void SpectSeq::MakePitchenv(PitchEnvelope &pitchenv) | |||||
| {//================================================= | |||||
| void SpectSeq::MakePitchenv(PitchEnvelope &pitchenv, int start_frame, int end_frame) | |||||
| {//================================================================================= | |||||
| double f; | double f; | ||||
| double min=8000; | double min=8000; | ||||
| double max=0; | double max=0; | ||||
| memset(pitchenv.env,127,128); | memset(pitchenv.env,127,128); | ||||
| for(ix=0; ix<numframes; ix++) | |||||
| for(ix=start_frame; ix<=end_frame; ix++) | |||||
| { | { | ||||
| if((f = frames[ix]->pitch) == 0) continue; | if((f = frames[ix]->pitch) == 0) continue; | ||||
| nx++; | nx++; | ||||
| ay = new float[nx+1]; | ay = new float[nx+1]; | ||||
| nx = 0; | nx = 0; | ||||
| for(ix=0; ix<numframes; ix++) | |||||
| for(ix=start_frame; ix<=end_frame; ix++) | |||||
| { | { | ||||
| if((f = frames[ix]->pitch) == 0) continue; | if((f = frames[ix]->pitch) == 0) continue; | ||||
| #include "translate.h" | #include "translate.h" | ||||
| #include "wave.h" | #include "wave.h" | ||||
| const char *version_string = "1.31.06 05.Feb.08"; | |||||
| const char *version_string = "1.31.07 08.Feb.08"; | |||||
| const int version_phdata = 0x013105; | const int version_phdata = 0x013105; | ||||
| int option_device_number = -1; | int option_device_number = -1; |
| int SelectPhonemeTableName(const char *name); | int SelectPhonemeTableName(const char *name); | ||||
| extern unsigned char *envelope_data[16]; | |||||
| extern unsigned char *envelope_data[18]; | |||||
| extern int formant_rate[]; // max rate of change of each formant | extern int formant_rate[]; // max rate of change of each formant | ||||
| extern int speed_factor1; | extern int speed_factor1; | ||||
| extern int speed_factor2; | extern int speed_factor2; |
| case L('z','h'): | case L('z','h'): | ||||
| case L_zhy: | case L_zhy: | ||||
| { | { | ||||
| static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 230,300}; | |||||
| static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 240,290}; | |||||
| static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | ||||
| tr = new Translator; | tr = new Translator; |
| int ix_env; | int ix_env; | ||||
| int y_base; | int y_base; | ||||
| int x; | int x; | ||||
| FILE *f_txt=NULL; | |||||
| unsigned char *env; | unsigned char *env; | ||||
| char name[80]; | |||||
| char name[200]; | |||||
| wxBitmap bitmap(WD_ENV,HT_ENV*n_envelopes); | wxBitmap bitmap(WD_ENV,HT_ENV*n_envelopes); | ||||
| dc.SetFont(*wxSWISS_FONT); | dc.SetFont(*wxSWISS_FONT); | ||||
| dc.Clear(); | dc.Clear(); | ||||
| sprintf(name,"%s%s",path_source,"envelopes.txt"); | |||||
| // f_txt = fopen(name,"w"); | |||||
| for(ix_env=0; ix_env<n_envelopes; ix_env++) | for(ix_env=0; ix_env<n_envelopes; ix_env++) | ||||
| { | { | ||||
| { | { | ||||
| dc.DrawLine(x*2, y_base-env[x]/2, (x+1)*2, y_base-env[x+1]/2); | dc.DrawLine(x*2, y_base-env[x]/2, (x+1)*2, y_base-env[x+1]/2); | ||||
| } | } | ||||
| if(f_txt != NULL) | |||||
| { | |||||
| fprintf(f_txt,"%s\n",name); | |||||
| for(x=0; x<128; x++) | |||||
| { | |||||
| fprintf(f_txt," 0x%.2x,",env[x]); | |||||
| if((x & 0xf) == 0xf) | |||||
| fputc('\n',f_txt); | |||||
| } | |||||
| fputc('\n',f_txt); | |||||
| } | |||||
| } | } | ||||
| bitmap.SaveFile(path_phsource+_T("/envelopes.png"),wxBITMAP_TYPE_PNG); | bitmap.SaveFile(path_phsource+_T("/envelopes.png"),wxBITMAP_TYPE_PNG); | ||||
| if(f_txt != NULL) | |||||
| fclose(f_txt); | |||||
| } | } | ||||
| range = (wvoice->pitch_range * embedded_value[EMBED_R])/50; | range = (wvoice->pitch_range * embedded_value[EMBED_R])/50; | ||||
| // compensate for change in pitch when the range is narrowed or widened | // compensate for change in pitch when the range is narrowed or widened | ||||
| base -= (range - wvoice->pitch_range)*20; | |||||
| base -= (range - wvoice->pitch_range)*18; | |||||
| pitch_base = base + (pitch1 * range); | pitch_base = base + (pitch1 * range); | ||||
| pitch_range = base + (pitch2 * range) - pitch_base; | pitch_range = base + (pitch2 * range) - pitch_base; |