00001
00024 #ifndef _PHON_H_
00025 #define _PHON_H_
00026
00027 #include "util.h"
00028
00032 const uint center_F1 = 500;
00036 const uint center_F2 = 1500;
00037
00038 #define USE_F0_ALTERNATING 1
00039 #define USE_FLUTTER 2
00040
00041 #define TIME_ALIGNED 1
00042 #define STEADY_STATE_CUT 2
00043
00047 typedef enum {
00048 progressive,
00049 regressive,
00050 both
00051 } CO_TYPE;
00052
00058 typedef struct {
00061 bool voiced;
00063 uint vocStart;
00065 uint vocStop;
00067 bool breathy;
00069 uint brtStart;
00071 uint brtStop;
00073 uint brtRate;
00075 bool nasalized;
00077 uint nasStart;
00079 uint nasStop;
00081 bool laryngealized;
00083 uint larStart;
00085 uint larStop;
00087 uint larRate;
00089 bool creaky;
00091 uint creakyStart;
00093 uint creakyStop;
00095 uint creakyRate;
00097 bool spread;
00099 uint spreadRate;
00102 bool rounded;
00104 uint roundedRate;
00106 bool undershoot;
00108 uint undershootRate;
00110 bool overshoot;
00112 uint overshootRate;
00114 bool headSize;
00116 uint headSizeRate;
00118 bool falsett;
00120 uint falsettRate;
00122 bool whisper;
00124 uint whisperRate;
00126 bool tense;
00128 uint tenseRate;
00130 bool lax;
00132 bool jitter;
00134 uint jitterRate;
00136 uint jitterMethod;
00138 bool coarticulation;
00140 uint coarticulationRate;
00142 CO_TYPE coarticulationType;
00143 } PHON_FEATURES;
00144
00148 typedef enum {
00149 vowel,
00150 consonant
00151 } PHON_TYPE;
00152
00153
00157 typedef enum {
00158 noQuadrant,
00159 topLeft,
00160 topRight,
00161 bottomRight,
00162 bottomLeft
00163 } FORMANT_QUADRANT;
00164
00168 typedef enum {
00169 long_vowel,
00170 short_vowel,
00171 liquide,
00172 nasal,
00173 fricative_voiced,
00174 fricative_voiceless,
00175 stop_voiced,
00176 stop_voiceless,
00177 silence,
00178 noManner
00179 } PHON_MANNER;
00180
00184 typedef enum {
00185 noPlace,
00186 bilabial,
00187 labial,
00188 labiodental,
00189 alveolar,
00190 postalveolar,
00191 palatal,
00192 velar,
00193 uvular,
00194 glottal
00195 } PHON_PLACE;
00196
00200 class phon {
00203 string name;
00205 uint dur;
00207 uint frameNum;
00209 uint meanF0;
00211 PHON_TYPE type;
00213 PHON_MANNER manner;
00215 PHON_PLACE place;
00217 PHON_FEATURES phonFeatures;
00219 bool voiced;
00221 bool diphtong;
00224 FORMANT_QUADRANT formantQuadrant;
00225
00227 uint origValNum;
00229 uint steadyStart;
00231 uint steadyEnd;
00233 uint burstStart;
00235 uint aspStart;
00236
00238 vector<uint> f0ValVec;
00240 vector<uint> f0TimeVec;
00241
00243 vector<uint> f0Vec;
00245 vector<uint> ampVec;
00246
00248 vector<uint> f1Vec;
00250 vector<uint> f2Vec;
00252 vector<uint> f3Vec;
00254 vector<uint> f4Vec;
00256 vector<uint> f5Vec;
00258 vector<uint> f6Vec;
00260 vector<uint> b1Vec;
00262 vector<uint> b2Vec;
00264 vector<uint> b3Vec;
00266 vector<uint> b4Vec;
00268 vector<uint> b5Vec;
00270 vector<uint> b6Vec;
00271
00272
00274 vector<uint> a1Vec;
00276 vector<uint> a2Vec;
00278 vector<uint> a3Vec;
00280 vector<uint> a4Vec;
00282 vector<uint> a5Vec;
00284 vector<uint> a6Vec;
00286 vector<uint> b1pVec;
00288 vector<uint> b2pVec;
00290 vector<uint> b3pVec;
00292 vector<uint> b4pVec;
00294 vector<uint> b5pVec;
00296 vector<uint> b6pVec;
00297
00300 vector <uint> avVec;
00302 vector <uint> ahVec;
00304 vector <uint> aturbVec;
00306 vector <uint> oqVec;
00308 vector <uint> afVec;
00310 vector <uint> abVec;
00312 vector <uint> avpVec;
00314 vector <uint> tlVec;
00316 vector <uint> flVec;
00318 vector <uint> gainVec;
00319
00322 vector <uint> anvVec;
00324 vector <uint> fnzVec;
00326 vector <uint> bnzVec;
00328 vector <uint> fnpVec;
00330 vector <uint> bnpVec;
00332 vector <uint> sqVec;
00334 vector <uint> diVec;
00336 vector <uint> df1Vec;
00338 vector <uint> db1Vec;
00340 vector <uint> ftpVec;
00342 vector <uint> btpVec;
00344 vector <uint> ftzVec;
00346 vector <uint> btzVec;
00348 vector <uint> a2fVec;
00350 vector <uint> a3fVec;
00352 vector <uint> a4fVec;
00354 vector <uint> a5fVec;
00356 vector <uint> a6fVec;
00358 vector <uint> a1vVec;
00360 vector <uint> a2vVec;
00362 vector <uint> a3vVec;
00364 vector <uint> a4vVec;
00366 vector <uint> atvVec;
00367
00368 public:
00369
00377 phon(string newname, uint newdur, globalsT glob);
00378
00382 phon();
00383
00384
00392 void setName(string newName);
00393
00400 void setPhonFeatures(PHON_FEATURES newPhonFeatures);
00401
00408 void setSteadyStart(uint newSteadyStart);
00409
00416 void setSteadyEnd(uint newSteadyEnd);
00417
00424 void setBurstStart(uint newBurstStart);
00425
00432 void setAspStart(uint newAspStart);
00433
00444 void setF0ValVec(vector<uint>& newF0ValVec);
00445
00452 void setF0TimeVec(vector<uint>& newF0TimeVec);
00453
00461 void setF0Vec(vector<uint>& newF0Vec, globalsT &kg) {
00462 f0Vec = newF0Vec;
00463 meanF0 = (uint) mean(f0Vec);
00464 kg.f0Dyn=true;
00465 if (kg.copyDB)
00466 dur = newF0Vec.size()*kg.ui;
00467 }
00474 void setAmpVec(vector<uint> newVec, globalsT &kg) {ampVec = newVec;}
00481 void setF1Vec(vector<uint> newVec, globalsT &kg) {f1Vec = newVec; kg.f1Dyn=true;}
00488 void setF2Vec(vector<uint> newVec, globalsT &kg) {f2Vec = newVec; kg.f2Dyn=true;}
00495 void setF3Vec(vector<uint> newVec, globalsT &kg) {f3Vec = newVec; kg.f3Dyn=true;}
00502 void setF4Vec(vector<uint> newVec, globalsT &kg) {f4Vec = newVec; kg.f4Dyn=true;}
00509 void setF5Vec(vector<uint> newVec, globalsT &kg) {f5Vec = newVec; kg.f5Dyn=true;}
00516 void setF6Vec(vector<uint> newVec, globalsT &kg) {f6Vec = newVec; kg.f6Dyn=true;}
00523 void setB1Vec(vector<uint> newVec, globalsT &kg) {b1Vec = newVec; kg.b1Dyn=true;}
00530 void setB2Vec(vector<uint> newVec, globalsT &kg) {b2Vec = newVec; kg.b2Dyn=true;}
00537 void setB3Vec(vector<uint> newVec, globalsT &kg) {b3Vec = newVec; kg.b3Dyn=true;}
00544 void setB4Vec(vector<uint> newVec, globalsT &kg) {b4Vec = newVec; kg.b4Dyn=true;}
00551 void setB5Vec(vector<uint> newVec, globalsT &kg) {b5Vec = newVec; kg.b5Dyn=true;}
00558 void setB6Vec(vector<uint> newVec, globalsT &kg) {b6Vec = newVec; kg.b6Dyn=true;}
00564 void setA1Vec(vector<uint> newVec, globalsT &kg) {a1Vec = newVec;}
00570 void setA2Vec(vector<uint> newVec, globalsT &kg) {a2Vec = newVec;}
00576 void setA3Vec(vector<uint> newVec, globalsT &kg) {a3Vec = newVec;}
00582 void setA4Vec(vector<uint> newVec, globalsT &kg) {a4Vec = newVec;}
00588 void setA5Vec(vector<uint> newVec, globalsT &kg) {a5Vec = newVec;}
00594 void setA6Vec(vector<uint> newVec, globalsT &kg) {a6Vec = newVec;}
00600 void setB1pVec(vector<uint> newVec, globalsT &kg) {b1pVec = newVec;}
00607 void setB2pVec(vector<uint> newVec, globalsT &kg) {b2pVec = newVec; kg.b2pDyn=true;}
00614 void setB3pVec(vector<uint> newVec, globalsT &kg) {b3pVec = newVec; kg.b3pDyn=true;}
00621 void setB4pVec(vector<uint> newVec, globalsT &kg) {b4pVec = newVec; kg.b4pDyn=true;}
00628 void setB5pVec(vector<uint> newVec, globalsT &kg) {b5pVec = newVec; kg.b5pDyn=true;}
00635 void setB6pVec(vector<uint> newVec, globalsT &kg) {b6pVec = newVec; kg.b6pDyn=true;}
00636
00637
00642 uint MeanF0();
00643
00648 string Name();
00649
00654 PHON_TYPE Type();
00659 PHON_MANNER Manner();
00664 PHON_PLACE Place();
00665
00670 bool Voiced();
00671
00676 bool Diphtong();
00677
00684 void initMannerPlaceType(string name);
00685
00690 uint Dur();
00691
00698 uint FrameNum();
00699
00704 uint DataFrameNum();
00705
00710 PHON_FEATURES PhonFeatures();
00711
00716 vector <uint> F0ValVec();
00717
00722 vector <uint> F0TimeVec();
00723
00728 vector <uint> AmpVec();
00733 vector <uint> F0Vec();
00738 vector <uint> F1Vec();
00743 vector <uint> F2Vec();
00748 vector <uint> F3Vec();
00753 vector <uint> F4Vec();
00758 vector <uint> F5Vec();
00763 vector <uint> F6Vec();
00768 vector <uint> B1Vec();
00773 vector <uint> B2Vec();
00778 vector <uint> B3Vec();
00783 vector <uint> B4Vec();
00788 vector <uint> B5Vec();
00793 vector <uint> B6Vec();
00798 vector <uint> A1Vec();
00803 vector <uint> A2Vec();
00808 vector <uint> A3Vec();
00813 vector <uint> A4Vec();
00818 vector <uint> A5Vec();
00823 vector <uint> A6Vec();
00828 vector <uint> B1PVec();
00833 vector <uint> B2PVec();
00838 vector <uint> B3PVec();
00843 vector <uint> B4PVec();
00848 vector <uint> B5PVec();
00853 vector <uint> B6PVec();
00858 vector <uint> AvVec();
00863 vector <uint> AhVec();
00868 vector <uint> OqVec();
00873 vector <uint> AturbVec();
00878 vector <uint> AfVec();
00883 vector <uint> AbVec();
00888 vector <uint> AvpVec();
00893 vector <uint> TlVec();
00898 vector <uint> FlVec();
00903 vector <uint> GainVec();
00908 vector <uint> AnvVec();
00913 vector <uint> FnzVec();
00918 vector <uint> BnzVec();
00923 vector <uint> FnpVec();
00928 vector <uint> BnpVec();
00933 vector <uint> SqVec();
00938 vector <uint> DiVec();
00943 vector <uint> Df1Vec();
00948 vector <uint> Db1Vec();
00953 vector <uint> FtpVec();
00958 vector <uint> BtpVec();
00963 vector <uint> FtzVec();
00968 vector <uint> BtzVec();
00973 vector <uint> A2fVec();
00978 vector <uint> A3fVec();
00983 vector <uint> A4fVec();
00988 vector <uint> A5fVec();
00993 vector <uint> A6fVec();
00998 vector <uint> A1vVec();
01003 vector <uint> A2vVec();
01008 vector <uint> A3vVec();
01013 vector <uint> A4vVec();
01018 vector <uint> AtvVec();
01019
01020
01025 uint SteadyStart();
01030 uint SteadyEnd();
01035 uint BurstStart();
01040 uint AspStart();
01041
01042
01043
01048 void printName(ostream &outFile);
01049
01059 void printSenSynFrames(uint start, ostream &outFile, globalsT glob);
01060
01066 void printKlattFrames(ostream &outFile);
01067
01110 void setSoundSource(globalsT &glob);
01111
01154 void setArticulationTractFilter(globalsT &glob);
01155
01198 void modelFeatures(uint sylMeanF0, globalsT &glob, phon *prevpP, phon *nextpP);
01199
01207 void modelIntonation(globalsT &kg);
01208
01209
01210
01211
01233 void changeDur(uint newDur, globalsT glob);
01234
01240 void changeAvrInt(int dBVal);
01241
01250 void changeMeanF0(uint rate);
01257 void smootheF0(uint winsize);
01266 void changeF0Range(uint rate, uint meanF0);
01275 void interpolateF0Vec(uint start, uint end);
01276
01277 };
01278
01282 void initPhonFeatures(PHON_FEATURES &phonFeatures);
01283
01284
01292 extern "C" PHON_MANNER classify_german(char *phone);
01300 extern "C" void exitErr(char *msg, char *str, int ErrNum);
01301
01302 #endif
01303