Added experimental Klatt synthesizer. Klatt phonemes use a new format of phoneme data. espeakedit, new dialog fields and layout for Klatt phonemes. Added Klatt versions of English phonemes. Fixed some compilation warnings on Windows. Fixed bug in Lettergroups > L10 Increased amplitude of harmonics below F1 peak, to increase bass. Allow 5 (up from 4) pairs of values in "tone" command in voice files. Default to slightly wider pk_shape1. If words are separated by hyphens, don't add word-gap, and don't pass new-word flag onto phoneme processing. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@203 d46cf337-b52f-0410-862d-fd96e6ae7743master
//maintainer: Willem van der Walt | |||||
//maintainer: Willem van der Walt | |||||
// email: [email protected] | // email: [email protected] | ||||
// tel: +27 12 8413996 | // tel: +27 12 8413996 | ||||
// Meraka Institute, CSIR | // Meraka Institute, CSIR | ||||
_stk str'e@p | _stk str'e@p | ||||
_tld t'Ild@ | _tld t'Ild@ | ||||
// symbols | |||||
⅓ d&:rd@ | |||||
⅔ tw,e@d'&:rd@s | |||||
// numeric | // numeric | ||||
_0 'nWl | _0 'nWl |
tS x z | tS x z | ||||
Dictionary ca_dict | |||||
@ a a# aI e E i o | |||||
O u U | |||||
* ** : b B d D dZ; | |||||
f g j J J^ k l l^ | |||||
m n N n^ p Q r R | |||||
R2 s S; t T tS ts tS; | |||||
v v# w z Z Z; | |||||
Dictionary cs_dict | Dictionary cs_dict | ||||
@- a a: aU e e: eI eU | @- a a: aU e e: eI eU | ||||
@- a aI aU e eI eU i | @- a aI aU e eI eU i | ||||
o oI u uI | o oI u uI | ||||
* b d dZ f g h j | |||||
k l m n p r R s | |||||
S t T tS ts v w x | |||||
z Z | |||||
* - b d dZ f g h | |||||
j k l m n p r R | |||||
s S t T tS ts v w | |||||
x z Z | |||||
Dictionary es_dict | Dictionary es_dict | ||||
t tS ts v z Z | t tS ts v z Z | ||||
Dictionary hy_dict | |||||
@ a aI e eI i i@ o | |||||
u W y | |||||
** b d dZ f g h j | |||||
k l m n p R3 s S | |||||
t tS ts v x z Z | |||||
Dictionary id_dict | Dictionary id_dict | ||||
@ a aI aU e E E2 i | @ a aI aU e E E2 i | ||||
Z | Z | ||||
Dictionary kn_dict | |||||
a a: aI aU e E e: i | |||||
I i: o o: r- u u: V | |||||
y | |||||
: b c ch d d. dZ f | |||||
g h j J k kh l l. | |||||
m n N n. n^ p ph R | |||||
R2 s S s. S; t t. t.h | |||||
th tS v w z | |||||
Dictionary ko_dict | Dictionary ko_dict | ||||
a e E i ji o u u- | a e E i ji o u u- | ||||
p r R s t w z | p r R s t w z | ||||
Dictionary lv_dict | |||||
a a: ai au e e: ei i | |||||
i: ie iu o o: u u: ui | |||||
uo | |||||
: b c d dZ f g h | |||||
j J k l l^ m n n^ | |||||
p r R R2 s S t tS | |||||
ts v x z Z | |||||
Dictionary mk_dict | Dictionary mk_dict | ||||
& @ @- @2 a A a: E | & @ @- @2 a A a: E | ||||
s S s; t v w x z | s S s; t v w x z | ||||
Dictionary om_dict | |||||
@# a a: E e I I# i: | |||||
O o: U u: | |||||
** : a# b B c` d d` | |||||
dZ f g h j k k` l | |||||
m n n^ p p` R s S | |||||
t t` tS v w z | |||||
Dictionary pl_dict | Dictionary pl_dict | ||||
@- a E E# E~ i O O~ | @- a E E# E~ i O O~ | ||||
Dictionary sq_dict | Dictionary sq_dict | ||||
@ a A e E i O u | |||||
V y yE | |||||
@ a A aI e E i O | |||||
u V y yE | |||||
* ** b c d D dZ f | * ** b c d D dZ f | ||||
g h j J k l ll m | g h j J k l ll m | ||||
b c d f g h j k | b c d f g h j k | ||||
l m n N p r s t | l m n N p r s t | ||||
tS v w z | tS v w z | ||||
Dictionary lv_dict | |||||
a a: ai au e e: ei i | |||||
i: ie iu o o: u u: ui | |||||
uo | |||||
: b c d dZ f g h | |||||
j J k l l^ m n n^ | |||||
p r R R2 s S t tS | |||||
ts v x z Z | |||||
Dictionary hy_dict | |||||
@ a aI e eI i i@ o | |||||
u W y | |||||
** b d dZ f g h j | |||||
k l m n p R3 s S | |||||
t tS ts v x z Z | |||||
Dictionary kn_dict | |||||
a a: aI aU e E e: i | |||||
I i: o o: r- u u: V | |||||
y | |||||
: b c ch d d. dZ f | |||||
g h j J k kh l l. | |||||
m n N n. n^ p ph R | |||||
R2 s S s. S; t t. t.h | |||||
th tS v w z | |||||
Dictionary om_dict | |||||
@# a a: E e I I# i: | |||||
O o: U u: | |||||
** : a# b B c` d d` | |||||
dZ f g h j k k` l | |||||
m n n^ p p` R s S | |||||
t t` tS v w z | |||||
Dictionary ca_dict | |||||
@ a a# aI e E i o | |||||
O u U | |||||
* ** : b B d D dZ; | |||||
f g j J J^ k l l^ | |||||
m n N n^ p Q r R | |||||
R2 s S; t T tS ts tS; | |||||
v v# w z Z Z; |
f Ef | f Ef | ||||
g dZi: | g dZi: | ||||
h eItS | h eItS | ||||
_i aI | |||||
i aI | |||||
j dZeI | j dZeI | ||||
k keI | k keI | ||||
l El | l El | ||||
® rEdZIst3d | ® rEdZIst3d | ||||
° dIgr'i:z | ° dIgr'i:z | ||||
− maIn@s | − maIn@s | ||||
± plVs@maIn@s | |||||
± plVsO@m'aIn@s | |||||
µ maIkroU | µ maIkroU | ||||
¼ a2kwO@t3 | ¼ a2kwO@t3 | ||||
½ a2hA:f | ½ a2hA:f | ||||
¾ Tri:kwO@t3 | ¾ Tri:kwO@t3 | ||||
⅓ w0nT'3:d | |||||
⅔ tu:T'3:dz | |||||
× taImz | × taImz | ||||
÷ dI2v'aIdbaI | ÷ dI2v'aIdbaI | ||||
€ jU@roUz | € jU@roUz | ||||
♯ SA@p | ♯ SA@p | ||||
♭ flat | ♭ flat | ||||
¬ n0t_|saIn | ¬ n0t_|saIn | ||||
√ skw,e@r'u:t | |||||
∞ Inf'InI2tI2 | |||||
≠ n0t'i:kw@LtU | |||||
ß S,A@p'Es | ß S,A@p'Es | ||||
ə SwA: | ə SwA: | ||||
gases gasI2z | gases gasI2z | ||||
gauche goUS | gauche goUS | ||||
gauge geIdZ | gauge geIdZ | ||||
gecko gEkoU | |||||
geese gi:s | geese gi:s | ||||
gemini dZEmI2naI | gemini dZEmI2naI | ||||
geni dZi:nI | geni dZi:nI | ||||
writable raIt@b@L | writable raIt@b@L | ||||
writh raID | writh raID | ||||
wrongdoing r0Ndu:I2N | wrongdoing r0Ndu:I2N | ||||
wuss wUs | |||||
xmas Eksma2s | xmas Eksma2s | ||||
Evan Ev@n | Evan Ev@n | ||||
Gary garI | Gary garI | ||||
Geraint gEraInt | Geraint gEraInt | ||||
Gibbs gIbz | |||||
Giles gaIlz | Giles gaIlz | ||||
Glynn glIn | Glynn glIn | ||||
Graeme greI@m | Graeme greI@m | ||||
Ivan aIv@n | Ivan aIv@n | ||||
Jacob dZeIk@b | Jacob dZeIk@b | ||||
Jamie dZeImI | Jamie dZeImI | ||||
Jacques Zak | |||||
Jesus dZi:z@s | Jesus dZi:z@s | ||||
Jonah dZoUn@ | |||||
José hoUs'eI | José hoUs'eI | ||||
Jose hoUs'eI | Jose hoUs'eI | ||||
Juan hwA:n | Juan hwA:n |
h) a (z eI | h) a (z eI | ||||
h) a (zar 'a | h) a (zar 'a | ||||
l) a (z eI | l) a (z eI | ||||
r) a (z eI | |||||
r) a (zA eI | |||||
@) a (zi_ 'A: | @) a (zi_ 'A: | ||||
br) a (zil a | br) a (zil a | ||||
bl) a (zon eI | bl) a (zon eI | ||||
r) a (zor eI | r) a (zor eI | ||||
sw) a (B 0 | sw) a (B 0 | ||||
sw) a (g a | |||||
sw) a (m_ a | sw) a (m_ a | ||||
sw) a (nk a | sw) a (nk a | ||||
sw) a (th eI | sw) a (th eI | ||||
_) ache (+ eIk | _) ache (+ eIk | ||||
d) ache (_ eIk | d) ache (_ eIk | ||||
h) ache (_ eIk | h) ache (_ eIk | ||||
k) ache (_ eIk | |||||
r) ache (_ eIk | r) ache (_ eIk | ||||
rt) ache (_ eIk | rt) ache (_ eIk | ||||
y) ache (_ eIk | y) ache (_ eIk | ||||
acou (st a2ku: | acou (st a2ku: | ||||
ac (quie ,a | ac (quie ,a | ||||
_) acre eIk@ | _) acre eIk@ | ||||
ac (rid ak | |||||
_) ac (ri ak | |||||
ac (ro ak | ac (ro ak | ||||
m) acro (@ akr@ | m) acro (@ akr@ | ||||
_) ac (t ak | _) ac (t ak | ||||
as (ive 'eIs | as (ive 'eIs | ||||
as (ymp as | as (ymp as | ||||
&) asy (_ @s%I | &) asy (_ @s%I | ||||
w) aste eIst | |||||
w) ast (e# eIst | |||||
.group at | .group at | ||||
pal) ate (_ @t | pal) ate (_ @t | ||||
_) eth (A i:T | _) eth (A i:T | ||||
?!3 eth (ane i:T | ?!3 eth (ane i:T | ||||
_) eth (a ET | _) eth (a ET | ||||
_) eth (el ET | |||||
eth (ic ET | eth (ic ET | ||||
eth (y i:T | eth (y i:T | ||||
@C) eth (_S3e @T | @C) eth (_S3e @T | ||||
_) trie traI | _) trie traI | ||||
_) tri (CA traI | _) tri (CA traI | ||||
_) tri (Cy traI | _) tri (Cy traI | ||||
tribe traIb | |||||
_) tri (bu trI | _) tri (bu trI | ||||
_) tri (g trI | _) tri (g trI | ||||
_) tri (ni trI | _) tri (ni trI |
_tld tildo | _tld tildo | ||||
_?? liteRo | _?? liteRo | ||||
_. punkto | _. punkto | ||||
_: dupunkto | _: dupunkto | ||||
~ tildo | ~ tildo | ||||
° gradoI | ° gradoI | ||||
% p@-*otsento | % p@-*otsento | ||||
@ po | |||||
@ _tSe_ | |||||
& kaI | & kaI | ||||
= ,,egala, | |||||
\\ deklivo | |||||
/ oblik'vo | |||||
* asteRisko | |||||
© k'opiraIto | |||||
v vo // not Roman numbers | v vo // not Roman numbers | ||||
x ikso | x ikso | ||||
t.e t'e,e | |||||
// Abbreviations | // Abbreviations | ||||
a.k ,antaUk@-*'isto | |||||
a.k. ,antaUk@-*'isto | |||||
akk alinome | |||||
anst anstataU | |||||
bea $abbrev | |||||
ekz ekzemple | |||||
i.a 'i'a | |||||
k.a kaIal'iaI | |||||
k.c kaItset'eRe | |||||
n.b n'otu||b'one | |||||
nro numeRo | |||||
pĝ paZo | |||||
p.k p,ostk@-*'isto | |||||
p.k. p,ostk@-*'isto | |||||
uea $abbrev | |||||
uk $abbrev | |||||
a.k ,antaUk@-*'isto $dot | |||||
akk alinome | |||||
anst anstataU $dot | |||||
bea $abbrev | |||||
bv bon,volu% | |||||
ekz ekzemple $dot | |||||
i.a 'i'a | |||||
k.a kaIal'iaI | |||||
k.c kaItset'eRe | |||||
Kg k'ilog@-*'amoI | |||||
Km k'ilom'et-*oI | |||||
kp k,omp'aru $dot | |||||
k.s kaI,s'im'ile | |||||
n.b n'otu||b'one | |||||
nro numeRo | |||||
pĝ padZo $dot | |||||
p.k p,ostk@-*'isto $dot | |||||
ps p,ostask@-*'ibo | |||||
p.s p,ostask@-*'ibo | |||||
str st@-*'ato | |||||
t.e tio,estas | |||||
t.n t'iel,nom'ata | |||||
uea $abbrev | |||||
uk $abbrev | |||||
ktp kaIt'iel,pl,u_ | |||||
k.t.p kaIt'iel,pl,u_ | |||||
Jan i,anu'aRo // months | |||||
Feb f,eb@-*u'aRo | |||||
Mar m'a@-*to | |||||
Apr ap@-*'ilo | |||||
Maj m'aIo% | |||||
Jun iun'io | |||||
Jul iul'io | |||||
Aŭg augusto% | |||||
Sept sep,temb@-*o | |||||
Okt ok,tob@-*o | |||||
//Nov nov,emb@-*o (problem: no difference between Nov and nov- [es: nov-jorko] ) | |||||
Dec detsemb@-*o | |||||
l' la | l' la | ||||
la %la | la %la | ||||
ne $u+ // negative | ne $u+ // negative | ||||
ĉu $u // interogative particle | |||||
ĉi $u // interogative particle | |||||
ĉu $u $brk // interogative particle and conjunction | |||||
ĉi $u // this | |||||
ia $u // any | ia $u // any | ||||
// prepositions | // prepositions | ||||
eĉ $brk | eĉ $brk | ||||
pli pl,i | pli pl,i | ||||
plej pl,eI | plej pl,eI | ||||
//ĝojo dZoIo | |||||
//ĉashundo tSas,hundo | |||||
//ligno lig,no | |||||
//signo sig,no | |||||
// pronouns | // pronouns | ||||
mi $u | mi $u | ||||
kiu $u+ $pause | kiu $u+ $pause | ||||
kiuj $u+ $pause | kiuj $u+ $pause | ||||
kiun $pause | kiun $pause | ||||
kiunj $pause | |||||
kiujn $pause | |||||
kiam $u+ $pause | kiam $u+ $pause | ||||
tio $u+ | tio $u+ | ||||
aŭ $u $pause | aŭ $u $pause | ||||
ĉar $u $pause | ĉar $u $pause | ||||
kaj $u $pause | kaj $u $pause | ||||
sed $u $pause | |||||
sed $u $pause //but | |||||
nek $u $pause | nek $u $pause | ||||
se $u $pause | se $u $pause | ||||
ju $u $brk | ju $u $brk | ||||
des $u $pause | des $u $pause | ||||
do $pause // therefore, so, then | do $pause // therefore, so, then | ||||
ekde $pause // since | ekde $pause // since | ||||
tamen $pause //however (avversative) | |||||
// translation rules | |||||
// translation rules for Esperanto | |||||
// This file is UTF-8 encoded | // This file is UTF-8 encoded | ||||
// includes both accented characters and ascii digraph alternatives (cx, gx, ux, etc) | // includes both accented characters and ascii digraph alternatives (cx, gx, ux, etc) | ||||
D_-_) an (_ %an //'an' after a number | D_-_) an (_ %an //'an' after a number | ||||
D_) a (_ %a //'a' after a number | D_) a (_ %a //'a' after a number | ||||
D_) an (_ %an //'an' after a number | D_) an (_ %an //'an' after a number | ||||
-) ano (_ an%o // 'ano' = member | |||||
.group b | .group b | ||||
_) b(_ bo | _) b(_ bo | ||||
b b | b b | ||||
_) d (-ro_ dokt'o | _) d (-ro_ dokt'o | ||||
_) d (-rino_ d,okto | _) d (-rino_ d,okto | ||||
-) do (_ d%o | |||||
.group e | .group e | ||||
_) e(_ e | _) e(_ e | ||||
e e | e e | ||||
.group k | .group k | ||||
_) k(_ ko | _) k(_ ko | ||||
k k | k k | ||||
_) k (-do_ kamaR'a | |||||
_) k (-dino_ k'amaRa | |||||
_) k (-ino_ k'amaRad | |||||
.group l | .group l | ||||
_) l(_ lo | _) l(_ lo | ||||
l l | l l | ||||
-) lo (_ l%o | -) lo (_ l%o | ||||
.group m | .group m | ||||
_) m(_ mo | _) m(_ mo | ||||
m m | m m | ||||
rr RR | rr RR | ||||
-) ro (_ R%o // d-ro, n-ro | -) ro (_ R%o // d-ro, n-ro | ||||
.group s | .group s | ||||
_) s(_ so | _) s(_ so | ||||
_) sh(_ So | _) sh(_ So | ||||
_) s (-ino_ s,injoR | _) s (-ino_ s,injoR | ||||
_) s (-ro_ sinj'o | _) s (-ro_ sinj'o | ||||
_) s (-ano_ s'am,ide | |||||
_) s (-anino_ s'am,ide | |||||
_) s (-ta_ s'ank | |||||
.group t | .group t | ||||
t t | t t | ||||
th (K T // foreign words | th (K T // foreign words | ||||
K) th T // foreign words | K) th T // foreign words | ||||
-) ta (_ t%a // s-ta = sankta | |||||
.group u | .group u | ||||
_) u(_ u | _) u(_ u | ||||
.group x | .group x | ||||
_) x(_ ikso | _) x(_ ikso | ||||
x ks | x ks | ||||
_) x z // foreign words | |||||
.group y | .group y | ||||
_) y(_ ipsilono | _) y(_ ipsilono | ||||
ŭ w | ŭ w | ||||
= ,,egala, | |||||
\ malantaIst@-*eko | |||||
/ st@-*eko | |||||
' | ' | ||||
+ plus | |||||
+ plus_ | |||||
_) ++ (_ plusplus | _) ++ (_ plusplus | ||||
. punkto | . punkto | ||||
\.) . | \.) . | ||||
* asteRisko | |||||
£ pundo | £ pundo | ||||
£ (D _pundoI_: | |||||
! ,ekk@-*io, | |||||
- _ | |||||
- (_a | |||||
£ (_D _pundoI_: | |||||
_! _k@-*isig'no_ | |||||
__) - (_D minus_ | |||||
D_) - (_D st@-*ek'eto_ | |||||
A_) - (_D _ | |||||
C_) - (_D _ | |||||
--) - | |||||
- minus_ | |||||
- (_a | |||||
$ dolaRo | $ dolaRo | ||||
$ (D _dolaRoI_: | |||||
$ (_D _dolaRoI_: | |||||
// 2006-11-18 Gilles Casse <[email protected]> | // 2006-11-18 Gilles Casse <[email protected]> | ||||
// | // | ||||
// Updated: 2008-11-01 Michel Such <[email protected]> | |||||
// Updated: 2008-11-19 Michel Such <[email protected]> | |||||
// | // | ||||
// Letter classes: | // Letter classes: | ||||
-) est (_ Est // -est | -) est (_ Est // -est | ||||
dg) et (_ Et // Bridget, gadget | dg) et (_ Et // Bridget, gadget | ||||
Ack) et (_ Et | |||||
m) et (_ Et2 | |||||
eu Y // eu | eu Y // eu | ||||
_) eu (ss y // eu | _) eu (ss y // eu | ||||
_) e (xA E | _) e (xA E | ||||
Cr) eamer i:mWr | Cr) eamer i:mWr | ||||
Cl) eaner i:nWr | Cl) eaner i:nWr | ||||
Ack) et (_ Et | |||||
vert) e (rX W | vert) e (rX W | ||||
eïn (_ 'Ein | eïn (_ 'Ein | ||||
anqu) ill il // tranquille | anqu) ill il // tranquille | ||||
dist) ill il // distiller | dist) ill il // distiller | ||||
_m) ill il // mille | _m) ill il // mille | ||||
osc) ill il // osciller | |||||
v) ill il // village | v) ill il // village | ||||
qu) ill ij // cuillière cueillir | qu) ill ij // cuillière cueillir | ||||
A) ill j // caillou | A) ill j // caillou |
// character names | // character names | ||||
_cap k'apital | |||||
_cap maj'uskola | |||||
_?? s'imbolo | _?? s'imbolo | ||||
_?A let:'e:Ra | _?A let:'e:Ra | ||||
59 phoneme tables | |||||
60 phoneme tables | |||||
new total | new total | ||||
base 101 101 | base 101 101 | ||||
base2 24 120 | base2 24 120 | ||||
rw 15 127 | rw 15 127 | ||||
ko 18 149 | ko 18 149 | ||||
da 15 131 | da 15 131 | ||||
sq 23 129 | |||||
sq 24 129 | |||||
ml 13 141 | ml 13 141 | ||||
kn 15 141 | kn 15 141 | ||||
bn 59 147 | bn 59 147 | ||||
ne 23 151 | ne 23 151 | ||||
hy 17 115 | hy 17 115 | ||||
om 21 121 | om 21 121 | ||||
en_klatt 77 147 | |||||
Data file Used by | Data file Used by | ||||
b/b [b] base | b/b [b] base | ||||
[(i)] base | [(i)] base | ||||
[(o)] base | [(o)] base | ||||
[(u)] base | [(u)] base | ||||
klatt/b/b [b] en_klatt | |||||
klatt/b/b_ [b] en_klatt | |||||
klatt/b/xb [b] en_klatt | |||||
klatt/d/d [d] en_klatt | |||||
klatt/d/d_ [d] en_klatt | |||||
klatt/d/dr [d] en_klatt | |||||
klatt/d/xd [d] en_klatt | |||||
klatt/dzh/dzh [dZ] en_klatt | |||||
klatt/dzh/dzh_ [dZ] en_klatt | |||||
klatt/dzh/xdzh [dZ] en_klatt | |||||
klatt/g/g [g] en_klatt | |||||
[g-] en_klatt | |||||
klatt/g/g_ [g] en_klatt | |||||
[g-] en_klatt | |||||
klatt/g/xg [g] en_klatt | |||||
[g-] en_klatt | |||||
klatt/j2/j2 [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/j2/xj2 [(i)] en_klatt | |||||
klatt/j/j [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/j/_j [j] en_klatt | |||||
klatt/j/j_ [j/] en_klatt | |||||
klatt/j/xj [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/l/l [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/l/_l [l] en_klatt | |||||
klatt/l/L2_eL [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
klatt/l/L2_uL [(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/l/tl [l] en_klatt | |||||
klatt/l/xl [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/m/m [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/m/_m [m] en_klatt | |||||
klatt/m/m_ [m] en_klatt | |||||
klatt/m/mj [m] en_klatt | |||||
klatt/n/n [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/n/_n [n] en_klatt | |||||
klatt/n/n_ [n] en_klatt | |||||
klatt/n/nj [n] en_klatt | |||||
klatt/nn/nn [(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/nn/_nn [N] en_klatt | |||||
klatt/nn/nn_ [N] en_klatt | |||||
klatt/nn/nnj [N] en_klatt | |||||
klatt/r/r [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/r/_r [r] en_klatt | |||||
[r-] en_klatt | |||||
klatt/r/r2 [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/r/tr [r] en_klatt | |||||
klatt/r/xr [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
klatt/vdiph2/ii@ [i@] en_klatt | |||||
[i@3] en_klatt | |||||
klatt/vdiph2/uu@ [U@] en_klatt | |||||
klatt/vdiph2/uw_2 [u:] en_klatt | |||||
klatt/vdiph/aai [aI] en_klatt | |||||
klatt/vdiph/au [aU] en_klatt | |||||
klatt/vdiph/eei [eI] en_klatt | |||||
klatt/vdiph/eu [eU] en_klatt | |||||
klatt/vdiph/ooi [OI] en_klatt | |||||
klatt/vdiph/@u_en [oU] en_klatt | |||||
klatt/vnasal/aa_n2 [A~] en_klatt | |||||
klatt/vnasal/ee_n [E~] en_klatt | |||||
klatt/vnasal/oo_n [O~] en_klatt | |||||
klatt/voc/dh [D] en_klatt | |||||
klatt/voc/dh_ [D] en_klatt | |||||
klatt/voc/v [v] en_klatt | |||||
klatt/voc/v_ [v] en_klatt | |||||
klatt/voc/vj [v] en_klatt | |||||
klatt/voc/z [z] en_klatt | |||||
klatt/voc/z_ [z] en_klatt | |||||
klatt/voc/zh [Z] en_klatt | |||||
klatt/voc/zh_ [Z] en_klatt | |||||
klatt/vowel/@ [3] en_klatt | |||||
[@] en_klatt | |||||
[@2] en_klatt | |||||
[@5] en_klatt | |||||
klatt/vowel/@- [@-] en_klatt | |||||
klatt/vowel/0_2 [0] en_klatt | |||||
klatt/vowel/3_en [3:] en_klatt | |||||
klatt/vowel/a#_3 [a2] en_klatt | |||||
klatt/vowel/a_4 [a] en_klatt | |||||
[aa] en_klatt | |||||
klatt/vowel/aa_2 [A:] en_klatt | |||||
[A@] en_klatt | |||||
klatt/vowel/e [e:] en_klatt | |||||
klatt/vowel/ee_1 [e@] en_klatt | |||||
klatt/vowel/ee_2 [E] en_klatt | |||||
klatt/vowel/i_en [i:] en_klatt | |||||
klatt/vowel/ii_4 [I] en_klatt | |||||
[I2] en_klatt | |||||
klatt/vowel/ii_en [i] en_klatt | |||||
klatt/vowel/o [o:] en_klatt | |||||
klatt/vowel/oe [W] en_klatt | |||||
klatt/vowel/oo_en [O] en_klatt | |||||
[O:] en_klatt | |||||
[O@] en_klatt | |||||
[o@] en_klatt | |||||
klatt/vowelr/V3_r [VR] en_klatt | |||||
klatt/vowelr/V_r [IR] en_klatt | |||||
klatt/vowel/uu [U] en_klatt | |||||
klatt/vowel/V_2 [V] en_klatt | |||||
klatt/vowel/y [y:] en_klatt | |||||
klatt/vowel/y# [Y:] en_klatt | |||||
klatt/vwl_en/aI@ [aI@] en_klatt | |||||
klatt/vwl_en/aU@ [aU@] en_klatt | |||||
klatt/vwl_en/@L [@L] en_klatt | |||||
klatt/w/w [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(o)] en_klatt | |||||
klatt/w/_w [w] en_klatt | |||||
klatt/w/wi [(i)] en_klatt | |||||
klatt/w/wu [(u)] en_klatt | |||||
klatt/w/xw [(@)] en_klatt | |||||
[(a)] en_klatt | |||||
[(e)] en_klatt | |||||
[(i)] en_klatt | |||||
[(o)] en_klatt | |||||
[(u)] en_klatt | |||||
l^/j2@ [(@)] base | l^/j2@ [(@)] base | ||||
[(@)] en_klatt | |||||
l^/j2a [(a)] base | l^/j2a [(a)] base | ||||
[(a)] en_klatt | |||||
l^/j2e [(e)] base | l^/j2e [(e)] base | ||||
[(e)] en_klatt | |||||
l^/j2i [(i)] base | l^/j2i [(i)] base | ||||
[(i)] en_klatt | |||||
l^/j2o [(o)] base | l^/j2o [(o)] base | ||||
[(o)] en_klatt | |||||
l^/j2u [(u)] base | l^/j2u [(u)] base | ||||
[(u)] en_klatt | |||||
l^/_l^ [l^] base | l^/_l^ [l^] base | ||||
l^/l^ [l^] base | l^/l^ [l^] base | ||||
l/l [l] base | l/l [l] base | ||||
[W] fr | [W] fr | ||||
[Y] fr | [Y] fr | ||||
[W2] fr | [W2] fr | ||||
[(@)] en_klatt | |||||
l/l@ [(@)] base | l/l@ [(@)] base | ||||
[W] fr | [W] fr | ||||
[Y] fr | [Y] fr | ||||
[W2] fr | [W2] fr | ||||
[(@)] en_klatt | |||||
l/L1_aL [(a)] base | l/L1_aL [(a)] base | ||||
[(a)] en_klatt | |||||
l/L1_eL [(e)] base | l/L1_eL [(e)] base | ||||
[(e)] en_klatt | |||||
l/L1_iL [(i)] base | l/L1_iL [(i)] base | ||||
[(i)] en_klatt | |||||
l/L1_@L [(@)] base | l/L1_@L [(@)] base | ||||
[(@)] en_klatt | |||||
l/L1_oL [(o)] base | l/L1_oL [(o)] base | ||||
[(o)] en_klatt | |||||
l/L1_uL [(u)] base | l/L1_uL [(u)] base | ||||
[(u)] en_klatt | |||||
l/L2_aL [(a)] base | l/L2_aL [(a)] base | ||||
l/L2_eL [(e)] base | l/L2_eL [(e)] base | ||||
l/L2_iL [(i)] base | l/L2_iL [(i)] base | ||||
l/la [(a)] base | l/la [(a)] base | ||||
[a] fr | [a] fr | ||||
[a2] fr | [a2] fr | ||||
[(a)] en_klatt | |||||
l/l_a [(a)] base | l/l_a [(a)] base | ||||
[a] fr | [a] fr | ||||
[a2] fr | [a2] fr | ||||
[wA] fr | [wA] fr | ||||
[A~] fr | [A~] fr | ||||
[(a)] en_klatt | |||||
l/le [(e)] base | l/le [(e)] base | ||||
[E] fr | [E] fr | ||||
[e] fr | [e] fr | ||||
[E2] fr | [E2] fr | ||||
[(e)] en_klatt | |||||
l/l_e [(e)] base | l/l_e [(e)] base | ||||
[E] fr | [E] fr | ||||
[E2] fr | [E2] fr | ||||
[(e)] en_klatt | |||||
l/L_eL_af [&] af | l/L_eL_af [&] af | ||||
[&:] af | [&:] af | ||||
l/l_front [l] sq | l/l_front [l] sq | ||||
[i] fr | [i] fr | ||||
[i:] fr | [i:] fr | ||||
[l] zh | [l] zh | ||||
[(i)] en_klatt | |||||
l/l_i [(i)] base | l/l_i [(i)] base | ||||
[i] fr | [i] fr | ||||
[i:] fr | [i:] fr | ||||
[w^i] fr | [w^i] fr | ||||
[i] sq | [i] sq | ||||
[(i)] en_klatt | |||||
l/l_long [l] base | l/l_long [l] base | ||||
[l] fr | [l] fr | ||||
[l] la | [l] la | ||||
[O2] fr | [O2] fr | ||||
[o2] fr | [o2] fr | ||||
[wA] fr | [wA] fr | ||||
[(o)] en_klatt | |||||
l/l_o [(o)] base | l/l_o [(o)] base | ||||
[O] fr | [O] fr | ||||
[O2] fr | [O2] fr | ||||
[o2] fr | [o2] fr | ||||
[(o)] en_klatt | |||||
l^/l_rfx [l.] hi | l^/l_rfx [l.] hi | ||||
[l.] sq | [l.] sq | ||||
[l.] bn | [l.] bn | ||||
[y] fr | [y] fr | ||||
[u:] fr | [u:] fr | ||||
[w^i] fr | [w^i] fr | ||||
[(u)] en_klatt | |||||
l/l_u [(u)] base | l/l_u [(u)] base | ||||
[u] fr | [u] fr | ||||
[u:] fr | [u:] fr | ||||
[(u)] en_klatt | |||||
l/l_y [y] fr | l/l_y [y] fr | ||||
l/tl [l] base | l/tl [l] base | ||||
[l] en | [l] en | ||||
n^/_n^ [n^] base | n^/_n^ [n^] base | ||||
n^/n^_ [n^] base | n^/n^_ [n^] base | ||||
n^/n^@ [(@)] base | n^/n^@ [(@)] base | ||||
[(@)] en_klatt | |||||
n^/n^#_ [n^#] is | n^/n^#_ [n^#] is | ||||
n/_n [n] base | n/_n [n] base | ||||
[n;] ro | [n;] ro | ||||
n/n#_ [n#] is | n/n#_ [n#] is | ||||
[n] da | [n] da | ||||
n^/n^a [(a)] base | n^/n^a [(a)] base | ||||
[(a)] en_klatt | |||||
n/na [(a)] base | n/na [(a)] base | ||||
n^/n^e [(e)] base | n^/n^e [(e)] base | ||||
[(e)] en_klatt | |||||
n/ne [(e)] base | n/ne [(e)] base | ||||
n^/n^i [(i)] base | n^/n^i [(i)] base | ||||
[(i)] en_klatt | |||||
n/ni [(i)] base | n/ni [(i)] base | ||||
[n] zh | [n] zh | ||||
nn/inn [(i)] base | nn/inn [(i)] base | ||||
nn/nn_ [N] base | nn/nn_ [N] base | ||||
[N] en | [N] en | ||||
nn/nn@ [(@)] base | nn/nn@ [(@)] base | ||||
[(@)] en_klatt | |||||
nn/nn#_ [N#] is | nn/nn#_ [N#] is | ||||
nn/nn2_ [N] zh | nn/nn2_ [N] zh | ||||
[N-] zh | [N-] zh | ||||
nn/nno [(o)] base | nn/nno [(o)] base | ||||
nn/nnu [(u)] base | nn/nnu [(u)] base | ||||
n^/n^o [(o)] base | n^/n^o [(o)] base | ||||
[(o)] en_klatt | |||||
n/no [(o)] base | n/no [(o)] base | ||||
n/_nr [n.] base | n/_nr [n.] base | ||||
n/nr_ [n.] base | n/nr_ [n.] base | ||||
n^/n^u [(u)] base | n^/n^u [(u)] base | ||||
[(u)] en_klatt | |||||
n/nu [(u)] base | n/nu [(u)] base | ||||
r2/_r2 [r-] base | r2/_r2 [r-] base | ||||
r2/r2@ [(@)] base | r2/r2@ [(@)] base | ||||
r3/r_ [r/] base | r3/r_ [r/] base | ||||
[r/] af | [r/] af | ||||
[r/] ru | [r/] ru | ||||
[r/] en_klatt | |||||
r3/r_@ [(@)] base | r3/r_@ [(@)] base | ||||
[@2] fr | [@2] fr | ||||
[(@)] en_klatt | |||||
r3/r#_ [r#] is | r3/r#_ [r#] is | ||||
r3/r_2 [r/2] fr | r3/r_2 [r/2] fr | ||||
r3/r_a [(a)] base | r3/r_a [(a)] base | ||||
[(a)] en_klatt | |||||
r3/r_e [(e)] base | r3/r_e [(e)] base | ||||
[(e)] en_klatt | |||||
r3/r_i [(i)] base | r3/r_i [(i)] base | ||||
[i] fr | [i] fr | ||||
[w^i] fr | [w^i] fr | ||||
[(i)] en_klatt | |||||
r3/r_n [r/] base | r3/r_n [r/] base | ||||
[r/2] fr | [r/2] fr | ||||
[r/] ru | [r/] ru | ||||
[r/] en_klatt | |||||
r3/r_o [(o)] base | r3/r_o [(o)] base | ||||
[O] fr | [O] fr | ||||
[O2] fr | [O2] fr | ||||
[(o)] en_klatt | |||||
r3/r_ru [R4] ru | r3/r_ru [R4] ru | ||||
r3/r_ru2 [R4] ru | r3/r_ru2 [R4] ru | ||||
r3/r_sr [r.] bn | r3/r_sr [r.] bn | ||||
[r*] sr | [r*] sr | ||||
[x] pt | [x] pt | ||||
r3/r_u [(u)] base | r3/r_u [(u)] base | ||||
[(u)] en_klatt | |||||
r3/r_ulv [r"] hy | r3/r_ulv [r"] hy | ||||
r3/r_uvl [r"] hy | r3/r_uvl [r"] hy | ||||
r3/rx [*] base | r3/rx [*] base | ||||
[*;] ro | [*;] ro | ||||
[r#] is | [r#] is | ||||
[Q2] hy | [Q2] hy | ||||
[r/] en_klatt | |||||
r3/rz_cs [R^] sk | r3/rz_cs [R^] sk | ||||
[R^/] sk | [R^/] sk | ||||
r3/@tap [**] base | r3/@tap [**] base | ||||
[r] ro | [r] ro | ||||
[r] sw | [r] sw | ||||
[r.] bn | [r.] bn | ||||
[r] en_klatt | |||||
r/r@ [(@)] base | r/r@ [(@)] base | ||||
r/ra [(a)] base | r/ra [(a)] base | ||||
r/re [(e)] base | r/re [(e)] base | ||||
[r/] ru | [r/] ru | ||||
[r] ro | [r] ro | ||||
[r] sw | [r] sw | ||||
[r/] en_klatt | |||||
r/ru [(u)] base | r/ru [(u)] base | ||||
r/tr [r] base | r/tr [r] base | ||||
[r] en_sc | [r] en_sc | ||||
[r] ro | [r] ro | ||||
[r] sv | [r] sv | ||||
[r] sw | [r] sw | ||||
[r/] en_klatt | |||||
r/xr [(@)] base | r/xr [(@)] base | ||||
[(a)] base | [(a)] base | ||||
[(e)] base | [(e)] base | ||||
[s] es | [s] es | ||||
[s#] pt | [s#] pt | ||||
[s`] ko | [s`] ko | ||||
[s] en_klatt | |||||
ufric/s_ [s] base | ufric/s_ [s] base | ||||
[z] base | [z] base | ||||
[s2] fi | [s2] fi | ||||
[s#] pt | [s#] pt | ||||
[z;] ro | [z;] ro | ||||
[s2] is | [s2] is | ||||
[s] en_klatt | |||||
[z] en_klatt | |||||
ufric/s! [s] base | ufric/s! [s] base | ||||
[s2] fi | [s2] fi | ||||
[s] fr | [s] fr | ||||
[s] es | [s] es | ||||
[s#] pt | [s#] pt | ||||
[s2] is | [s2] is | ||||
[s] en_klatt | |||||
ufric/s_continue [s2] fi | ufric/s_continue [s2] fi | ||||
[s2] hu | [s2] hu | ||||
[s2] lv | [s2] lv | ||||
ufric/sh [S] base | ufric/sh [S] base | ||||
[S] fr | [S] fr | ||||
[s#] pt_pt | [s#] pt_pt | ||||
[S] en_klatt | |||||
ufric/sh_ [S] base | ufric/sh_ [S] base | ||||
[S] fr | [S] fr | ||||
[s#] pt_pt | [s#] pt_pt | ||||
[S] en_klatt | |||||
ufric/sh3 [S] hr | ufric/sh3 [S] hr | ||||
[Z] hr | [Z] hr | ||||
ufric/sh_pzd [S;] base | ufric/sh_pzd [S;] base | ||||
vdiph/aae [aI] en_us | vdiph/aae [aI] en_us | ||||
vdiph/aai [ai] lv | vdiph/aai [ai] lv | ||||
[aai] zhy | [aai] zhy | ||||
[aI] sq | |||||
[aI] ne | [aI] ne | ||||
vdiph/aai_2 [AI] af | vdiph/aai_2 [AI] af | ||||
[AY] cy | [AY] cy | ||||
[aI] id | [aI] id | ||||
[aI] kn | [aI] kn | ||||
[aI] hy | [aI] hy | ||||
vdiph/ai_2 [aI] cy | |||||
vdiph/ai_2 [aI] en | |||||
[aI] cy | |||||
[aY] cy | [aY] cy | ||||
vdiph/ai_3 [aI] no | vdiph/ai_3 [aI] no | ||||
vdiph/ai_4 [aI] af | vdiph/ai_4 [aI] af | ||||
vdiph/ai_7 [aI] en_sc | vdiph/ai_7 [aI] en_sc | ||||
[aI2] en_sc | [aI2] en_sc | ||||
[aI] is | [aI] is | ||||
vdiph/ai_en2 [aI] en | |||||
vdiph/aoo [aU] en_us | vdiph/aoo [aU] en_us | ||||
vdiph/au [aU] en | vdiph/au [aU] en | ||||
[aU] af | [aU] af | ||||
[v] fr | [v] fr | ||||
vocw/dh [D] base | vocw/dh [D] base | ||||
[D] es | [D] es | ||||
[D] en_klatt | |||||
vocw/Q [Q] base | vocw/Q [Q] base | ||||
[Q^] base | [Q^] base | ||||
vocw/Q_ [Q] base | vocw/Q_ [Q] base | ||||
[v] ta | [v] ta | ||||
[v#] es | [v#] es | ||||
[v;] ro | [v;] ro | ||||
[v] en_klatt | |||||
vocw/zh [Z] base | vocw/zh [Z] base | ||||
[Z;] ro | [Z;] ro | ||||
[Z] en_klatt | |||||
vocw/zh_rfx [z.] base | vocw/zh_rfx [z.] base | ||||
voc/z [z] base | voc/z [z] base | ||||
[z] fr | [z] fr | ||||
vowel/8_3 [eo] zhy | vowel/8_3 [eo] zhy | ||||
vowel/8_5 [8] ku | vowel/8_5 [8] ku | ||||
vowel/8_7 [@] lv | vowel/8_7 [@] lv | ||||
vowel/a [a] en_n | |||||
vowel/a [a] en | |||||
[aa] en | |||||
[a] en_n | |||||
[aa] en_n | [aa] en_n | ||||
[a] en_wm | [a] en_wm | ||||
[aa] en_wm | [aa] en_wm | ||||
[a] cy | [a] cy | ||||
[a] de | [a] de | ||||
[A] fr | |||||
[a] ta | [a] ta | ||||
[a:] hu | [a:] hu | ||||
[a:] nl | [a:] nl | ||||
[a] pl | |||||
[a] sk | [a] sk | ||||
[a:] sk | [a:] sk | ||||
[A] hr | [A] hr | ||||
vowel/aa_9 [a:] hi | vowel/aa_9 [a:] hi | ||||
[a:] bn | [a:] bn | ||||
[a] ne | [a] ne | ||||
vowel/a_en [a] en | |||||
[aa] en | |||||
[A] fr | |||||
[a] pl | |||||
vowel/@_bck [@] hi | vowel/@_bck [@] hi | ||||
[@/] hi | [@/] hi | ||||
[@] zh | [@] zh | ||||
vowel/e_e [E] en_sc | vowel/e_e [E] en_sc | ||||
[e] is | [e] is | ||||
vowel/ee# [E#] pl | vowel/ee# [E#] pl | ||||
[E] sq | |||||
vowel/ee_1 [E] base2 | vowel/ee_1 [E] base2 | ||||
[e@] en | [e@] en | ||||
[E] pl | [E] pl | ||||
[E#] ku | [E#] ku | ||||
[&] da | [&] da | ||||
vowel/ee#_2 [E-] sv | vowel/ee#_2 [E-] sv | ||||
[E] sq | |||||
vowel/ee_3 [&] af | vowel/ee_3 [&] af | ||||
[&:] af | [&:] af | ||||
[E] pt | [E] pt | ||||
[b;] ro | [b;] ro | ||||
[b] is | [b] is | ||||
[b] bn | [b] bn | ||||
[b] en_klatt | |||||
x/b_ [b] base | x/b_ [b] base | ||||
[b] fr | [b] fr | ||||
[b] en_klatt | |||||
x/d [d] base | x/d [d] base | ||||
[t#] en_us | [t#] en_us | ||||
[d] fr | [d] fr | ||||
[d] id | [d] id | ||||
[d.] bn | [d.] bn | ||||
[d`] om | [d`] om | ||||
[d] en_klatt | |||||
x/d_ [d] base | x/d_ [d] base | ||||
[d[] base | [d[] base | ||||
[d] base2 | [d] base2 | ||||
[d] id | [d] id | ||||
[d] bn | [d] bn | ||||
[d.] bn | [d.] bn | ||||
[d] en_klatt | |||||
x/d_dnt [d[] base | x/d_dnt [d[] base | ||||
[d] base2 | [d] base2 | ||||
[d] fi | [d] fi | ||||
[dZ] base | [dZ] base | ||||
[J2] hi | [J2] hi | ||||
[J2] bn | [J2] bn | ||||
[dZ] en_klatt | |||||
x/dzh_ [dZ] base | x/dzh_ [dZ] base | ||||
[dZ;] base | [dZ;] base | ||||
[dz;] base | [dz;] base | ||||
[dZ;] mk | [dZ;] mk | ||||
[dZ;] ru | [dZ;] ru | ||||
[J] bn | [J] bn | ||||
[dZ] en_klatt | |||||
x/dz_pzd [dZ;] base | x/dz_pzd [dZ;] base | ||||
[dz;] base | [dz;] base | ||||
[J] hi | [J] hi | ||||
[g] fr | [g] fr | ||||
[g] es | [g] es | ||||
[g] is | [g] is | ||||
[g] en_klatt | |||||
x/g2 [g] base | x/g2 [g] base | ||||
[g] cy | [g] cy | ||||
[g] fr | [g] fr | ||||
[g] es | [g] es | ||||
[g] is | [g] is | ||||
[g] bn | [g] bn | ||||
[g] en_klatt | |||||
x/g2_ [g-] base | x/g2_ [g-] base | ||||
[g] hi | [g] hi | ||||
[g] bn | [g] bn | ||||
[g-] en_klatt |
// Czech phonemes inherit from Slovak | |||||
phoneme e | phoneme e | ||||
vowel starttype (e) endtype (e) | vowel starttype (e) endtype (e) | ||||
length 120 | length 120 |
phoneme a | phoneme a | ||||
vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
length 150 | length 150 | ||||
formants vowel/a_en | |||||
// formants vowel/a_en | |||||
formants vowel/a | |||||
reduceto a2 0 | reduceto a2 0 | ||||
endphoneme | endphoneme | ||||
phoneme aa // 'bath' etc. | phoneme aa // 'bath' etc. | ||||
vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
length 150 | length 150 | ||||
formants vowel/a_en | |||||
// formants vowel/a_en | |||||
formants vowel/a | |||||
linkout r- | linkout r- | ||||
endphoneme | endphoneme | ||||
phoneme aI | phoneme aI | ||||
vowel starttype (a) endtype (i) | vowel starttype (a) endtype (i) | ||||
length 230 | length 230 | ||||
formants vdiph/ai_en2 | |||||
// formants vdiph/ai_en2 | |||||
formants vdiph/ai_2 | |||||
endphoneme | endphoneme | ||||
phoneme A // same as [a] | phoneme A // same as [a] | ||||
vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
length 166 | length 166 | ||||
formants vowel/a_en | |||||
formants vowel/a | |||||
endphoneme | endphoneme | ||||
phoneme a | phoneme a | ||||
vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
length 190 | length 190 | ||||
formants vowel/a_en | |||||
formants vowel/a | |||||
reduceto a# 0 | reduceto a# 0 | ||||
endphoneme | endphoneme | ||||
phonemetable om base | phonemetable om base | ||||
include ph_oromo | include ph_oromo | ||||
phonemetable en_klatt en | |||||
include ph_english_klatt | |||||
] |
int peak; | int peak; | ||||
int displ; | int displ; | ||||
int frame; | int frame; | ||||
int n_frames; | |||||
int ix; | int ix; | ||||
int x; | |||||
int x, x2; | |||||
int rms; | int rms; | ||||
float total; | float total; | ||||
float pkheight; | float pkheight; | ||||
int marker1_set=0; | int marker1_set=0; | ||||
int frame_vowelbreak=0; | int frame_vowelbreak=0; | ||||
int klatt_flag=0; | |||||
SpectFrame *fr; | SpectFrame *fr; | ||||
frame_t *fr_out; | |||||
wxString path_sep = _T("/"); | wxString path_sep = _T("/"); | ||||
SPECT_SEQ seq_out; | SPECT_SEQ seq_out; | ||||
SPECT_SEQK seqk_out; | |||||
// create SpectSeq and import data | // create SpectSeq and import data | ||||
spectseq = new SpectSeq; | spectseq = new SpectSeq; | ||||
} | } | ||||
spectseq->Load(stream); | spectseq->Load(stream); | ||||
if(spectseq->synthesizer_type == 1) | |||||
klatt_flag = FRFLAG_KLATT; | |||||
displ = ftell(f_phdata); | displ = ftell(f_phdata); | ||||
seq_out.n_frames=0; | seq_out.n_frames=0; | ||||
seq_out.flags=0; | seq_out.flags=0; | ||||
seq_out.length=0; | |||||
seq_out.length_total=0; | |||||
total = 0; | total = 0; | ||||
for(frame=0; frame < spectseq->numframes; frame++) | for(frame=0; frame < spectseq->numframes; frame++) | ||||
total += spectseq->frames[frame-1]->length; | total += spectseq->frames[frame-1]->length; | ||||
} | } | ||||
} | } | ||||
seq_out.length = int(total); | |||||
seq_out.length_total = int(total); | |||||
if((control & 1) && (marker1_set == 0)) | if((control & 1) && (marker1_set == 0)) | ||||
{ | { | ||||
spectseq->frames[frame_vowelbreak]->markers |= FRFLAG_VOWEL_CENTRE; | spectseq->frames[frame_vowelbreak]->markers |= FRFLAG_VOWEL_CENTRE; | ||||
} | } | ||||
ix = 0; | |||||
n_frames = 0; | |||||
for(frame=0; frame < spectseq->numframes; frame++) | for(frame=0; frame < spectseq->numframes; frame++) | ||||
{ | { | ||||
fr = spectseq->frames[frame]; | fr = spectseq->frames[frame]; | ||||
if(fr->keyframe) | if(fr->keyframe) | ||||
{ | { | ||||
if(klatt_flag) | |||||
fr_out = &seqk_out.frame[n_frames]; | |||||
else | |||||
fr_out = (frame_t *)&seq_out.frame[n_frames]; | |||||
x = int(fr->length + 0.5); // round to nearest mS | x = int(fr->length + 0.5); // round to nearest mS | ||||
if(x > 255) x = 255; | if(x > 255) x = 255; | ||||
seq_out.frame[ix].length = x; | |||||
fr_out->length = x; | |||||
fr_out->frflags = fr->markers | klatt_flag; | |||||
seq_out.frame[ix].frflags = fr->markers; | |||||
rms = int(fr->GetRms(spectseq->amplitude)); | rms = int(fr->GetRms(spectseq->amplitude)); | ||||
if(rms > 255) rms = 255; | if(rms > 255) rms = 255; | ||||
seq_out.frame[ix].rms = rms; | |||||
fr_out->rms = rms; | |||||
if(n_frames == (seq_out.n_frames-1)) | |||||
fr_out->length = 0; // give last frame zero length | |||||
if(ix == (seq_out.n_frames-1)) | |||||
seq_out.frame[ix].length = 0; // give last frame zero length | |||||
// write: peak data | // write: peak data | ||||
count_frames++; | count_frames++; | ||||
for(peak=0; peak<N_PEAKS; peak++) | for(peak=0; peak<N_PEAKS; peak++) | ||||
{ | { | ||||
seq_out.frame[ix].ffreq[peak] = fr->peaks[peak].pkfreq; | |||||
pkheight = spectseq->amplitude * fr->amp_adjust * fr->peaks[peak].pkheight; | |||||
pkheight = pkheight/640000; | |||||
if(pkheight > 255) pkheight = 255; | |||||
seq_out.frame[ix].fheight[peak] = int(pkheight); | |||||
fr_out->ffreq[peak] = fr->peaks[peak].pkfreq; | |||||
if(klatt_flag) | |||||
{ | |||||
pkheight = fr->peaks[peak].pkheight / 128; | |||||
} | |||||
else | |||||
{ | |||||
pkheight = spectseq->amplitude * fr->amp_adjust * fr->peaks[peak].pkheight; | |||||
pkheight = pkheight/640000; | |||||
if(pkheight > 255) pkheight = 255; | |||||
} | |||||
fr_out->fheight[peak] = int(pkheight); | |||||
if(peak < 6) | if(peak < 6) | ||||
{ | { | ||||
x = fr->peaks[peak].pkwidth/4; | |||||
x = fr->peaks[peak].pkwidth/2; | |||||
x2 = fr->peaks[peak].pkright; | |||||
if(klatt_flag == 0) | |||||
{ | |||||
x /= 2; | |||||
x2 /= 4; | |||||
} | |||||
if(x > 255) x = 255; | if(x > 255) x = 255; | ||||
seq_out.frame[ix].fwidth[peak] = x; | |||||
fr_out->fwidth[peak] = x; | |||||
x = fr->peaks[peak].pkright/4; | |||||
if(x > 255) x = 255; | |||||
seq_out.frame[ix].fright[peak] = x; | |||||
if(x2 > 255) x2 = 255; | |||||
fr_out->fright[peak] = x2; | |||||
} | } | ||||
} | } | ||||
#ifdef LOG_DETAIL | |||||
fprintf(f_errors,"Frame %d %3dmS rms=%3d flags=%2d pk=%4d %4d %4d",ix,seq_out.frame[ix].length, | |||||
seq_out.frame[ix].rms,seq_out.frame[ix].flags, | |||||
seq_out.frame[ix].peaks[1].pkfreq,seq_out.frame[ix].peaks[2].pkfreq,seq_out.frame[ix].peaks[3].pkfreq); | |||||
if(klatt_flag) | |||||
{ | |||||
if(fr->klatt_param[KLATT_Kopen] == 0) | |||||
{ | |||||
Error("Klatt_Kopen has value 0"); | |||||
} | |||||
// additional fields | |||||
for(ix=0; ix<N_KLATTP; ix++) | |||||
{ | |||||
fr_out->klattp[ix] = fr->klatt_param[ix]; | |||||
} | |||||
fr_out->fwidth6 = fr->peaks[6].pkwidth/2; | |||||
fr_out->fright6 = fr->peaks[6].pkright; | |||||
} | |||||
if(fr->markers != 0) | |||||
{ | |||||
fprintf(f_errors," [%x]",fr->markers); | |||||
} | |||||
fputc('\n',f_errors); | |||||
#endif | |||||
ix++; | |||||
n_frames++; | |||||
} | } | ||||
} | } | ||||
ix = (char *)(&seq_out.frame[seq_out.n_frames]) - (char *)(&seq_out); | |||||
ix = (ix+3) & 0xfffc; // round up to multiple of 4 bytes | |||||
if(klatt_flag) | |||||
{ | |||||
seqk_out.n_frames = seq_out.n_frames; | |||||
seqk_out.flags = seq_out.flags; | |||||
seqk_out.length_total = seq_out.length_total; | |||||
ix = (char *)(&seqk_out.frame[seqk_out.n_frames]) - (char *)(&seqk_out); | |||||
ix = (ix+3) & 0xfffc; // round up to multiple of 4 bytes | |||||
fwrite(&seqk_out,ix,1,f_phdata); | |||||
} | |||||
else | |||||
{ | |||||
ix = (char *)(&seq_out.frame[seq_out.n_frames]) - (char *)(&seq_out); | |||||
ix = (ix+3) & 0xfffc; // round up to multiple of 4 bytes | |||||
fwrite(&seq_out,ix,1,f_phdata); | |||||
} | |||||
fwrite(&seq_out,ix,1,f_phdata); | |||||
delete spectseq; | delete spectseq; | ||||
return(displ); | return(displ); | ||||
} // end of Compile::LoadSpect | } // end of Compile::LoadSpect |
group = atoi(&p[0]); | group = atoi(&p[0]); | ||||
if(group >= N_LETTER_GROUPS) | if(group >= N_LETTER_GROUPS) | ||||
{ | { | ||||
fprintf(f_log,"%5d: lettergroup out of range (01-%.2d)\n",linenum,N_LETTER_GROUPS); | |||||
fprintf(f_log,"%5d: lettergroup out of range (01-%.2d)\n",linenum,N_LETTER_GROUPS-1); | |||||
error_count++; | error_count++; | ||||
return(1); | return(1); | ||||
} | } |
win = new wxSashLayoutWindow(this, ID_WINDOW_LEFT2, | win = new wxSashLayoutWindow(this, ID_WINDOW_LEFT2, | ||||
wxDefaultPosition, wxSize(200, 30), | wxDefaultPosition, wxSize(200, 30), | ||||
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN); | wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN); | ||||
win->SetDefaultSize(wxSize(208, 1000)); | |||||
win->SetDefaultSize(wxSize(212, 1000)); | |||||
win->SetOrientation(wxLAYOUT_VERTICAL); | win->SetOrientation(wxLAYOUT_VERTICAL); | ||||
win->SetAlignment(wxLAYOUT_LEFT); | win->SetAlignment(wxLAYOUT_LEFT); | ||||
// win->SetBackgroundColour(wxColour(0, 255, 255)); | // win->SetBackgroundColour(wxColour(0, 255, 255)); |
BEGIN_EVENT_TABLE(FormantDlg, wxPanel) | BEGIN_EVENT_TABLE(FormantDlg, wxPanel) | ||||
EVT_BUTTON(T_ZOOMOUT,FormantDlg::OnCommand) | EVT_BUTTON(T_ZOOMOUT,FormantDlg::OnCommand) | ||||
EVT_BUTTON(T_ZOOMIN,FormantDlg::OnCommand) | EVT_BUTTON(T_ZOOMIN,FormantDlg::OnCommand) | ||||
EVT_SPINCTRL(T_AMPLITUDE,FormantDlg::OnSpin) | |||||
EVT_SPINCTRL(T_TIMESEQ,FormantDlg::OnSpin) | |||||
EVT_SPINCTRL(T_AMPFRAME,FormantDlg::OnSpin) | |||||
EVT_SPINCTRL(T_TIMEFRAME,FormantDlg::OnSpin) | |||||
EVT_SPINCTRL(-1,FormantDlg::OnSpin) | |||||
// EVT_SPINCTRL(T_TIMESEQ,FormantDlg::OnSpin) | |||||
// EVT_SPINCTRL(T_AMPFRAME,FormantDlg::OnSpin) | |||||
// EVT_SPINCTRL(T_TIMEFRAME,FormantDlg::OnSpin) | |||||
END_EVENT_TABLE() | END_EVENT_TABLE() | ||||
switch(id = event.GetId()) | switch(id = event.GetId()) | ||||
{ | { | ||||
case T_AMPLITUDE: | |||||
case T_TIMESEQ: | |||||
case T_TIMEFRAME: | |||||
currentcanvas->RefreshDialogValues(0); | |||||
break; | |||||
case T_AMPFRAME: | case T_AMPFRAME: | ||||
currentcanvas->RefreshDialogValues(1); | currentcanvas->RefreshDialogValues(1); | ||||
break; | break; | ||||
default: | |||||
currentcanvas->RefreshDialogValues(0); | |||||
break; | |||||
} | } | ||||
currentcanvas->SetFocus(); | currentcanvas->SetFocus(); | ||||
} | } | ||||
FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,1000)) | FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,1000)) | ||||
{//========================================================================== | |||||
{//============================================================================================= | |||||
int ix; | int ix; | ||||
int y; | int y; | ||||
int xplace; | int xplace; | ||||
xplace = 28; | xplace = 28; | ||||
id = 201; | id = 201; | ||||
new wxStaticText(this,-1,_T("Formants"),wxPoint(4,5)); | new wxStaticText(this,-1,_T("Formants"),wxPoint(4,5)); | ||||
t_lab[4] = new wxStaticText(this,-1,_T(" BW BWp Ap"),wxPoint(78,5),wxSize(300,20)); | |||||
for(ix=0; ix<N_PEAKS; ix++) | for(ix=0; ix<N_PEAKS; ix++) | ||||
{ | { | ||||
wxPoint(xplace,y+24*ix),wxSize(48,20), | wxPoint(xplace,y+24*ix),wxSize(48,20), | ||||
wxTE_CENTRE+wxTE_READONLY); | wxTE_CENTRE+wxTE_READONLY); | ||||
t_pkheight[ix] = new wxTextCtrl(this,id++,_T(""), | t_pkheight[ix] = new wxTextCtrl(this,id++,_T(""), | ||||
wxPoint(xplace+52,y+24*ix),wxSize(36,20), | |||||
wxPoint(xplace+50,y+24*ix),wxSize(36,20), | |||||
wxTE_CENTRE+wxTE_READONLY); | wxTE_CENTRE+wxTE_READONLY); | ||||
t_pkwidth[ix] = new wxTextCtrl(this,id++,_T(""), | t_pkwidth[ix] = new wxTextCtrl(this,id++,_T(""), | ||||
wxPoint(xplace+92,y+24*ix),wxSize(48,20), | |||||
wxPoint(xplace+88,y+24*ix),wxSize(48,20), | |||||
wxTE_CENTRE+wxTE_READONLY); | wxTE_CENTRE+wxTE_READONLY); | ||||
#ifdef WIDTH2 | |||||
t_pkright[ix] = new wxTextCtrl(this,id++,_T(""), | t_pkright[ix] = new wxTextCtrl(this,id++,_T(""), | ||||
wxPoint(xplace+132,y+24*ix),wxSize(36,20), | |||||
wxPoint(xplace+138,y+24*ix),wxSize(36,20), | |||||
wxTE_CENTRE+wxTE_READONLY); | wxTE_CENTRE+wxTE_READONLY); | ||||
#endif | |||||
if(ix>5) t_pkwidth[ix]->Hide(); | if(ix>5) t_pkwidth[ix]->Hide(); | ||||
} | } | ||||
t_ampframe = new wxSpinCtrl(this,T_AMPFRAME,_T(""), | |||||
wxPoint(6,244),wxSize(52,24),wxTE_CENTRE,0,500); | |||||
t_lab[3] = new wxStaticText(this,-1,_T("% amp - Frame"),wxPoint(61,248)); | |||||
t_timeframe = new wxSpinCtrl(this,T_TIMEFRAME,_T(""), | |||||
wxPoint(6,272),wxSize(52,24),wxTE_CENTRE,0,500); | |||||
t_orig_frame = new wxStaticText(this,-1,_T("mS"),wxPoint(61,276)); | |||||
y=240; | |||||
t_timeframe = new wxSpinCtrl(this,T_TIMEFRAME,_T(""), wxPoint(6,y+0), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_orig_frame = new wxStaticText(this,-1,_T("mS"),wxPoint(57,y+8)); | |||||
t_ampframe = new wxSpinCtrl(this,T_AMPFRAME,_T(""), wxPoint(100,y+0), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_lab[3] = new wxStaticText(this,-1,_T("% amp - Frame"),wxPoint(151,y+8)); | |||||
s_klatt[KLATT_AV] = new wxSpinCtrl(this,T_AV,_T(""), wxPoint(6,y+32), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_AV] = new wxStaticText(this,-1,_T("AV"),wxPoint(61,y+36)); | |||||
s_klatt[KLATT_AVp] = new wxSpinCtrl(this,T_AVP,_T(""), wxPoint(100,y+32), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_AVp] = new wxStaticText(this,-1,_T("AVp"),wxPoint(155,y+36)); | |||||
t_zoomout = new wxButton(this,T_ZOOMOUT,_T("Zoom-"),wxPoint(16,310)); | |||||
t_zoomin = new wxButton(this,T_ZOOMIN,_T("Zoom+"),wxPoint(106,310)); | |||||
s_klatt[KLATT_Fric] = new wxSpinCtrl(this,T_FRIC,_T(""), wxPoint(6,y+60), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Fric] = new wxStaticText(this,-1,_T("Fric"),wxPoint(61,y+64)); | |||||
s_klatt[KLATT_FricBP] = new wxSpinCtrl(this,T_FRICBP,_T(""), wxPoint(100,y+60), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_FricBP] = new wxStaticText(this,-1,_T("FricBP"),wxPoint(155,y+64)); | |||||
s_klatt[KLATT_Aspr] = new wxSpinCtrl(this,T_ASPR,_T(""), wxPoint(6,y+88), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Aspr] = new wxStaticText(this,-1,_T("Aspr"),wxPoint(61,y+92)); | |||||
s_klatt[KLATT_Turb] = new wxSpinCtrl(this,T_TURB,_T(""), wxPoint(100,y+88), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Turb] = new wxStaticText(this,-1,_T("Turb"),wxPoint(155,y+92)); | |||||
// usepitchenv = new wxCheckBox(this,T_USEPITCHENV,_T("???"),wxPoint(20,320)); | |||||
s_klatt[KLATT_Skew] = new wxSpinCtrl(this,T_SKEW,_T(""), wxPoint(6,y+116), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Skew] = new wxStaticText(this,-1,_T("Skew"),wxPoint(61,y+120)); | |||||
s_klatt[KLATT_Tilt] = new wxSpinCtrl(this,T_TILT,_T(""), wxPoint(100,y+116), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Tilt] = new wxStaticText(this,-1,_T("Tilt"),wxPoint(155,y+120)); | |||||
s_klatt[KLATT_Kopen] = new wxSpinCtrl(this,T_KOPEN,_T(""), wxPoint(6,y+144), wxSize(52,24), wxTE_CENTRE,0,500); | |||||
t_klatt[KLATT_Kopen] = new wxStaticText(this,-1,_T("kopen"),wxPoint(61,y+148)); | |||||
t_zoomout = new wxButton(this,T_ZOOMOUT,_T("Zoom-"),wxPoint(16,420)); | |||||
t_zoomin = new wxButton(this,T_ZOOMIN,_T("Zoom+"),wxPoint(106,420)); | |||||
y=468; | |||||
t_amplitude = new wxSpinCtrl(this,T_AMPLITUDE,_T(""), | t_amplitude = new wxSpinCtrl(this,T_AMPLITUDE,_T(""), | ||||
wxPoint(6,370),wxSize(52,24),wxTE_CENTRE,0,500); | |||||
t_lab[2] = new wxStaticText(this,-1,_T("% amp - Sequence"),wxPoint(61,374)); | |||||
wxPoint(6,y),wxSize(52,24),wxTE_CENTRE,0,y+130); | |||||
t_lab[2] = new wxStaticText(this,-1,_T("% amp - Sequence"),wxPoint(61,y+4)); | |||||
// t_timeseq = new wxSpinCtrl(this,T_TIMESEQ,_T(""), | // t_timeseq = new wxSpinCtrl(this,T_TIMESEQ,_T(""), | ||||
// wxPoint(6,400),wxSize(52,24),wxTE_CENTRE,0,500); | // wxPoint(6,400),wxSize(52,24),wxTE_CENTRE,0,500); | ||||
t_orig_seq = new wxStaticText(this,-1,_T("mS"),wxPoint(61,404)); | |||||
t_orig_seq = new wxStaticText(this,-1,_T("mS"),wxPoint(61,y+30)); | |||||
t_pitch = new wxStaticText(this,-1,_T(""),wxPoint(4,440),wxSize(192,24)); | |||||
t_pitch = new wxStaticText(this,-1,_T(""),wxPoint(4,520),wxSize(192,24)); | |||||
pitchgraph = new ByteGraph(this,wxPoint(0,460),wxSize(200,140)); | |||||
pitchgraph = new ByteGraph(this,wxPoint(0,538),wxSize(200,140)); | |||||
pitchgraph->SetData(128,env_fall); | pitchgraph->SetData(128,env_fall); | ||||
pitchgraph->ShowSpectrum(1); | pitchgraph->ShowSpectrum(1); | ||||
pitchgraph->Show(); | pitchgraph->Show(); | ||||
} | } | ||||
void FormantDlg::HideFields(int synth_type) | |||||
{//======================================= | |||||
int ix; | |||||
static int prev_synth_type = -1; | |||||
if(synth_type == prev_synth_type) | |||||
return; // no change | |||||
if(synth_type == 0) | |||||
{ | |||||
for(ix=0; ix<9; ix++) | |||||
{ | |||||
s_klatt[ix]->Hide(); | |||||
t_klatt[ix]->Hide(); | |||||
} | |||||
for(ix=6; ix<9; ix++) | |||||
{ | |||||
t_pkfreq[ix]->Show(); | |||||
t_pkheight[ix]->Show(); | |||||
t_pkwidth[ix]->Hide(); | |||||
t_pkright[ix]->Hide(); | |||||
} | |||||
t_ampframe->Show(); | |||||
t_amplitude->Show(); | |||||
t_lab[2]->Show(); | |||||
t_lab[3]->Show(); | |||||
t_labpk[7]->Show(); | |||||
t_labpk[8]->Show(); | |||||
t_lab[4]->Hide(); | |||||
} | |||||
else | |||||
{ | |||||
for(ix=0; ix<9; ix++) | |||||
{ | |||||
s_klatt[ix]->Show(); | |||||
t_klatt[ix]->Show(); | |||||
} | |||||
for(ix=7; ix<9; ix++) | |||||
{ | |||||
t_pkfreq[ix]->Hide(); | |||||
t_pkheight[ix]->Hide(); | |||||
t_pkwidth[ix]->Hide(); | |||||
t_pkright[ix]->Hide(); | |||||
} | |||||
t_pkwidth[6]->Show(1); | |||||
t_pkright[6]->Show(1); | |||||
t_ampframe->Hide(); | |||||
t_amplitude->Hide(); | |||||
t_lab[2]->Hide(); | |||||
t_lab[3]->Hide(); | |||||
t_labpk[7]->Hide(); | |||||
t_labpk[8]->Hide(); | |||||
t_lab[4]->Show(); | |||||
} | |||||
prev_synth_type = synth_type; | |||||
} | |||||
void FormantDlg::ShowFrame(SpectSeq *spectseq, int frame, int pk, int field) | void FormantDlg::ShowFrame(SpectSeq *spectseq, int frame, int pk, int field) | ||||
{//============================================================== | {//============================================================== | ||||
return; | return; | ||||
sf = spectseq->frames[frame]; | sf = spectseq->frames[frame]; | ||||
HideFields(spectseq->synthesizer_type); | |||||
if(field == 0xff) | if(field == 0xff) | ||||
{ | { | ||||
// indicate the selected peak | // indicate the selected peak | ||||
{ | { | ||||
value.Printf(_T("%3d"),sf->peaks[ix].pkwidth); | value.Printf(_T("%3d"),sf->peaks[ix].pkwidth); | ||||
t_pkwidth[ix]->SetValue(value); | t_pkwidth[ix]->SetValue(value); | ||||
#ifdef WIDTH2 | |||||
value.Printf(_T("%3d"),sf->peaks[ix].pkright); | value.Printf(_T("%3d"),sf->peaks[ix].pkright); | ||||
t_pkright[ix]->SetValue(value); | t_pkright[ix]->SetValue(value); | ||||
#endif | |||||
} | } | ||||
} | } | ||||
t_orig_frame->SetLabel(value); | t_orig_frame->SetLabel(value); | ||||
value.Printf(_T("%3d"),sf->amp_adjust); | value.Printf(_T("%3d"),sf->amp_adjust); | ||||
t_ampframe->SetValue(value); | t_ampframe->SetValue(value); | ||||
if(spectseq->synthesizer_type == 1) | |||||
{ | |||||
for(ix=0; ix<9; ix++) | |||||
{ | |||||
SetSpinCtrl(s_klatt[ix], sf->klatt_param[ix]); | |||||
} | |||||
} | |||||
} // end of FormantDlg::ShowFrame | } // end of FormantDlg::ShowFrame | ||||
#define CASCADE_PARALLEL 1 /* Type of synthesis model */ | |||||
#define ALL_PARALLEL 2 | |||||
#define IMPULSIVE 1 /* Type of voicing source */ | |||||
#define NATURAL 2 | |||||
#define SAMPLED 3 | |||||
#define PI 3.1415927 | |||||
/* typedef's that need to be exported */ | |||||
typedef long flag; | |||||
/* Resonator Structure */ | |||||
typedef struct | |||||
{ | |||||
double a; | |||||
double b; | |||||
double c; | |||||
double p1; | |||||
double p2; | |||||
double a_inc; | |||||
double b_inc; | |||||
double c_inc; | |||||
} resonator_t, *resonator_ptr; | |||||
/* Structure for Klatt Globals */ | |||||
typedef struct | |||||
{ | |||||
flag synthesis_model; /* cascade-parallel or all-parallel */ | |||||
flag outsl; /* Output waveform selector */ | |||||
long samrate; /* Number of output samples per second */ | |||||
long FLPhz ; /* Frequeny of glottal downsample low-pass filter */ | |||||
long BLPhz ; /* Bandwidth of glottal downsample low-pass filter */ | |||||
flag glsource; /* Type of glottal source */ | |||||
int f0_flutter; /* Percentage of f0 flutter 0-100 */ | |||||
long nspfr; /* number of samples per frame */ | |||||
long nper; /* Counter for number of samples in a pitch period */ | |||||
long ns; | |||||
long T0; /* Fundamental period in output samples times 4 */ | |||||
long nopen; /* Number of samples in open phase of period */ | |||||
long nmod; /* Position in period to begin noise amp. modul */ | |||||
long nrand; /* Varible used by random number generator */ | |||||
double pulse_shape_a; /* Makes waveshape of glottal pulse when open */ | |||||
double pulse_shape_b; /* Makes waveshape of glottal pulse when open */ | |||||
double minus_pi_t; | |||||
double two_pi_t; | |||||
double onemd; | |||||
double decay; | |||||
double amp_bypas; /* AB converted to linear gain */ | |||||
double amp_voice; /* AVdb converted to linear gain */ | |||||
double par_amp_voice; /* AVpdb converted to linear gain */ | |||||
double amp_aspir; /* AP converted to linear gain */ | |||||
double amp_frica; /* AF converted to linear gain */ | |||||
double amp_breth; /* ATURB converted to linear gain */ | |||||
double amp_gain0; /* G0 converted to linear gain */ | |||||
int num_samples; /* number of glottal samples */ | |||||
double sample_factor; /* multiplication factor for glottal samples */ | |||||
short *natural_samples; /* pointer to an array of glottal samples */ | |||||
long original_f0; /* original value of f0 not modified by flutter */ | |||||
int fadeout; // set to 64 to cause fadeout over 64 samples | |||||
int scale_wav; // depends on the voicing source | |||||
#define N_RSN 20 | |||||
#define Rnpc 0 | |||||
#define R1c 1 | |||||
#define R2c 2 | |||||
#define R3c 3 | |||||
#define R4c 4 | |||||
#define R5c 5 | |||||
#define R6c 6 | |||||
#define R7c 7 | |||||
#define R8c 8 | |||||
#define Rnz 9 | |||||
#define Rparallel 10 | |||||
#define Rnpp 10 | |||||
#define R1p 11 | |||||
#define R2p 12 | |||||
#define R3p 13 | |||||
#define R4p 14 | |||||
#define R5p 15 | |||||
#define R6p 16 | |||||
#define RGL 17 | |||||
#define RLP 18 | |||||
#define Rout 19 | |||||
resonator_t rsn[N_RSN]; // internal storage for resonators | |||||
resonator_t rsn_next[N_RSN]; | |||||
} klatt_global_t, *klatt_global_ptr; | |||||
/* Structure for Klatt Parameters */ | |||||
#define F_NP 0 // nasal zero formant | |||||
#define F1 1 | |||||
#define F2 2 | |||||
#define F3 3 | |||||
#define F4 4 | |||||
#define F5 5 | |||||
#define F6 6 | |||||
#define F_NZ 9 // nasal pole formant | |||||
typedef struct | |||||
{ | |||||
long F0hz10; /* Voicing fund freq in Hz */ | |||||
long AVdb; /* Amp of voicing in dB, 0 to 70 */ | |||||
int Fhz[10]; // formant Hz, F_NZ to F6 to F_NP | |||||
int Bhz[10]; | |||||
int Ap[10]; /* Amp of parallel formants in dB, 0 to 80 */ | |||||
int Bphz[10]; /* Parallel formants bw in Hz, 40 to 1000 */ | |||||
long ASP; /* Amp of aspiration in dB, 0 to 70 */ | |||||
long Kopen; /* # of samples in open period, 10 to 65 */ | |||||
long Aturb; /* Breathiness in voicing, 0 to 80 */ | |||||
long TLTdb; /* Voicing spectral tilt in dB, 0 to 24 */ | |||||
long AF; /* Amp of frication in dB, 0 to 80 */ | |||||
long Kskew; /* Skewness of alternate periods, 0 to 40 in sample#/2 */ | |||||
long AB; /* Amp of bypass fric. in dB, 0 to 80 */ | |||||
long AVpdb; /* Amp of voicing, par in dB, 0 to 70 */ | |||||
long Gain0; /* Overall gain, 60 dB is unity, 0 to 60 */ | |||||
long AVdb_tmp; //copy of AVdb, which is changed within parwave() | |||||
int Fhz_next[10]; // Fhz for the next chunk, so we can do interpolation of resonator (a,b,c) parameters | |||||
int Bhz_next[10]; | |||||
} klatt_frame_t, *klatt_frame_ptr; | |||||
pw++; | pw++; | ||||
sign = -1; | sign = -1; | ||||
} | } | ||||
value = wcstod(pw,&tail); | |||||
value = (float)wcstod(pw,&tail); | |||||
if(tail == pw) | if(tail == pw) | ||||
{ | { | ||||
// failed to find a number, return 100% | // failed to find a number, return 100% |
} | } | ||||
buf[0] = 0; | buf[0] = 0; | ||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Speech\\Voices\\Tokens\\eSpeak", 0, KEY_READ, &RegKey); | |||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Speech\\Voices\\Tokens\\eSpeak", 0, KEY_READ, &RegKey); | |||||
size = sizeof(buf); | size = sizeof(buf); | ||||
var_type = REG_SZ; | var_type = REG_SZ; | ||||
RegQueryValueEx(RegKey, "path", 0, &var_type, buf, &size); | |||||
RegQueryValueExA(RegKey, "path", 0, &var_type, buf, &size); | |||||
sprintf(path_home,"%s\\espeak-data",buf); | sprintf(path_home,"%s\\espeak-data",buf); | ||||
double x; | double x; | ||||
unsigned short *spect_data; | unsigned short *spect_data; | ||||
wxTextInputStream stream(stream1); | |||||
synthesizer_type = 0; | |||||
wxTextInputStream stream(stream1); | |||||
stream >> time; | stream >> time; | ||||
stream >> pitch; | stream >> pitch; | ||||
int SpectFrame::Load(wxInputStream& stream) | |||||
{//======================================== | |||||
int SpectFrame::Load(wxInputStream& stream, int synth_type) | |||||
{//======================================================== | |||||
int ix; | int ix; | ||||
int x; | int x; | ||||
unsigned short *spect_data; | unsigned short *spect_data; | ||||
synthesizer_type = synth_type; | |||||
wxDataInputStream s(stream); | wxDataInputStream s(stream); | ||||
time = s.ReadDouble(); | time = s.ReadDouble(); | ||||
peaks[ix].pkright = s.Read16(); | peaks[ix].pkright = s.Read16(); | ||||
} | } | ||||
if(synthesizer_type == 1) | |||||
{ | |||||
for(ix=0; ix<N_KLATTP; ix++) | |||||
{ | |||||
klatt_param[ix] = s.Read16(); | |||||
} | |||||
} | |||||
spect_data = new USHORT[nx]; | spect_data = new USHORT[nx]; | ||||
if(spect_data == NULL) | if(spect_data == NULL) | ||||
{//========================================= | {//========================================= | ||||
int ix; | int ix; | ||||
wxDataOutputStream s(stream); | |||||
wxDataOutputStream s(stream); | |||||
s.WriteDouble(time); | s.WriteDouble(time); | ||||
s.WriteDouble(pitch); | s.WriteDouble(pitch); | ||||
s.Write16(peaks[ix].pkright); | s.Write16(peaks[ix].pkright); | ||||
} | } | ||||
if(synthesizer_type == 1) | |||||
{ | |||||
for(ix=0; ix<N_KLATTP; ix++) | |||||
{ | |||||
s.Write16(klatt_param[ix]); | |||||
} | |||||
} | |||||
for(ix=0; ix<nx; ix++) | for(ix=0; ix<nx; ix++) | ||||
{ | { | ||||
s.Write16(spect[ix]); | s.Write16(spect[ix]); | ||||
void SpectFrame::CopyPeaks(SpectFrame *sf) | void SpectFrame::CopyPeaks(SpectFrame *sf) | ||||
{//======================================= | {//======================================= | ||||
memcpy(peaks,sf->peaks,sizeof(peaks)); | memcpy(peaks,sf->peaks,sizeof(peaks)); | ||||
memcpy(klatt_param, sf->klatt_param, sizeof(klatt_param)); | |||||
keyframe = sf->keyframe; | keyframe = sf->keyframe; | ||||
} | } | ||||
int y1, y2; | int y1, y2; | ||||
double yy; | double yy; | ||||
int max_ix; | int max_ix; | ||||
int height; | |||||
int pkright; | |||||
int pkwidth; | |||||
int buf[DRAWPEAKWIDTH*2]; | int buf[DRAWPEAKWIDTH*2]; | ||||
max_ix = int(9000 * scale_x); | max_ix = int(9000 * scale_x); | ||||
if((pk->pkfreq == 0) || (pk->pkheight==0)) continue; | if((pk->pkfreq == 0) || (pk->pkheight==0)) continue; | ||||
if(synthesizer_type==1) | |||||
{ | |||||
if(peak==0) continue; | |||||
height = pk->pkheight + (64 * 64); | |||||
height = (500000/height) * 100; | |||||
pkright = pkwidth = pk->pkheight / 16; | |||||
} | |||||
else | |||||
{ | |||||
height = pk->pkheight; | |||||
pkright = pk->pkright; | |||||
pkwidth = pk->pkwidth; | |||||
} | |||||
x1 = (int)(pk->pkfreq*scale_x); | x1 = (int)(pk->pkfreq*scale_x); | ||||
x2 = (int)((pk->pkfreq + pk->pkright)*scale_x); | |||||
x3 = (int)((pk->pkfreq - pk->pkwidth)*scale_x); | |||||
x2 = (int)((pk->pkfreq + pkright)*scale_x); | |||||
x3 = (int)((pk->pkfreq - pkwidth)*scale_x); | |||||
if(x3 >= DRAWPEAKWIDTH) | if(x3 >= DRAWPEAKWIDTH) | ||||
continue; // whole peak is off the scale | continue; // whole peak is off the scale | ||||
if((width = x2-x1) <= 0) continue; | if((width = x2-x1) <= 0) continue; | ||||
for(ix=0; ix<width; ix++) | for(ix=0; ix<width; ix++) | ||||
{ | { | ||||
buf[x1+ix] += pk->pkheight * pk_shape1[(ix*PEAKSHAPEW)/width]; | |||||
buf[x1+ix] += height * pk_shape1[(ix*PEAKSHAPEW)/width]; | |||||
} | } | ||||
if((width = x1-x3) <= 0) continue; | if((width = x1-x3) <= 0) continue; | ||||
{ | { | ||||
if(x3+ix >= 0) | if(x3+ix >= 0) | ||||
{ | { | ||||
buf[x3+ix] += pk->pkheight * pk_shape1[((width-ix)*PEAKSHAPEW)/width]; | |||||
buf[x3+ix] += height * pk_shape1[((width-ix)*PEAKSHAPEW)/width]; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} // end of SpectFrame::Draw | } // end of SpectFrame::Draw | ||||
void SpectFrame::KlattDefaults() | |||||
{//============================ | |||||
// set default values for Klatt parameters | |||||
int pk; | |||||
int bw; | |||||
int bw3; | |||||
synthesizer_type = 1; | |||||
klatt_param[KLATT_AV] = 59; | |||||
klatt_param[KLATT_AVp] = 0; | |||||
klatt_param[KLATT_Fric] = 0; | |||||
klatt_param[KLATT_FricBP] = 0; | |||||
klatt_param[KLATT_Aspr] = 0; | |||||
klatt_param[KLATT_Turb] = 0; | |||||
klatt_param[KLATT_Skew] = 0; | |||||
klatt_param[KLATT_Tilt] = 0; | |||||
klatt_param[KLATT_Kopen] = 40; | |||||
klatt_param[KLATT_spare1] = 0; | |||||
bw = 60; | |||||
if(peaks[1].pkfreq < 400) | |||||
bw = 55; | |||||
if(peaks[1].pkfreq > 600) | |||||
bw = 70; | |||||
if(peaks[1].pkfreq > 650) | |||||
bw = 80; | |||||
if(peaks[1].pkfreq > 750) | |||||
bw = 90; | |||||
peaks[1].pkwidth = bw; | |||||
bw = 90; | |||||
bw3 = 150; | |||||
if(peaks[2].pkfreq < 1000) | |||||
{ | |||||
bw = 80; | |||||
bw3 = 120; | |||||
} | |||||
if(peaks[2].pkfreq > 1600) | |||||
{ | |||||
bw = 100; | |||||
bw3 = 200; | |||||
} | |||||
if(peaks[2].pkfreq > 2000) | |||||
{ | |||||
bw = 110; | |||||
bw3 = 250; | |||||
} | |||||
peaks[2].pkwidth = bw; | |||||
peaks[3].pkwidth = bw3; | |||||
peaks[4].pkwidth = 200; | |||||
peaks[5].pkwidth = 200; | |||||
peaks[6].pkwidth = 500; | |||||
peaks[0].pkfreq = 280; // FNP | |||||
peaks[0].pkwidth = 280; // FNZ | |||||
peaks[7].pkfreq = 7800; | |||||
peaks[7].pkwidth = 0; | |||||
peaks[8].pkfreq = 9000; | |||||
peaks[8].pkwidth = 0; | |||||
for(pk=0; pk<=8; pk++) | |||||
{ | |||||
peaks[pk].pkheight = peaks[pk].pkwidth << 6; | |||||
peaks[pk].pkright = 0; | |||||
} | |||||
} |
#define T_TIMEFRAME 310 | #define T_TIMEFRAME 310 | ||||
#define T_TIMESEQ 311 | #define T_TIMESEQ 311 | ||||
#define T_AV 312 | |||||
#define T_AVP 313 | |||||
#define T_FRIC 314 | |||||
#define T_FRICBP 315 | |||||
#define T_ASPR 316 | |||||
#define T_TURB 317 | |||||
#define T_SKEW 318 | |||||
#define T_TILT 319 | |||||
#define T_KOPEN 320 | |||||
#define FILEID1_SPECTSEQ 0x43455053 | #define FILEID1_SPECTSEQ 0x43455053 | ||||
#define FILEID2_SPECTSEQ 0x51455354 | |||||
#define FILEID2_SPECTSEQ 0x51455354 // for eSpeak sequence | |||||
#define FILEID2_SPECTSEK 0x4b455354 // for Klatt sequence | |||||
#define FILEID1_SPC2 0x32435053 // an old format for spectrum files | #define FILEID1_SPC2 0x32435053 // an old format for spectrum files | ||||
~SpectFrame(); | ~SpectFrame(); | ||||
int Import(wxInputStream &stream); | int Import(wxInputStream &stream); | ||||
int ImportSPC2(wxInputStream &stream, float &time_acc); | int ImportSPC2(wxInputStream &stream, float &time_acc); | ||||
int Load(wxInputStream &stream); | |||||
int Load(wxInputStream &stream, int synthesizer_type); | |||||
int Save(wxOutputStream &stream); | int Save(wxOutputStream &stream); | ||||
void Draw(wxDC &dc, int offy, int frame_width, double scalex, double scaley); | void Draw(wxDC &dc, int offy, int frame_width, double scalex, double scaley); | ||||
void MakeWave(int peaks, PitchEnvelope &pitch, int amplitude, int duration); | void MakeWave(int peaks, PitchEnvelope &pitch, int amplitude, int duration); | ||||
void MakeHtab(int numh, int *htab, int pitch); | void MakeHtab(int numh, int *htab, int pitch); | ||||
double GetRms(int amp); | double GetRms(int amp); | ||||
void KlattDefaults(); | |||||
int selected; | int selected; | ||||
int keyframe; | int keyframe; | ||||
int nx; | int nx; | ||||
int markers; | int markers; | ||||
int max_y; | int max_y; | ||||
int synthesizer_type; // 0=eSpeak, 1=Klatt | |||||
USHORT *spect; // sqrt of harmonic amplitudes, 1-nx at 'pitch' | USHORT *spect; // sqrt of harmonic amplitudes, 1-nx at 'pitch' | ||||
short klatt_param[N_KLATTP]; | |||||
formant_t formants[N_PEAKS]; // this is just the estimate given by Praat | formant_t formants[N_PEAKS]; // this is just the estimate given by Praat | ||||
peak_t peaks[N_PEAKS]; | peak_t peaks[N_PEAKS]; | ||||
float GetKeyedLength(); | float GetKeyedLength(); | ||||
void SetFrameLengths(); | void SetFrameLengths(); | ||||
void ConstructVowel(void); | void ConstructVowel(void); | ||||
void SetKlattDefaults(void); | |||||
int numframes; | int numframes; | ||||
int amplitude; | int amplitude; | ||||
int spare; | int spare; | ||||
int bass_reduction; | int bass_reduction; | ||||
int max_x; | int max_x; | ||||
int max_y; | int max_y; | ||||
int synthesizer_type; | |||||
private: | private: | ||||
void Load2(wxInputStream& stream, int import, int n); | void Load2(wxInputStream& stream, int import, int n); | ||||
public: | public: | ||||
FormantDlg(wxWindow *parent); | FormantDlg(wxWindow *parent); | ||||
void ShowFrame(SpectSeq *spectseq, int frame, int pk, int field); | void ShowFrame(SpectSeq *spectseq, int frame, int pk, int field); | ||||
void OnCommand(wxCommandEvent& event); | |||||
void OnSpin(wxSpinEvent& event); | |||||
void OnCommand(wxCommandEvent& event); | |||||
void OnSpin(wxSpinEvent& event); | |||||
void HideFields(int synth_type); | |||||
wxCheckBox *usepitchenv; | wxCheckBox *usepitchenv; | ||||
wxStaticText *t_orig_frame; | wxStaticText *t_orig_frame; | ||||
wxStaticText *t_orig_seq; | wxStaticText *t_orig_seq; | ||||
wxSpinCtrl *s_klatt[N_KLATTP]; | |||||
wxStaticText *t_klatt[N_KLATTP]; | |||||
private: | private: | ||||
wxStaticText *t_lab[10]; | wxStaticText *t_lab[10]; | ||||
wxStaticText *t_labpk[N_PEAKS]; | wxStaticText *t_labpk[N_PEAKS]; | ||||
extern void WavegenInitPkData(int); // initialise envelope data | extern void WavegenInitPkData(int); // initialise envelope data | ||||
extern void SetPitch(int length, unsigned char *env, int pitch1, int pitch2); | extern void SetPitch(int length, unsigned char *env, int pitch1, int pitch2); | ||||
extern void SetSynthHtab(int length_mS, USHORT *ht1, int nh1, float pitch1, USHORT *ht2, int nh2, float pitch2); | extern void SetSynthHtab(int length_mS, USHORT *ht1, int nh1, float pitch1, USHORT *ht2, int nh2, float pitch2); | ||||
extern void MakeWaveFile(); | |||||
extern void MakeWaveFile(int synthesis_method); | |||||
extern void MakeWaveBuf(int length, UCHAR *buf); | extern void MakeWaveBuf(int length, UCHAR *buf); | ||||
extern int OpenWaveFile(const char *path, int samplerate); | extern int OpenWaveFile(const char *path, int samplerate); |
void SpectDisplay::RefreshDialogValues(int type) | void SpectDisplay::RefreshDialogValues(int type) | ||||
//{============================================= | //{============================================= | ||||
{ | { | ||||
int ix; | |||||
SpectFrame *sf; | |||||
sf = spectseq->frames[sframe]; | |||||
spectseq->amplitude = formantdlg->t_amplitude->GetValue(); | spectseq->amplitude = formantdlg->t_amplitude->GetValue(); | ||||
spectseq->frames[sframe]->amp_adjust = formantdlg->t_ampframe->GetValue(); | |||||
spectseq->frames[sframe]->length_adjust = | |||||
formantdlg->t_timeframe->GetValue() - spectseq->GetFrameLength(sframe,0,NULL); | |||||
sf->amp_adjust = formantdlg->t_ampframe->GetValue(); | |||||
sf->length_adjust = formantdlg->t_timeframe->GetValue() - spectseq->GetFrameLength(sframe,0,NULL); | |||||
for(ix=0; ix<9; ix++) | |||||
{ | |||||
sf->klatt_param[ix] = formantdlg->s_klatt[ix]->GetValue(); | |||||
} | |||||
if(type==0) | if(type==0) | ||||
{ | { | ||||
int code; | int code; | ||||
wxKeyEvent keyevent; | wxKeyEvent keyevent; | ||||
SpectFrame *sf; | SpectFrame *sf; | ||||
static int key[] = {0x1044,0x3044,0x104e,0x1047,0x105a,0x1051,0x3051,WXK_F1,WXK_F2,0x1049,WXK_F10}; | |||||
static int key[] = {0x1044,0x3044,0x104e,0x1047,0x105a,0x1051,0x3051,WXK_F1,WXK_F2,0x1049,WXK_F10,0x104b}; | |||||
id = event.GetId(); | id = event.GetId(); | ||||
if(event.ControlDown()) | if(event.ControlDown()) | ||||
{ | { | ||||
// CTRL, rotate, make right slope steeper | // CTRL, rotate, make right slope steeper | ||||
pk->pkright-= 5; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright-= 5; | |||||
pk->pkwidth += 5; | pk->pkwidth += 5; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
pk->pkright -= 10; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright -= 10; | |||||
pk->pkwidth -= 10; | pk->pkwidth -= 10; | ||||
if(pk->pkright < 0) | |||||
pk->pkright = 0; | |||||
if(pk->pkwidth < 0) | |||||
pk->pkwidth = 0; | |||||
} | } | ||||
field = 4; | field = 4; | ||||
display = 1; | display = 1; | ||||
if(event.ControlDown()) | if(event.ControlDown()) | ||||
{ | { | ||||
// CTRL: rotate, make left slope steeper | // CTRL: rotate, make left slope steeper | ||||
pk->pkright += 5; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright += 5; | |||||
pk->pkwidth -= 5; | pk->pkwidth -= 5; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
pk->pkright += 10; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright += 10; | |||||
pk->pkwidth += 10; | pk->pkwidth += 10; | ||||
} | } | ||||
field = 4; | field = 4; | ||||
break; | break; | ||||
case '<': // width-- | case '<': // width-- | ||||
pk->pkright -= 2; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright -= 2; | |||||
pk->pkwidth -= 2; | pk->pkwidth -= 2; | ||||
if(pk->pkwidth < 0) | |||||
pk->pkwidth = 0; | |||||
display = 1; | display = 1; | ||||
field = 4; | field = 4; | ||||
break; | break; | ||||
case '>': // width++ | case '>': // width++ | ||||
pk->pkright += 2; | |||||
if(spectseq->synthesizer_type==0) | |||||
pk->pkright += 2; | |||||
pk->pkwidth += 2; | pk->pkwidth += 2; | ||||
display = 1; | display = 1; | ||||
field = 4; | field = 4; | ||||
break; | break; | ||||
case '[': // width-- | |||||
pk->pkright -= 1; | |||||
if(pk->pkright < 0) | |||||
pk->pkright = 0; | |||||
display = 1; | |||||
field = 4; | |||||
break; | |||||
case ']': // width++ | |||||
pk->pkright += 1; | |||||
display = 1; | |||||
field = 4; | |||||
break; | |||||
case '/': // make left=right | case '/': // make left=right | ||||
i = pk->pkwidth + pk->pkright; | i = pk->pkwidth + pk->pkright; | ||||
pk->pkwidth = pk->pkright = i/2; | pk->pkwidth = pk->pkright = i/2; | ||||
display = 2; | display = 2; | ||||
break; | break; | ||||
case 0x104b: // CTRL-K | |||||
spectseq->SetKlattDefaults(); | |||||
display = 3; | |||||
break; | |||||
case 0x104d: // CTRL-M | case 0x104d: // CTRL-M | ||||
sf->ToggleMarker(1); | sf->ToggleMarker(1); | ||||
display = 2; | display = 2; | ||||
sf = spectseq->frames[sframe]; | sf = spectseq->frames[sframe]; | ||||
pk = &sf->peaks[pk_num]; | pk = &sf->peaks[pk_num]; | ||||
if(pk->pkwidth < 50) pk->pkwidth = 50; // min. width | |||||
if(pk->pkright < 50) pk->pkright = 50; | |||||
// ensure minimum separation between peaks & prevent crossover | |||||
if(direction > 0) | |||||
if(spectseq->synthesizer_type==0) | |||||
{ | { | ||||
for(i=pk_num+1; i<N_PEAKS; i++) | |||||
if(pk->pkwidth < 50) pk->pkwidth = 50; // min. width | |||||
if(pk->pkright < 50) pk->pkright = 50; | |||||
// ensure minimum separation between peaks & prevent crossover | |||||
if(direction > 0) | |||||
{ | { | ||||
if(sf->peaks[i].pkfreq < sf->peaks[i-1].pkfreq + 100) | |||||
sf->peaks[i].pkfreq = sf->peaks[i-1].pkfreq + 100; | |||||
for(i=pk_num+1; i<N_PEAKS; i++) | |||||
{ | |||||
if(sf->peaks[i].pkfreq < sf->peaks[i-1].pkfreq + 100) | |||||
sf->peaks[i].pkfreq = sf->peaks[i-1].pkfreq + 100; | |||||
} | |||||
} | } | ||||
} | |||||
else | |||||
if(direction < 0) | |||||
{ | |||||
for(i=pk_num-1; i>=0; i--) | |||||
else | |||||
if(direction < 0) | |||||
{ | { | ||||
if(sf->peaks[i].pkfreq > sf->peaks[i+1].pkfreq - 100) | |||||
sf->peaks[i].pkfreq = sf->peaks[i+1].pkfreq - 100; | |||||
for(i=pk_num-1; i>=0; i--) | |||||
{ | |||||
if(sf->peaks[i].pkfreq > sf->peaks[i+1].pkfreq - 100) | |||||
sf->peaks[i].pkfreq = sf->peaks[i+1].pkfreq - 100; | |||||
} | |||||
} | } | ||||
} | } | ||||
menu_spectdisplay->Append(202,_T("Copy Peaks Up SHIFT+CTRL+D")); | menu_spectdisplay->Append(202,_T("Copy Peaks Up SHIFT+CTRL+D")); | ||||
menu_spectdisplay->Append(204,_T("Grid (toggle) CTRL+G")); | menu_spectdisplay->Append(204,_T("Grid (toggle) CTRL+G")); | ||||
menu_spectdisplay->Append(210,_T("Interpolate (percentage) CTRL+I")); | menu_spectdisplay->Append(210,_T("Interpolate (percentage) CTRL+I")); | ||||
menu_spectdisplay->Append(212,_T("Convert sequence to Klatt format CTRL+K")); | |||||
menu_spectdisplay->Append(203,_T("Marker (toggle) CTRL+N")); | menu_spectdisplay->Append(203,_T("Marker (toggle) CTRL+N")); | ||||
menu_spectdisplay->Append(206,_T("Show Interpolation CTRL+Q")); | menu_spectdisplay->Append(206,_T("Show Interpolation CTRL+Q")); | ||||
menu_spectdisplay->Append(207,_T("Hide Interpolation CTRL+SHIFT+Q")); | menu_spectdisplay->Append(207,_T("Hide Interpolation CTRL+SHIFT+Q")); |
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | #define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | ||||
int SpeakNextClause(FILE *f_text, const void *text_in, int control); | |||||
extern void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2); | |||||
#define KLATT_TEST | |||||
extern void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control); | |||||
extern int Wavegen_Klatt(int resume); | |||||
extern void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v); | |||||
extern int Wavegen(); | extern int Wavegen(); | ||||
extern void CloseWaveFile2(); | extern void CloseWaveFile2(); | ||||
extern FILE *f_wave; | extern FILE *f_wave; | ||||
void MakeWaveFile() | |||||
{//================ | |||||
void MakeWaveFile(int synthesis_method) | |||||
{//==================================== | |||||
int result=1; | int result=1; | ||||
int resume=0; | |||||
unsigned char wav_outbuf[1024]; | unsigned char wav_outbuf[1024]; | ||||
while(result != 0) | while(result != 0) | ||||
{ | { | ||||
out_ptr = out_start = wav_outbuf; | out_ptr = out_start = wav_outbuf; | ||||
out_end = &wav_outbuf[sizeof(wav_outbuf)]; | out_end = &wav_outbuf[sizeof(wav_outbuf)]; | ||||
result = Wavegen(); | |||||
#ifdef KLATT_TEST | |||||
if(synthesis_method == 1) | |||||
result = Wavegen_Klatt(resume); | |||||
else | |||||
#endif | |||||
result = Wavegen(); | |||||
if(f_wave != NULL) | if(f_wave != NULL) | ||||
fwrite(wav_outbuf, 1, out_ptr - wav_outbuf, f_wave); | fwrite(wav_outbuf, 1, out_ptr - wav_outbuf, f_wave); | ||||
resume=1; | |||||
} | } | ||||
} // end of MakeWaveFile | } // end of MakeWaveFile | ||||
max_x = 3000; | max_x = 3000; | ||||
max_y = 1; | max_y = 1; | ||||
synthesizer_type = 0; | |||||
} | } | ||||
SpectSeq::~SpectSeq() | SpectSeq::~SpectSeq() | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if(frame->Load(stream) != 0) break; | |||||
if(frame->Load(stream, synthesizer_type) != 0) break; | |||||
} | } | ||||
frames[numframes++] = frame; | frames[numframes++] = frame; | ||||
stream.SeekI(4); | stream.SeekI(4); | ||||
return(ImportSPC2(stream)); | return(ImportSPC2(stream)); | ||||
} | } | ||||
if(id1 != FILEID1_SPECTSEQ || id2 != FILEID2_SPECTSEQ) | |||||
else | |||||
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEQ)) | |||||
{ | |||||
synthesizer_type = 0; // eSpeak formants | |||||
} | |||||
else | |||||
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEK)) | |||||
{ | { | ||||
synthesizer_type = 1; // formants for Klatt synthesizer | |||||
} | |||||
else | |||||
{ | |||||
// Praat analysis data | |||||
stream.SeekI(0); | stream.SeekI(0); | ||||
return(Import(stream)); | return(Import(stream)); | ||||
} | } | ||||
wxDataOutputStream s(stream); | wxDataOutputStream s(stream); | ||||
s.Write32(FILEID1_SPECTSEQ); | s.Write32(FILEID1_SPECTSEQ); | ||||
s.Write32(FILEID2_SPECTSEQ); | |||||
if(synthesizer_type == 1) | |||||
s.Write32(FILEID2_SPECTSEK); | |||||
else | |||||
s.Write32(FILEID2_SPECTSEQ); | |||||
s.WriteString(name); | s.WriteString(name); | ||||
s.Write16(count); | s.Write16(count); | ||||
void SpectSeq::SetKlattDefaults(void) | |||||
{//================================== | |||||
int ix; | |||||
synthesizer_type = 1; | |||||
for(ix=0; ix<numframes; ix++) | |||||
{ | |||||
if(frames[ix]->keyframe) | |||||
{ | |||||
frames[ix]->KlattDefaults(); | |||||
} | |||||
frames[ix]->synthesizer_type = 1; | |||||
} | |||||
} | |||||
void SpectSeq::ConstructVowel(void) | void SpectSeq::ConstructVowel(void) | ||||
{//================================ | {//================================ | ||||
frames[frame]->peaks[pk].pkwidth = frames[f1]->peaks[pk].pkwidth; | frames[frame]->peaks[pk].pkwidth = frames[f1]->peaks[pk].pkwidth; | ||||
frames[frame]->peaks[pk].pkright = frames[f1]->peaks[pk].pkright; | frames[frame]->peaks[pk].pkright = frames[f1]->peaks[pk].pkright; | ||||
} | } | ||||
memcpy(frames[frame]->klatt_param, frames[f1]->klatt_param, sizeof(frames[frame]->klatt_param)); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
int y; | int y; | ||||
memcpy(peaks,sp->peaks,sizeof(*peaks)*N_PEAKS); | memcpy(peaks,sp->peaks,sizeof(*peaks)*N_PEAKS); | ||||
for(ix=0; ix<N_PEAKS; ix++) | |||||
if(synthesizer_type == 0) | |||||
{ | { | ||||
y = peaks[ix].pkheight * sp->amp_adjust * amplitude; | |||||
peaks[ix].pkheight = y / 10000; | |||||
for(ix=0; ix<N_PEAKS; ix++) | |||||
{ | |||||
y = peaks[ix].pkheight * sp->amp_adjust * amplitude; | |||||
peaks[ix].pkheight = y / 10000; | |||||
} | |||||
} | } | ||||
} // end of ApplyAmp_adjust | } // end of ApplyAmp_adjust | ||||
void PeaksToFrame(peak_t *pks, frame_t *fr) | |||||
{//======================================== | |||||
void PeaksToFrame(SpectFrame *sp1, peak_t *pks, frame_t *fr) | |||||
{//========================================================= | |||||
int ix; | int ix; | ||||
int x; | |||||
int x, x2; | |||||
for(ix=0; ix<N_PEAKS; ix++) | for(ix=0; ix<N_PEAKS; ix++) | ||||
{ | { | ||||
fr->ffreq[ix] = pks[ix].pkfreq; | fr->ffreq[ix] = pks[ix].pkfreq; | ||||
fr->fheight[ix] = pks[ix].pkheight >> 6; | |||||
if(sp1->synthesizer_type==0) | |||||
{ | |||||
x = pks[ix].pkheight >> 6; | |||||
} | |||||
else | |||||
{ | |||||
x = pks[ix].pkheight >> 7; | |||||
fr->fwidth6 = pks[6].pkwidth >> 1; | |||||
fr->fright6 = pks[6].pkright; | |||||
} | |||||
if(x > 255) | |||||
x = 255; | |||||
fr->fheight[ix] = x; | |||||
if(ix < 6) | if(ix < 6) | ||||
{ | { | ||||
if((x = (pks[ix].pkwidth >> 2)) > 255) | |||||
x = pks[ix].pkwidth/2; | |||||
x2 = pks[ix].pkright; | |||||
if(sp1->synthesizer_type == 0) | |||||
{ | |||||
x /= 2; | |||||
x2 /= 4; | |||||
} | |||||
if(x > 255) | |||||
x = 255; | x = 255; | ||||
fr->fwidth[ix] = x; | fr->fwidth[ix] = x; | ||||
if((x = (pks[ix].pkright >> 2)) > 255) | |||||
x = 255; | |||||
fr->fright[ix] = x; | |||||
if(x2 > 255) | |||||
x2 = 255; | |||||
fr->fright[ix] = x2; | |||||
} | } | ||||
} | } | ||||
for(ix=0; ix<N_KLATTP; ix++) | |||||
{ | |||||
fr->klattp[ix] = sp1->klatt_param[ix]; | |||||
} | |||||
} | } | ||||
static void SetSynth_mS(int length_mS, peak_t *sp1, peak_t *sp2) | |||||
{//============================================================= | |||||
static void SetSynth_mS(int length_mS, SpectFrame *sp1, SpectFrame *sp2, peak_t *pks1, peak_t *pks2, int control) | |||||
{//============================================================================================================== | |||||
static frame_t fr1, fr2; | static frame_t fr1, fr2; | ||||
PeaksToFrame(sp1,&fr1); | |||||
PeaksToFrame(sp2,&fr2); | |||||
PeaksToFrame(sp1,pks1,&fr1); | |||||
PeaksToFrame(sp2,pks2,&fr2); | |||||
#ifdef KLATT_TEST | |||||
if(sp1->synthesizer_type == 1) | |||||
{ | |||||
SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples | |||||
} | |||||
else | |||||
#endif | |||||
{ | |||||
SetSynth((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice); // convert mS to samples | |||||
} | |||||
}; | |||||
SetSynth((length_mS * samplerate) / 1000, 0, &fr1, &fr2); // convert mS to samples | |||||
} | |||||
peak_t peaks1[N_PEAKS]; | peak_t peaks1[N_PEAKS]; | ||||
peak_t peaks2[N_PEAKS]; | peak_t peaks2[N_PEAKS]; | ||||
KlattInit(); | |||||
SpeakNextClause(NULL,NULL,2); // stop speaking file | SpeakNextClause(NULL,NULL,2); // stop speaking file | ||||
if(numframes==0) return; | if(numframes==0) return; | ||||
{ | { | ||||
ApplyAmp_adjust(sp1,peaks1); | ApplyAmp_adjust(sp1,peaks1); | ||||
ApplyAmp_adjust(sp2,peaks2); | ApplyAmp_adjust(sp2,peaks2); | ||||
if(first) | if(first) | ||||
{ | { | ||||
PeaksZero(peaks1,peaks0); // fade in | |||||
SetSynth_mS(20,peaks0,peaks1); | |||||
MakeWaveFile(); | |||||
if(synthesizer_type == 1) | |||||
{ | |||||
memcpy(peaks0,peaks1,sizeof(peaks0)); | |||||
} | |||||
else | |||||
{ | |||||
PeaksZero(peaks1,peaks0); // fade in | |||||
} | |||||
SetSynth_mS(20,sp1,sp1,peaks0,peaks1,0); | |||||
MakeWaveFile(synthesizer_type); | |||||
first=0; | first=0; | ||||
} | } | ||||
length = int(sp1->length * lfactor); | length = int(sp1->length * lfactor); | ||||
SetSynth_mS(length,peaks1,peaks2); | |||||
MakeWaveFile(); | |||||
SetSynth_mS(length,sp1,sp2,peaks1,peaks2,0); | |||||
MakeWaveFile(synthesizer_type); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
PeaksZero(peaks2,peaks0); // fade out | |||||
SetSynth_mS(30,peaks2,peaks0); | |||||
MakeWaveFile(); | |||||
if(synthesizer_type == 1) | |||||
{ | |||||
memcpy(peaks0,peaks2,sizeof(peaks0)); | |||||
} | |||||
else | |||||
{ | |||||
PeaksZero(peaks2,peaks0); // fade out | |||||
} | |||||
SetSynth_mS(30,sp2,sp2,peaks2,peaks0,2); | |||||
MakeWaveFile(synthesizer_type); | |||||
CloseWaveFile2(); | CloseWaveFile2(); | ||||
PlayWavFile(fname_speech); | PlayWavFile(fname_speech); | ||||
char *fname_speech; | char *fname_speech; | ||||
// USHORT htab0[600]; | // USHORT htab0[600]; | ||||
KlattInit(); | |||||
SpeakNextClause(NULL,NULL,2); // stop speaking file | SpeakNextClause(NULL,NULL,2); // stop speaking file | ||||
length = duration; | length = duration; | ||||
if(OpenWaveFile2(fname_speech) != 0) | if(OpenWaveFile2(fname_speech) != 0) | ||||
return; | return; | ||||
if(control==0) | if(control==0) | ||||
{ | { | ||||
memcpy(peaks1,peaks,sizeof(peaks1)); | memcpy(peaks1,peaks,sizeof(peaks1)); | ||||
for(ix=0; ix<N_PEAKS; ix++) | |||||
if(synthesizer_type == 0) | |||||
{ | { | ||||
y = peaks1[ix].pkheight * amp_adjust * amplitude; | |||||
peaks1[ix].pkheight = y/10000; | |||||
for(ix=0; ix<N_PEAKS; ix++) | |||||
{ | |||||
y = peaks1[ix].pkheight * amp_adjust * amplitude; | |||||
peaks1[ix].pkheight = y/10000; | |||||
} | |||||
PeaksZero(peaks1,peaks0); | |||||
} | } | ||||
PeaksZero(peaks1,peaks0); | |||||
SetSynth_mS(20,peaks0,peaks1); | |||||
MakeWaveFile(); | |||||
SetSynth_mS(length,peaks1,peaks1); | |||||
MakeWaveFile(); | |||||
SetSynth_mS(30,peaks1,peaks0); | |||||
MakeWaveFile(); | |||||
else | |||||
{ | |||||
memcpy(peaks0,peaks1,sizeof(peaks0)); | |||||
} | |||||
SetSynth_mS(20,this,this,peaks0,peaks1,0); | |||||
MakeWaveFile(synthesizer_type); | |||||
SetSynth_mS(length,this,this,peaks1,peaks1,0); | |||||
MakeWaveFile(synthesizer_type); | |||||
SetSynth_mS(30,this,this,peaks1,peaks0,2); | |||||
MakeWaveFile(synthesizer_type); | |||||
} | } | ||||
else | else | ||||
{ | { |
#include <sys/types.h> | #include <sys/types.h> | ||||
// conditional compilation options | // conditional compilation options | ||||
#define INCLUDE_KLATT | |||||
#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN | #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN | ||||
#define ARCH_BIG | #define ARCH_BIG |
if(hinstDllMBR != NULL) | if(hinstDllMBR != NULL) | ||||
return TRUE; // already loaded | return TRUE; // already loaded | ||||
if (!(hinstDllMBR=LoadLibrary("mbrola.dll"))) | |||||
if (!(hinstDllMBR=LoadLibraryA("mbrola.dll"))) | |||||
return FALSE; | return FALSE; | ||||
init_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"init_MBR"); | init_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"init_MBR"); | ||||
write_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"write_MBR"); | write_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"write_MBR"); | ||||
#ifdef USE_MBROLA_LIB | #ifdef USE_MBROLA_LIB | ||||
#ifdef PLATFORM_WINDOWS | #ifdef PLATFORM_WINDOWS | ||||
setVolumeRatio_MBR((float)(mbrola_control & 0xff) /16.0); | |||||
setVolumeRatio_MBR((float)(mbrola_control & 0xff) /16.0f); | |||||
#else | #else | ||||
mbrolib_get_parameter(mb_handle,&m_parameters); | mbrolib_get_parameter(mb_handle,&m_parameters); | ||||
m_parameters.ignore_error = 1; | m_parameters.ignore_error = 1; |
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.39.26 15.Nov.08"; | |||||
const char *version_string = "1.39.28 22.Nov.08"; | |||||
const int version_phdata = 0x013900; | const int version_phdata = 0x013900; | ||||
int option_device_number = -1; | int option_device_number = -1; | ||||
int length1; | int length1; | ||||
int length_std; | int length_std; | ||||
int length_factor; | int length_factor; | ||||
SPECT_SEQ *seq; | |||||
SPECT_SEQ *seq2; | |||||
SPECT_SEQ *seq, *seq2; | |||||
SPECT_SEQK *seqk, *seqk2; | |||||
PHONEME_TAB *next2_ph; | PHONEME_TAB *next2_ph; | ||||
frame_t *frame; | |||||
static frameref_t frames_buf[N_SEQ_FRAMES]; | static frameref_t frames_buf[N_SEQ_FRAMES]; | ||||
PHONEME_TAB *other_ph; | PHONEME_TAB *other_ph; | ||||
if((ix = LookupSound(this_ph,other_ph,which,match_level,0)) < 4) | if((ix = LookupSound(this_ph,other_ph,which,match_level,0)) < 4) | ||||
return(NULL); | return(NULL); | ||||
seq = (SPECT_SEQ *)(&spects_data[ix]); | seq = (SPECT_SEQ *)(&spects_data[ix]); | ||||
seqk = (SPECT_SEQK *)seq; | |||||
nf = seq->n_frames; | nf = seq->n_frames; | ||||
seq_break = 0; | seq_break = 0; | ||||
length1 = 0; | length1 = 0; | ||||
for(ix=0; ix<nf; ix++) | for(ix=0; ix<nf; ix++) | ||||
{ | { | ||||
frames_buf[ix].frame = &seq->frame[ix]; | |||||
frames_buf[ix].frflags = seq->frame[ix].frflags; | |||||
frames_buf[ix].length = seq->frame[ix].length; | |||||
if(seq->frame[ix].frflags & FRFLAG_VOWEL_CENTRE) | |||||
if(seq->frame[0].frflags & FRFLAG_KLATT) | |||||
frame = &seqk->frame[ix]; | |||||
else | |||||
frame = (frame_t *)&seq->frame[ix]; | |||||
frames_buf[ix].frame = frame; | |||||
frames_buf[ix].frflags = frame->frflags; | |||||
frames_buf[ix].length = frame->length; | |||||
if(frame->frflags & FRFLAG_VOWEL_CENTRE) | |||||
seq_break = ix; | seq_break = ix; | ||||
} | } | ||||
frames = &frames_buf[0]; | frames = &frames_buf[0]; | ||||
if(seq_break > 0) | if(seq_break > 0) | ||||
{ | { | ||||
// a secondary reference has been returned, which is not a wavefile | // a secondary reference has been returned, which is not a wavefile | ||||
// add these spectra to the main sequence | // add these spectra to the main sequence | ||||
seq2 = (SPECT_SEQ *)(&spects_data[wavefile_ix]); | seq2 = (SPECT_SEQ *)(&spects_data[wavefile_ix]); | ||||
seqk2 = (SPECT_SEQK *)seq2; | |||||
// first frame of the addition just sets the length of the last frame of the main seq | // first frame of the addition just sets the length of the last frame of the main seq | ||||
nf--; | nf--; | ||||
for(ix=0; ix<seq2->n_frames; ix++) | for(ix=0; ix<seq2->n_frames; ix++) | ||||
{ | { | ||||
frames[nf].length = seq2->frame[ix].length; | |||||
if(seq2->frame[0].frflags & FRFLAG_KLATT) | |||||
frame = &seqk2->frame[ix]; | |||||
else | |||||
frame = (frame_t *)&seq2->frame[ix]; | |||||
frames[nf].length = frame->length; | |||||
if(ix > 0) | if(ix > 0) | ||||
frames[nf].frame = &seq2->frame[ix]; | |||||
{ | |||||
frames[nf].frame = frame; | |||||
frames[nf].frflags = frame->frflags; | |||||
} | |||||
nf++; | nf++; | ||||
} | } | ||||
wavefile_ix = 0; | wavefile_ix = 0; |
849,851,853,856,858,861,863,865,868,870,872,875,877,879,882,884, | 849,851,853,856,858,861,863,865,868,870,872,875,877,879,882,884, | ||||
886,889,891,893,896,898,900,902}; | 886,889,891,893,896,898,900,902}; | ||||
if(fr->frflags & FRFLAG_KLATT) | |||||
{ | |||||
if(new_rms == -1) | |||||
{ | |||||
fr->klattp[KLATT_AV] = 50; | |||||
} | |||||
return; | |||||
} | |||||
if(fr->rms == 0) return; // check for divide by zero | if(fr->rms == 0) return; // check for divide by zero | ||||
x = (new_rms * 64)/fr->rms; | x = (new_rms * 64)/fr->rms; | ||||
if(x >= 200) x = 199; | if(x >= 200) x = 199; | ||||
int ix; | int ix; | ||||
int x; | int x; | ||||
if(fr->frflags & FRFLAG_KLATT) | |||||
return; | |||||
for(ix=2; ix<N_PEAKS; ix++) | for(ix=2; ix<N_PEAKS; ix++) | ||||
{ | { | ||||
x = fr->fheight[ix] * level; | x = fr->fheight[ix] * level; | ||||
next_rms = seq[1].frame->rms; | next_rms = seq[1].frame->rms; | ||||
if(fr->frflags & FRFLAG_KLATT) | |||||
{ | |||||
fr->klattp[KLATT_AV] = 53; // reduce the amplituide of the start of a vowel | |||||
} | |||||
if(f2 != 0) | if(f2 != 0) | ||||
{ | { | ||||
if(rms & 0x20) | if(rms & 0x20) | ||||
q = wcmdq[syllable_centre]; | q = wcmdq[syllable_centre]; | ||||
frame_centre = (frame_t *)q[2]; | frame_centre = (frame_t *)q[2]; | ||||
//if(frame_centre->frflags & FRFLAG_KLATT) | |||||
// return; // TESTING | |||||
// backwards | // backwards | ||||
ix = syllable_centre -1; | ix = syllable_centre -1; | ||||
frame = frame2 = frame_centre; | frame = frame2 = frame_centre; | ||||
if(q[0] == WCMD_PAUSE || q[0] == WCMD_WAVE) | if(q[0] == WCMD_PAUSE || q[0] == WCMD_WAVE) | ||||
break; | break; | ||||
if(q[0] == WCMD_SPECT || q[0] == WCMD_SPECT2) | |||||
if(q[0] <= WCMD_SPECT2) | |||||
{ | { | ||||
len = q[1] & 0xffff; | len = q[1] & 0xffff; | ||||
if(q[0] == WCMD_PAUSE || q[0] == WCMD_WAVE) | if(q[0] == WCMD_PAUSE || q[0] == WCMD_WAVE) | ||||
break; | break; | ||||
if(q[0] == WCMD_SPECT || q[0] == WCMD_SPECT2) | |||||
if(q[0] <= WCMD_SPECT2) | |||||
{ | { | ||||
len = q[1] & 0xffff; | len = q[1] & 0xffff; | ||||
} | } | ||||
syllable_start = syllable_end; | syllable_start = syllable_end; | ||||
} | |||||
} // end of SmoothSpect | |||||
static void StartSyllable(void) | static void StartSyllable(void) | ||||
if(frames == NULL) | if(frames == NULL) | ||||
return(0); // not found | return(0); // not found | ||||
frame1 = frames[0].frame; | |||||
frame1_length = frames[0].length; | |||||
if(frame1->frflags & FRFLAG_KLATT) | |||||
wcmd_spect = WCMD_KLATT; | |||||
if(wavefile_ix == 0) | if(wavefile_ix == 0) | ||||
{ | { | ||||
if(wave_flag) | if(wave_flag) | ||||
{ | { | ||||
// cancel any wavefile that was playing previously | // cancel any wavefile that was playing previously | ||||
wcmd_spect = WCMD_SPECT2; | wcmd_spect = WCMD_SPECT2; | ||||
if(frame1->frflags & FRFLAG_KLATT) | |||||
wcmd_spect = WCMD_KLATT2; | |||||
wave_flag = 0; | wave_flag = 0; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
wcmd_spect = WCMD_SPECT; | wcmd_spect = WCMD_SPECT; | ||||
if(frame1->frflags & FRFLAG_KLATT) | |||||
wcmd_spect = WCMD_KLATT; | |||||
} | } | ||||
} | } | ||||
frame1 = frames[0].frame; | |||||
frame1_length = frames[0].length; | |||||
if(last_frame != NULL) | if(last_frame != NULL) | ||||
{ | { | ||||
if(((last_frame->length < 2) || (last_frame->frflags & FRFLAG_VOWEL_CENTRE)) | if(((last_frame->length < 2) || (last_frame->frflags & FRFLAG_VOWEL_CENTRE)) |
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | #define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | ||||
#define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8) | #define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8) | ||||
#define STEPSIZE 64 // 2.9mS at 22 kHz sample rate | |||||
#define PITCHfall 0 | #define PITCHfall 0 | ||||
#define PITCHrise 1 | #define PITCHrise 1 | ||||
// flags set for frames within a spectrum sequence | // flags set for frames within a spectrum sequence | ||||
#define FRFLAG_KLATT 0x01 // this frame includes extra data for Klatt synthesizer | |||||
#define FRFLAG_VOWEL_CENTRE 0x02 // centre point of vowel | #define FRFLAG_VOWEL_CENTRE 0x02 // centre point of vowel | ||||
#define FRFLAG_LEN_MOD 0x04 // reduce effect of length adjustment | #define FRFLAG_LEN_MOD 0x04 // reduce effect of length adjustment | ||||
#define FRFLAG_BREAK_LF 0x08 // but keep f3 upwards | #define FRFLAG_BREAK_LF 0x08 // but keep f3 upwards | ||||
short pkright; | short pkright; | ||||
} peak_t; | } peak_t; | ||||
#define N_KLATTP 10 // this affects the phoneme data file format | |||||
#define KLATT_AV 0 | |||||
#define KLATT_Kopen 1 | |||||
#define KLATT_Skew 2 | |||||
#define KLATT_Tilt 3 | |||||
#define KLATT_Turb 4 | |||||
#define KLATT_Aspr 5 | |||||
#define KLATT_AVp 6 // this is after the parameters which can be change by the Voice | |||||
#define KLATT_Fric 7 | |||||
#define KLATT_FricBP 8 | |||||
#define KLATT_spare1 9 | |||||
typedef struct { | typedef struct { | ||||
short frflags; | short frflags; | ||||
unsigned char length; | unsigned char length; | ||||
unsigned char fheight[9]; | unsigned char fheight[9]; | ||||
unsigned char fwidth[6]; // width/4 | unsigned char fwidth[6]; // width/4 | ||||
unsigned char fright[6]; // width/4 | unsigned char fright[6]; // width/4 | ||||
unsigned char fwidth6, fright6; | |||||
unsigned char klattp[N_KLATTP]; | |||||
} frame_t; | } frame_t; | ||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t2; // the original, without Klatt additions, used for file "phondata" | |||||
// formant data used by wavegen | // formant data used by wavegen | ||||
DOUBLEX right_inc; | DOUBLEX right_inc; | ||||
} wavegen_peaks_t; | } wavegen_peaks_t; | ||||
typedef struct { | |||||
unsigned char *pitch_env; | |||||
int pitch; // pitch Hz*256 | |||||
int pitch_ix; // index into pitch envelope (*256) | |||||
int pitch_inc; // increment to pitch_ix | |||||
int pitch_base; // Hz*256 low, before modified by envelope | |||||
int pitch_range; // Hz*256 range of envelope | |||||
unsigned char *mix_wavefile; // wave file to be added to synthesis | |||||
int n_mix_wavefile; // length in bytes | |||||
int mix_wave_scale; // 0=2 byte samples | |||||
int mix_wave_amp; | |||||
int mix_wavefile_ix; | |||||
int amplitude; | |||||
int amplitude_v; | |||||
int prev_was_synth; // previous sound was synthesized (not a played wave or pause) | |||||
} WGEN_DATA; | |||||
typedef struct { | typedef struct { | ||||
double a; | double a; | ||||
double b; | double b; | ||||
typedef struct { | typedef struct { | ||||
short length; | |||||
short length_total; // not used | |||||
unsigned char n_frames; | |||||
unsigned char flags; | |||||
frame_t2 frame[N_SEQ_FRAMES]; // max. frames in a spectrum sequence | |||||
} SPECT_SEQ; // sequence of espeak formant frames | |||||
typedef struct { | |||||
short length_total; // not used | |||||
unsigned char n_frames; | unsigned char n_frames; | ||||
unsigned char flags; | unsigned char flags; | ||||
frame_t frame[N_SEQ_FRAMES]; // max. frames in a spectrum sequence | frame_t frame[N_SEQ_FRAMES]; // max. frames in a spectrum sequence | ||||
} SPECT_SEQ; | |||||
} SPECT_SEQK; // sequence of klatt formants frames | |||||
typedef struct { | typedef struct { | ||||
short length; | short length; | ||||
extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; | extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; | ||||
// queue of commands for wavegen | // queue of commands for wavegen | ||||
#define WCMD_AMPLITUDE 1 | |||||
#define WCMD_PITCH 2 | |||||
#define WCMD_KLATT 1 | |||||
#define WCMD_KLATT2 2 | |||||
#define WCMD_SPECT 3 | #define WCMD_SPECT 3 | ||||
#define WCMD_SPECT2 4 | #define WCMD_SPECT2 4 | ||||
#define WCMD_PAUSE 5 | #define WCMD_PAUSE 5 | ||||
#define WCMD_WAVE 6 | #define WCMD_WAVE 6 | ||||
#define WCMD_WAVE2 7 | #define WCMD_WAVE2 7 | ||||
#define WCMD_MARKER 8 | |||||
#define WCMD_VOICE 9 | |||||
#define WCMD_EMBEDDED 10 | |||||
#define WCMD_AMPLITUDE 8 | |||||
#define WCMD_PITCH 9 | |||||
#define WCMD_MARKER 10 | |||||
#define WCMD_VOICE 11 | |||||
#define WCMD_EMBEDDED 12 | |||||
#define N_WCMDQ 160 | #define N_WCMDQ 160 | ||||
int LookupPhonemeTable(const char *name); | int LookupPhonemeTable(const char *name); | ||||
void InitBreath(void); | void InitBreath(void); | ||||
void KlattInit(); | |||||
int Wavegen_Klatt2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2); |
tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels | tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels | ||||
tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list | tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list | ||||
tr->langopts.numbers = 0x2709 + NUM_ROMAN; | tr->langopts.numbers = 0x2709 + NUM_ROMAN; | ||||
tr->langopts.accents = 2; // Say "Capital" after the letter. | |||||
} | } | ||||
break; | break; | ||||
static const unsigned char stress_amps_sq[8] = {17,12, 17,17, 20,20, 24,22 }; | static const unsigned char stress_amps_sq[8] = {17,12, 17,17, 20,20, 24,22 }; | ||||
tr = new Translator(); | tr = new Translator(); | ||||
SetupTranslator(tr,stress_lengths_sq,stress_amps_sq); | SetupTranslator(tr,stress_lengths_sq,stress_amps_sq); | ||||
tr->langopts.stress_flags = 0x4; | |||||
tr->langopts.stress_flags = 0x4 + 0x10; | |||||
SetLetterVowel(tr,'y'); | SetLetterVowel(tr,'y'); | ||||
tr->langopts.numbers = 0x69 + 0x8000; | |||||
} | } | ||||
break; | break; | ||||
first_phoneme = 0; | first_phoneme = 0; | ||||
} | } | ||||
} | } | ||||
plist2->sourceix = source_ix; // ???? | |||||
// don't set new-word if there is a hyphen before it | |||||
if((word_flags & FLAG_HYPHEN) == 0) | |||||
{ | |||||
plist2->sourceix = source_ix; | |||||
} | |||||
end_stressed_vowel = 0; | end_stressed_vowel = 0; | ||||
if((stress >= 4) && (phoneme_tab[ph_list2[n_ph_list2-1].phcode]->type == phVOWEL)) | if((stress >= 4) && (phoneme_tab[ph_list2[n_ph_list2-1].phcode]->type == phVOWEL)) |
#define N_RULE_GROUP2 120 // max num of two-letter rule chains | #define N_RULE_GROUP2 120 // max num of two-letter rule chains | ||||
#define N_HASH_DICT 1024 | #define N_HASH_DICT 1024 | ||||
#define N_CHARSETS 20 | #define N_CHARSETS 20 | ||||
#define N_LETTER_GROUPS 25 | |||||
#define N_LETTER_GROUPS 26 | |||||
/* dictionary flags, word 1 */ | /* dictionary flags, word 1 */ |
char *fname_speech; | char *fname_speech; | ||||
int n_ph; | int n_ph; | ||||
KlattInit(); | |||||
n_ph = n_phonemes; | n_ph = n_phonemes; | ||||
fname_speech = WavFileName(); | fname_speech = WavFileName(); | ||||
OpenWaveFile2(fname_speech); | OpenWaveFile2(fname_speech); | ||||
{//===================================================== | {//===================================================== | ||||
t_source = new wxTextCtrl(this,T_SOURCE,_T(""),wxPoint(0,4), | t_source = new wxTextCtrl(this,T_SOURCE,_T(""),wxPoint(0,4), | ||||
wxSize(200,250),wxTE_MULTILINE); | |||||
wxSize(204,250),wxTE_MULTILINE); | |||||
t_phonetic = new wxTextCtrl(this,T_PHONETIC,_T(""),wxPoint(0,262), | t_phonetic = new wxTextCtrl(this,T_PHONETIC,_T(""),wxPoint(0,262), | ||||
wxSize(200,350),wxTE_MULTILINE); | |||||
wxSize(204,350),wxTE_MULTILINE); | |||||
t_translate = new wxButton(this,T_TRANSLATE,_T("Translate"),wxPoint(4,620)); | t_translate = new wxButton(this,T_TRANSLATE,_T("Translate"),wxPoint(4,620)); | ||||
t_translate = new wxButton(this,T_RULES,_T("Show Rules"),wxPoint(4,652)); | t_translate = new wxButton(this,T_RULES,_T("Show Rules"),wxPoint(4,652)); |
int formant_factor; // adjust nominal formant frequencies by this because of the voice's pitch (256ths) | int formant_factor; // adjust nominal formant frequencies by this because of the voice's pitch (256ths) | ||||
int consonant_amp; // amplitude of unvoiced consonants | int consonant_amp; // amplitude of unvoiced consonants | ||||
int consonant_ampv; // amplitude of the noise component of voiced consonants | int consonant_ampv; // amplitude of the noise component of voiced consonants | ||||
int klatt[8]; | |||||
// parameters used by Wavegen | // parameters used by Wavegen | ||||
short freq[N_PEAKS]; // 100% = 256 | short freq[N_PEAKS]; // 100% = 256 | ||||
extern voice_t *voice; | extern voice_t *voice; | ||||
extern int tone_points[10]; | |||||
extern int tone_points[12]; | |||||
const char *SelectVoice(espeak_VOICE *voice_select); | const char *SelectVoice(espeak_VOICE *voice_select); | ||||
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name); | espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name); |
{"female", 2}, | {"female", 2}, | ||||
{NULL, 0 }}; | {NULL, 0 }}; | ||||
//int tone_points[10] = {250,140, 1200,110, -1,0, -1,0, -1,0}; | |||||
int tone_points[10] = {600,170, 1200,135, 2000,110, 3000,110, -1,0}; | |||||
int tone_points[12] = {600,170, 1200,135, 2000,110, 3000,110, -1,0}; | |||||
//int tone_points[12] = {250,200, 400,170, 600,170, 1200,135, 2000,110, -1,0}; | |||||
// limit the rate of change for each formant number | // limit the rate of change for each formant number | ||||
//static int formant_rate_22050[9] = {50, 104, 165, 230, 220, 220, 220, 220, 220}; // values for 22kHz sample rate | //static int formant_rate_22050[9] = {50, 104, 165, 230, 220, 220, 220, 220, 220}; // values for 22kHz sample rate | ||||
#define V_NUMBERS 25 | #define V_NUMBERS 25 | ||||
#define V_OPTION 26 | #define V_OPTION 26 | ||||
#define V_MBROLA 27 | |||||
#define V_MBROLA 27 | |||||
#define V_KLATT 28 | |||||
// these need a phoneme table to have been specified | // these need a phoneme table to have been specified | ||||
#define V_REPLACE 28 | |||||
#define V_CONSONANTS 29 | |||||
#define V_REPLACE 29 | |||||
#define V_CONSONANTS 30 | |||||
typedef struct { | typedef struct { | ||||
{"option", V_OPTION}, | {"option", V_OPTION}, | ||||
{"mbrola", V_MBROLA}, | {"mbrola", V_MBROLA}, | ||||
{"consonants", V_CONSONANTS}, | {"consonants", V_CONSONANTS}, | ||||
{"klatt", V_KLATT}, | |||||
// these just set a value in langopts.param[] | // these just set a value in langopts.param[] | ||||
{"l_dieresis", 0x100+LOPT_DIERESES}, | {"l_dieresis", 0x100+LOPT_DIERESES}, | ||||
int height2; | int height2; | ||||
double rate; | double rate; | ||||
for(pt=0; pt<10; pt+=2) | |||||
for(pt=0; pt<12; pt+=2) | |||||
{ | { | ||||
if(tone_pts[pt] == -1) | if(tone_pts[pt] == -1) | ||||
{ | { | ||||
void ReadTonePoints(char *string, int *tone_pts) | void ReadTonePoints(char *string, int *tone_pts) | ||||
{//============================================= | {//============================================= | ||||
// tone_pts[] is int[10] | |||||
// tone_pts[] is int[12] | |||||
int ix; | int ix; | ||||
for(ix=0; ix<10; ix++) | |||||
for(ix=0; ix<12; ix++) | |||||
tone_pts[ix] = -1; | tone_pts[ix] = -1; | ||||
sscanf(string,"%d %d %d %d %d %d %d %d", | |||||
sscanf(string,"%d %d %d %d %d %d %d %d %d %d", | |||||
&tone_pts[0],&tone_pts[1],&tone_pts[2],&tone_pts[3], | &tone_pts[0],&tone_pts[1],&tone_pts[2],&tone_pts[3], | ||||
&tone_pts[4],&tone_pts[5],&tone_pts[6],&tone_pts[7]); | |||||
&tone_pts[4],&tone_pts[5],&tone_pts[6],&tone_pts[7], | |||||
&tone_pts[8],&tone_pts[9]); | |||||
} | } | ||||
voice->echo_amp = 0; | voice->echo_amp = 0; | ||||
voice->flutter = 64; | voice->flutter = 64; | ||||
voice->n_harmonic_peaks = 5; | voice->n_harmonic_peaks = 5; | ||||
voice->peak_shape = 1; | |||||
voice->peak_shape = 0; | |||||
voice->voicing = 64; | voice->voicing = 64; | ||||
voice->consonant_amp = 100; | voice->consonant_amp = 100; | ||||
voice->consonant_ampv = 100; | voice->consonant_ampv = 100; | ||||
memset(voice->klatt,0,sizeof(voice->klatt)); | |||||
#ifdef PLATFORM_RISCOS | #ifdef PLATFORM_RISCOS | ||||
voice->roughness = 1; | voice->roughness = 1; | ||||
} | } | ||||
break; | break; | ||||
case V_KLATT: | |||||
Read8Numbers(p,voice->klatt); | |||||
voice->klatt[KLATT_Kopen] -= 40; | |||||
break; | |||||
default: | default: | ||||
if((key & 0xff00) == 0x100) | if((key & 0xff00) == 0x100) | ||||
{ | { | ||||
} | } | ||||
#else | #else | ||||
#ifdef PLATFORM_WINDOWS | #ifdef PLATFORM_WINDOWS | ||||
WIN32_FIND_DATA FindFileData; | |||||
WIN32_FIND_DATAA FindFileData; | |||||
HANDLE hFind = INVALID_HANDLE_VALUE; | HANDLE hFind = INVALID_HANDLE_VALUE; | ||||
DWORD dwError; | |||||
#undef UNICODE // we need FindFirstFileA() which takes an 8-bit c-string | #undef UNICODE // we need FindFirstFileA() which takes an 8-bit c-string | ||||
sprintf(fname,"%s\\*",path); | sprintf(fname,"%s\\*",path); | ||||
hFind = FindFirstFile(fname, &FindFileData); | |||||
hFind = FindFirstFileA(fname, &FindFileData); | |||||
if(hFind == INVALID_HANDLE_VALUE) | if(hFind == INVALID_HANDLE_VALUE) | ||||
return; | return; | ||||
voices_list[n_voices_list++] = voice_data; | voices_list[n_voices_list++] = voice_data; | ||||
} | } | ||||
} | } | ||||
} while(FindNextFile(hFind, &FindFileData) != 0); | |||||
} while(FindNextFileA(hFind, &FindFileData) != 0); | |||||
FindClose(hFind); | FindClose(hFind); | ||||
#else | #else |
PHONEME_TAB *ph; | PHONEME_TAB *ph; | ||||
FILE *f; | FILE *f; | ||||
SPECT_SEQ *seq; | SPECT_SEQ *seq; | ||||
SPECT_SEQK *seqk; | |||||
frame_t *frame; | frame_t *frame; | ||||
int match_level; | int match_level; | ||||
char dirname[sizeof(path_source)+20]; | char dirname[sizeof(path_source)+20]; | ||||
continue; | continue; | ||||
seq = (SPECT_SEQ *)(&spects_data[ix]); | seq = (SPECT_SEQ *)(&spects_data[ix]); | ||||
frame = &seq->frame[1]; | |||||
seqk = (SPECT_SEQK *)seq; | |||||
if(seq->frame[0].frflags & FRFLAG_KLATT) | |||||
frame = &seqk->frame[1]; | |||||
else | |||||
frame = (frame_t *)&seq->frame[1]; | |||||
fprintf(f,"%s\t %3d %4d %4d",WordToString(ph->mnemonic), | fprintf(f,"%s\t %3d %4d %4d",WordToString(ph->mnemonic), | ||||
frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]); | frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]); | ||||
frame = &seq->frame[seq->n_frames-1]; | |||||
if(seq->frame[0].frflags & FRFLAG_KLATT) | |||||
frame = &seqk->frame[seqk->n_frames-1]; | |||||
else | |||||
frame = (frame_t *)&seq->frame[seq->n_frames-1]; | |||||
fprintf(f," %3d %4d %4d\n",frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]); | fprintf(f," %3d %4d %4d\n",frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]); | ||||
} | } | ||||
fclose(f); | fclose(f); |
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
//#undef INCLUDE_KLATT | |||||
#ifdef USE_PORTAUDIO | #ifdef USE_PORTAUDIO | ||||
#include "portaudio.h" | #include "portaudio.h" | ||||
#undef USE_PORTAUDIO | #undef USE_PORTAUDIO | ||||
#define PI 3.1415927 | #define PI 3.1415927 | ||||
#define PI2 6.283185307 | #define PI2 6.283185307 | ||||
#define STEPSIZE 64 // 2.9mS at 22 kHz sample rate | |||||
#define N_WAV_BUF 10 | #define N_WAV_BUF 10 | ||||
static voice_t *wvoice; | |||||
voice_t *wvoice; | |||||
FILE *f_log = NULL; | FILE *f_log = NULL; | ||||
int option_waveout = 0; | int option_waveout = 0; | ||||
static int max_hval=0; | static int max_hval=0; | ||||
static int nsamples=0; // number to do | static int nsamples=0; // number to do | ||||
static int amplitude = 32; | |||||
static int amplitude_v = 0; | |||||
static int modulation_type = 0; | static int modulation_type = 0; | ||||
static int glottal_flag = 0; | static int glottal_flag = 0; | ||||
static int glottal_reduce = 0; | static int glottal_reduce = 0; | ||||
static unsigned char *mix_wavefile = NULL; // wave file to be added to synthesis | |||||
static int n_mix_wavefile = 0; // length in bytes | |||||
static int mix_wave_scale = 0; // 0=2 byte samples | |||||
static int mix_wave_amp = 32; | |||||
static int mix_wavefile_ix = 0; | |||||
static int pitch; // pitch Hz*256 | |||||
static int pitch_ix; // index into pitch envelope (*256) | |||||
static int pitch_inc; // increment to pitch_ix | |||||
static unsigned char *pitch_env=NULL; | |||||
static int pitch_base; // Hz*256 low, before modified by envelope | |||||
static int pitch_range; // Hz*256 range of envelope | |||||
WGEN_DATA wdata; | |||||
static int amp_ix; | static int amp_ix; | ||||
static int amp_inc; | static int amp_inc; | ||||
static unsigned char *amplitude_env = NULL; | static unsigned char *amplitude_env = NULL; | ||||
// data points from which to make the presets for pk_shape1 and pk_shape2 | // data points from which to make the presets for pk_shape1 and pk_shape2 | ||||
#define PEAKSHAPEW 256 | #define PEAKSHAPEW 256 | ||||
static const float pk_shape_x[2][8] = { | static const float pk_shape_x[2][8] = { | ||||
{0,-0.6, 0.0, 0.6, 1.4, 2.5, 4.5, 5.5}, | |||||
{0,-0.6, 0.0, 0.6, 1.4, 2.0, 4.5, 5.5 }}; | |||||
{0,-0.6f, 0.0f, 0.6f, 1.4f, 2.5f, 4.5f, 5.5f}, | |||||
{0,-0.6f, 0.0f, 0.6f, 1.4f, 2.0f, 4.5f, 5.5f }}; | |||||
static const float pk_shape_y[2][8] = { | static const float pk_shape_y[2][8] = { | ||||
{0, 67, 81, 67, 31, 14, 0, -6} , | {0, 67, 81, 67, 31, 14, 0, -6} , | ||||
{0, 77, 81, 77, 31, 7, 0, -6 }}; | {0, 77, 81, 77, 31, 7, 0, -6 }}; | ||||
if(wavemult_fact == 0) | if(wavemult_fact == 0) | ||||
wavemult_fact=60; // default | wavemult_fact=60; // default | ||||
wvoice = NULL; | |||||
samplerate = samplerate_native = rate; | samplerate = samplerate_native = rate; | ||||
PHASE_INC_FACTOR = 0x8000000 / samplerate; // assumes pitch is Hz*32 | PHASE_INC_FACTOR = 0x8000000 / samplerate; // assumes pitch is Hz*32 | ||||
Flutter_inc = (64 * samplerate)/rate; | Flutter_inc = (64 * samplerate)/rate; | ||||
wavephase = 0x7fffffff; | wavephase = 0x7fffffff; | ||||
max_hval = 0; | max_hval = 0; | ||||
wdata.amplitude = 32; | |||||
wdata.prev_was_synth = 0; | |||||
for(ix=0; ix<N_EMBEDDED_VALUES; ix++) | for(ix=0; ix<N_EMBEDDED_VALUES; ix++) | ||||
embedded_value[ix] = embedded_default[ix]; | embedded_value[ix] = embedded_default[ix]; | ||||
WavegenInitPkData(1); | WavegenInitPkData(1); | ||||
WavegenInitPkData(0); | WavegenInitPkData(0); | ||||
pk_shape = pk_shape2; // ph_shape2 | |||||
pk_shape = pk_shape2; // pk_shape2 | |||||
#ifdef INCLUDE_KLATT | |||||
KlattInit(); | |||||
#endif | |||||
#ifdef LOG_FRAMES | #ifdef LOG_FRAMES | ||||
remove("log-espeakedit"); | remove("log-espeakedit"); | ||||
// normal, none, reduced, moderate, strong | // normal, none, reduced, moderate, strong | ||||
static const unsigned char amp_emphasis[5] = {16, 16, 10, 16, 22}; | static const unsigned char amp_emphasis[5] = {16, 16, 10, 16, 22}; | ||||
amp = (embedded_value[EMBED_A])*60/100; | |||||
amp = (embedded_value[EMBED_A])*55/100; | |||||
general_amplitude = amp * amp_emphasis[embedded_value[EMBED_F]] / 16; | general_amplitude = amp * amp_emphasis[embedded_value[EMBED_F]] / 16; | ||||
return(general_amplitude); | return(general_amplitude); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// increase bass, up to the F1 peak | |||||
h=1; | |||||
for(f=pitch; f<peaks[1].freq; f+=pitch) | |||||
{ | |||||
htab[h++] += (peaks[1].height * 16); | |||||
} | |||||
// find the nearest harmonic for HF peaks where we don't use shape | // find the nearest harmonic for HF peaks where we don't use shape | ||||
for(; pk<N_PEAKS; pk++) | for(; pk<N_PEAKS; pk++) | ||||
{ | { | ||||
static int Flutter_ix = 0; | static int Flutter_ix = 0; | ||||
// advance the pitch | // advance the pitch | ||||
pitch_ix += pitch_inc; | |||||
if((ix = pitch_ix>>8) > 127) ix = 127; | |||||
x = pitch_env[ix] * pitch_range; | |||||
pitch = (x>>8) + pitch_base; | |||||
wdata.pitch_ix += wdata.pitch_inc; | |||||
if((ix = wdata.pitch_ix>>8) > 127) ix = 127; | |||||
x = wdata.pitch_env[ix] * wdata.pitch_range; | |||||
wdata.pitch = (x>>8) + wdata.pitch_base; | |||||
amp_ix += amp_inc; | amp_ix += amp_inc; | ||||
Flutter_ix = 0; | Flutter_ix = 0; | ||||
x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; | x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; | ||||
Flutter_ix += Flutter_inc; | Flutter_ix += Flutter_inc; | ||||
pitch += x; | |||||
if(pitch < 102400) | |||||
pitch = 102400; // min pitch, 25 Hz (25 << 12) | |||||
wdata.pitch += x; | |||||
if(wdata.pitch < 102400) | |||||
wdata.pitch = 102400; // min pitch, 25 Hz (25 << 12) | |||||
if(samplecount == samplecount_start) | if(samplecount == samplecount_start) | ||||
return; | return; | ||||
{ | { | ||||
hswitch = 0; | hswitch = 0; | ||||
harmspect = hspect[0]; | harmspect = hspect[0]; | ||||
maxh2 = PeaksToHarmspect(peaks,pitch<<4,hspect[0],0); | |||||
maxh2 = PeaksToHarmspect(peaks, wdata.pitch<<4, hspect[0], 0); | |||||
// adjust amplitude to compensate for fewer harmonics at higher pitch | // adjust amplitude to compensate for fewer harmonics at higher pitch | ||||
amplitude2 = (amplitude * pitch)/(100 << 11); | |||||
amplitude2 = (wdata.amplitude * wdata.pitch)/(100 << 11); | |||||
// switch sign of harmonics above about 900Hz, to reduce max peak amplitude | // switch sign of harmonics above about 900Hz, to reduce max peak amplitude | ||||
h_switch_sign = 890 / (pitch >> 12); | |||||
h_switch_sign = 890 / (wdata.pitch >> 12); | |||||
} | } | ||||
else | else | ||||
AdvanceParameters(); | AdvanceParameters(); | ||||
// pitch is Hz<<12 | // pitch is Hz<<12 | ||||
phaseinc = (pitch>>7) * PHASE_INC_FACTOR; | |||||
cycle_samples = samplerate/(pitch >> 12); // sr/(pitch*2) | |||||
hf_factor = pitch >> 11; | |||||
phaseinc = (wdata.pitch>>7) * PHASE_INC_FACTOR; | |||||
cycle_samples = samplerate/(wdata.pitch >> 12); // sr/(pitch*2) | |||||
hf_factor = wdata.pitch >> 11; | |||||
maxh = maxh2; | maxh = maxh2; | ||||
harmspect = hspect[hswitch]; | harmspect = hspect[hswitch]; | ||||
hswitch ^= 1; | hswitch ^= 1; | ||||
maxh2 = PeaksToHarmspect(peaks,pitch<<4,hspect[hswitch],1); | |||||
maxh2 = PeaksToHarmspect(peaks, wdata.pitch<<4, hspect[hswitch], 1); | |||||
SetBreath(); | SetBreath(); | ||||
} | } | ||||
for(pk=wvoice->n_harmonic_peaks+1; pk<N_PEAKS; pk++) | for(pk=wvoice->n_harmonic_peaks+1; pk<N_PEAKS; pk++) | ||||
{ | { | ||||
// find the nearest harmonic for HF peaks where we don't use shape | // find the nearest harmonic for HF peaks where we don't use shape | ||||
peak_harmonic[pk] = peaks[pk].freq / (pitch*16); | |||||
peak_harmonic[pk] = peaks[pk].freq / (wdata.pitch*16); | |||||
} | } | ||||
// adjust amplitude to compensate for fewer harmonics at higher pitch | // adjust amplitude to compensate for fewer harmonics at higher pitch | ||||
amplitude2 = (amplitude * pitch)/(100 << 11); | |||||
amplitude2 = (wdata.amplitude * wdata.pitch)/(100 << 11); | |||||
if(glottal_flag > 0) | if(glottal_flag > 0) | ||||
{ | { | ||||
// mix with sampled wave if required | // mix with sampled wave if required | ||||
z2 = 0; | z2 = 0; | ||||
if(mix_wavefile_ix < n_mix_wavefile) | |||||
if(wdata.mix_wavefile_ix < wdata.n_mix_wavefile) | |||||
{ | { | ||||
if(mix_wave_scale == 0) | |||||
if(wdata.mix_wave_scale == 0) | |||||
{ | { | ||||
// a 16 bit sample | // a 16 bit sample | ||||
c = mix_wavefile[mix_wavefile_ix+1]; | |||||
sample = mix_wavefile[mix_wavefile_ix] + (c * 256); | |||||
mix_wavefile_ix += 2; | |||||
c = wdata.mix_wavefile[wdata.mix_wavefile_ix+1]; | |||||
sample = wdata.mix_wavefile[wdata.mix_wavefile_ix] + (c * 256); | |||||
wdata.mix_wavefile_ix += 2; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
// a 8 bit sample, scaled | // a 8 bit sample, scaled | ||||
sample = (signed char)mix_wavefile[mix_wavefile_ix++] * mix_wave_scale; | |||||
sample = (signed char)wdata.mix_wavefile[wdata.mix_wavefile_ix++] * wdata.mix_wave_scale; | |||||
} | } | ||||
z2 = (sample * amplitude_v) >> 10; | |||||
z2 = (z2 * mix_wave_amp)/32; | |||||
z2 = (sample * wdata.amplitude_v) >> 10; | |||||
z2 = (z2 * wdata.mix_wave_amp)/32; | |||||
} | } | ||||
z1 = z2 + (((total>>8) * amplitude2) >> 13); | z1 = z2 + (((total>>8) * amplitude2) >> 13); | ||||
else | else | ||||
amp_inc = (256 * ENV_LEN * STEPSIZE)/length; | amp_inc = (256 * ENV_LEN * STEPSIZE)/length; | ||||
amplitude = (value * general_amplitude)/16; | |||||
amplitude_v = (amplitude * wvoice->consonant_ampv * 15)/100; // for wave mixed with voiced sounds | |||||
wdata.amplitude = (value * general_amplitude)/16; | |||||
wdata.amplitude_v = (wdata.amplitude * wvoice->consonant_ampv * 15)/100; // for wave mixed with voiced sounds | |||||
amplitude_env = amp_env; | amplitude_env = amp_env; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
if((pitch_env = env)==NULL) | |||||
pitch_env = env_fall; // default | |||||
if((wdata.pitch_env = env)==NULL) | |||||
wdata.pitch_env = env_fall; // default | |||||
pitch_ix = 0; | |||||
wdata.pitch_ix = 0; | |||||
if(length==0) | if(length==0) | ||||
pitch_inc = 0; | |||||
wdata.pitch_inc = 0; | |||||
else | else | ||||
pitch_inc = (256 * ENV_LEN * STEPSIZE)/length; | |||||
wdata.pitch_inc = (256 * ENV_LEN * STEPSIZE)/length; | |||||
SetPitch2(wvoice, pitch1, pitch2, &pitch_base, &pitch_range); | |||||
SetPitch2(wvoice, pitch1, pitch2, &wdata.pitch_base, &wdata.pitch_range); | |||||
// set initial pitch | // set initial pitch | ||||
pitch = ((pitch_env[0]*pitch_range)>>8) + pitch_base; // Hz << 12 | |||||
wdata.pitch = ((wdata.pitch_env[0] * wdata.pitch_range) >>8) + wdata.pitch_base; // Hz << 12 | |||||
flutter_amp = wvoice->flutter; | flutter_amp = wvoice->flutter; | ||||
void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2) | |||||
{//============================================================ | |||||
void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v) | |||||
{//======================================================================== | |||||
int ix; | int ix; | ||||
DOUBLEX next; | DOUBLEX next; | ||||
int length2; | int length2; | ||||
int length4; | int length4; | ||||
int qix; | int qix; | ||||
int cmd; | int cmd; | ||||
voice_t *v; | |||||
static int glottal_reduce_tab1[4] = {0x30, 0x30, 0x40, 0x50}; // vowel before [?], amp * 1/256 | static int glottal_reduce_tab1[4] = {0x30, 0x30, 0x40, 0x50}; // vowel before [?], amp * 1/256 | ||||
// static int glottal_reduce_tab1[4] = {0x30, 0x40, 0x50, 0x60}; // vowel before [?], amp * 1/256 | // static int glottal_reduce_tab1[4] = {0x30, 0x40, 0x50, 0x60}; // vowel before [?], amp * 1/256 | ||||
static int glottal_reduce_tab2[4] = {0x90, 0xa0, 0xb0, 0xc0}; // vowel after [?], amp * 1/256 | static int glottal_reduce_tab2[4] = {0x90, 0xa0, 0xb0, 0xc0}; // vowel after [?], amp * 1/256 | ||||
break; // next is not from spectrum, so continue until end of wave cycle | break; // next is not from spectrum, so continue until end of wave cycle | ||||
} | } | ||||
v = wvoice; | |||||
// round the length to a multiple of the stepsize | // round the length to a multiple of the stepsize | ||||
length2 = (length + STEPSIZE/2) & ~0x3f; | length2 = (length + STEPSIZE/2) & ~0x3f; | ||||
if(length2 == 0) | if(length2 == 0) | ||||
static int Wavegen2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2) | static int Wavegen2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2) | ||||
{//==================================================================================== | {//==================================================================================== | ||||
if(resume==0) | if(resume==0) | ||||
SetSynth(length,modulation,fr1,fr2); | |||||
SetSynth(length, modulation, fr1, fr2, wvoice); | |||||
return(Wavegen()); | return(Wavegen()); | ||||
} | } | ||||
{ | { | ||||
echo_complete -= length; | echo_complete -= length; | ||||
} | } | ||||
n_mix_wavefile = 0; | |||||
wdata.n_mix_wavefile = 0; | |||||
wdata.prev_was_synth = 0; | |||||
result = PlaySilence(length,resume); | result = PlaySilence(length,resume); | ||||
break; | break; | ||||
case WCMD_WAVE: | case WCMD_WAVE: | ||||
echo_complete = echo_length; | echo_complete = echo_length; | ||||
n_mix_wavefile = 0; | |||||
wdata.n_mix_wavefile = 0; | |||||
wdata.prev_was_synth = 0; | |||||
result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); | result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); | ||||
break; | break; | ||||
case WCMD_WAVE2: | case WCMD_WAVE2: | ||||
// wave file to be played at the same time as synthesis | // wave file to be played at the same time as synthesis | ||||
mix_wave_amp = q[3] >> 8; | |||||
mix_wave_scale = q[3] & 0xff; | |||||
if(mix_wave_scale == 0) | |||||
n_mix_wavefile = length*2; | |||||
wdata.mix_wave_amp = q[3] >> 8; | |||||
wdata.mix_wave_scale = q[3] & 0xff; | |||||
if(wdata.mix_wave_scale == 0) | |||||
wdata.n_mix_wavefile = length*2; | |||||
else | else | ||||
n_mix_wavefile = length; | |||||
mix_wavefile_ix = 0; | |||||
mix_wavefile = (unsigned char *)q[2]; | |||||
wdata.n_mix_wavefile = length; | |||||
wdata.mix_wavefile_ix = 0; | |||||
wdata.mix_wavefile = (unsigned char *)q[2]; | |||||
break; | break; | ||||
case WCMD_SPECT2: // as WCMD_SPECT but stop any concurrent wave file | case WCMD_SPECT2: // as WCMD_SPECT but stop any concurrent wave file | ||||
n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case | |||||
wdata.n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case | |||||
case WCMD_SPECT: | case WCMD_SPECT: | ||||
echo_complete = echo_length; | echo_complete = echo_length; | ||||
result = Wavegen2(length & 0xffff,q[1] >> 16,resume,(frame_t *)q[2],(frame_t *)q[3]); | result = Wavegen2(length & 0xffff,q[1] >> 16,resume,(frame_t *)q[2],(frame_t *)q[3]); | ||||
break; | break; | ||||
#ifdef INCLUDE_KLATT | |||||
case WCMD_KLATT2: // as WCMD_SPECT but stop any concurrent wave file | |||||
wdata.n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case | |||||
case WCMD_KLATT: | |||||
echo_complete = echo_length; | |||||
result = Wavegen_Klatt2(length & 0xffff,q[1] >> 16,resume,(frame_t *)q[2],(frame_t *)q[3]); | |||||
break; | |||||
#endif | |||||
case WCMD_MARKER: | case WCMD_MARKER: | ||||
MarkerEvent(q[1],q[2],q[3],out_ptr); | MarkerEvent(q[1],q[2],q[3],out_ptr); | ||||
#ifdef LOG_FRAMES | #ifdef LOG_FRAMES |