Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

emoSyn.cc File Reference

#include "parse_argument.h"
#include "phrase.h"

Include dependency graph for emoSyn.cc:

Include dependency graph


Functions

void usage ()
void initKlattDefaults (globalsT &glob, string fileName)
 reads in the default valus for the klatt-parameters from file named fileName. More...

int main (int argc, char **argv)

Variables

const string version = "0.01"
 version number.


Function Documentation

void initKlattDefaults ( globalsT & glob,
string fileName )
 

reads in the default valus for the klatt-parameters from file named fileName.

Parameters:
globalsT   &glob
string   fileName
00636                                                        {
00637   string buffer, token;
00638   int lineCounter=0;
00639 
00640   glob.use4Freq = true; // default is
00641   glob.use5Freq = true; // usage of all 5 formantfreqs
00642   glob.changeDurMethod = TIME_ALIGNED;
00643   glob.verbose = false;
00644   glob.warningsOff = true;
00645   glob.copyDB = false;
00646   glob.copysynthesis = true;
00647   
00648   glob.senSyn=true; // default is output for sensyn-synthesizer
00649   
00650   
00651   glob.f0Dyn = false; glob.f1Dyn = false; glob.f2Dyn = false; glob.f3Dyn = false; glob.f4Dyn = false; glob.f5Dyn = false; glob.f6Dyn = false; glob.b1Dyn = false; glob.b2Dyn = false; glob.b3Dyn = false; glob.b4Dyn = false; glob.b5Dyn = false; glob.b6Dyn = false; glob.b2pDyn = false; glob.b3pDyn = false; glob.b4pDyn = false; glob.b5pDyn = false; glob.b6pDyn = false; glob.avDyn = false; glob.ahDyn = false; glob.oqDyn = false; glob.aturbDyn = false; glob.afDyn = false; glob.abDyn = false; glob.tlDyn = false; glob.flDyn = false; glob.anvDyn = false; glob.fnzDyn = false; glob.bnzDyn = false; glob.fnpDyn = false; glob.bnpDyn = false; glob.sqDyn = false; glob.diDyn = false; glob.df1Dyn = false; glob.db1Dyn = false; glob.ftpDyn = false; glob.btpDyn = false; glob.ftzDyn = false; glob.btzDyn = false; glob.a2fDyn = false; glob.a3fDyn = false; glob.a4fDyn = false; glob.a5fDyn = false; glob.a6fDyn = false; glob.a1vDyn = false; glob.a2vDyn = false; glob.a3vDyn = false; glob.a4vDyn = false; glob.atvDyn = false;
00652   
00653   ifstream inFile(fileName.c_str());
00654   if (inFile.good()) {
00655     while  (getline(inFile, buffer)) {
00656       if (buffer != "") {
00657         istrstream ist(buffer.c_str());
00658         ist>>token; 
00659         if (token != "#") {
00660           ist>>token; // sec. entry is value
00661           switch (lineCounter) {
00662           case 0: glob.ui = atoi(token.c_str());
00663             break;
00664           case 1: glob.sr = atoi(token.c_str());
00665             break;
00666           case 2: glob.nf = atoi(token.c_str());
00667             break;
00668           case 3: glob.ss = atoi(token.c_str());
00669             break;
00670           case 4: glob.rs = atoi(token.c_str());
00671             break;
00672           case 5: glob.sb = atoi(token.c_str());
00673             break;
00674           case 6: glob.cp = atoi(token.c_str());
00675             break;
00676           case 7: glob.os = atoi(token.c_str());
00677             break;
00678           case 8: glob.gv = atoi(token.c_str());
00679             break;
00680           case 9: glob.gh = atoi(token.c_str());
00681             break;
00682           case 10: glob.gf = atoi(token.c_str());
00683             break;
00684           case 11: glob.f0 = atoi(token.c_str());
00685             break;
00686           case 12: glob.av = atoi(token.c_str());
00687             break;
00688           case 13: glob.ah = atoi(token.c_str());
00689             break;
00690           case 14: glob.af = atoi(token.c_str());
00691             break;
00692           case 15: glob.tl = atoi(token.c_str());
00693             break;
00694           case 16: glob.oq = atoi(token.c_str());
00695             break;
00696           case 17: glob.sq = atoi(token.c_str());
00697             break;
00698           case 18: glob.fl = atoi(token.c_str());
00699             break;
00700           case 19: glob.di = atoi(token.c_str());
00701             break;
00702           case 20: glob.aturb = atoi(token.c_str());
00703             break;
00704           case 21: glob.avp = atoi(token.c_str());
00705             break;
00706           case 22: glob.gain = atoi(token.c_str());
00707             break;
00708           case 23: glob.fnz = atoi(token.c_str());
00709             break;
00710           case 24: glob.bnz = atoi(token.c_str());
00711             break;
00712           case 25: glob.fnp = atoi(token.c_str());
00713             break;
00714           case 26: glob.bnp = atoi(token.c_str());
00715             break;
00716           case 27: glob.ftp = atoi(token.c_str());
00717             break;
00718           case 28: glob.btp = atoi(token.c_str());
00719             break;
00720           case 29: glob.ftz = atoi(token.c_str());
00721             break;
00722           case 30: glob.btz = atoi(token.c_str());
00723             break;
00724           case 31: glob.df1 = atoi(token.c_str());
00725             break;
00726           case 32: glob.db1 = atoi(token.c_str());
00727             break;
00728           case 33: glob.f1 = atoi(token.c_str());
00729             break;
00730           case 34: glob.f2 = atoi(token.c_str());
00731             break;
00732           case 35: glob.f3 = atoi(token.c_str());
00733             break;
00734           case 36: glob.f4 = atoi(token.c_str());
00735             break;
00736           case 37: glob.f5 = atoi(token.c_str());
00737             break;
00738           case 38: glob.f6 = atoi(token.c_str());
00739             break;
00740           case 39: glob.b1 = atoi(token.c_str());
00741             break;
00742           case 40: glob.b2 = atoi(token.c_str());
00743             break;
00744           case 41: glob.b3 = atoi(token.c_str());
00745             break;
00746           case 42: glob.b4 = atoi(token.c_str());
00747             break;
00748           case 43: glob.b5 = atoi(token.c_str());
00749             break;
00750           case 44: glob.b6 = atoi(token.c_str());
00751             break;
00752           case 45: glob.anv = atoi(token.c_str());
00753             break;
00754           case 46: glob.ab = atoi(token.c_str());
00755             break;
00756           case 47: glob.a2f = atoi(token.c_str());
00757             break;
00758           case 48: glob.a3f = atoi(token.c_str());
00759             break;
00760           case 49: glob.a4f = atoi(token.c_str());
00761             break;
00762           case 50: glob.a5f = atoi(token.c_str());
00763             break;
00764           case 51: glob.a6f = atoi(token.c_str());
00765             break;
00766           case 52: glob.b2p = atoi(token.c_str());
00767             break;
00768           case 53: glob.b3p = atoi(token.c_str());
00769             break;
00770           case 54: glob.b4p = atoi(token.c_str());
00771             break;
00772           case 55: glob.b5p = atoi(token.c_str());
00773             break;
00774           case 56: glob.b6p = atoi(token.c_str());
00775             break;
00776           case 57: glob.a1v = atoi(token.c_str());
00777             break;
00778           case 58: glob.a2v = atoi(token.c_str());
00779             break;
00780           case 59: glob.a3v = atoi(token.c_str());
00781             break;
00782           case 60: glob.a4v = atoi(token.c_str());
00783             break;
00784           case 61: glob.atv = atoi(token.c_str());
00785             break;
00786           case 62: glob.a1 = atoi(token.c_str());
00787             break;
00788           case 63: glob.b1p = atoi(token.c_str());
00789             break;
00790           case 64: glob.a2 = atoi(token.c_str());
00791             break;
00792           case 65: glob.a3 = atoi(token.c_str());
00793             break;
00794           case 66: glob.a4 = atoi(token.c_str());
00795             break;
00796           case 67: glob.a5 = atoi(token.c_str());
00797             break;
00798           case 68: glob.a6 = atoi(token.c_str());
00799             break;
00800           case 69: glob.copysynthesis = (bool) atoi(token.c_str());
00801             break;          
00802   default: 
00803             error ("something's wrong in klatt init-file: "+fileName+" (might be a space in an empty line)\n", -3);
00804           }
00805           // cout << lineCounter << " " << token << "\n";
00806           lineCounter++;
00807         } 
00808       } 
00809     }
00810     inFile.close();
00811 
00812   } else {
00813     error("can't open klatt-init file: "+fileName+"\n", -1);
00814   } // if (inFile.good())
00815   
00816 }

int main ( int argc,
char ** argv )
 

00087                                 {
00088 
00089   char *inFileName, *outFileName, *modFileName, *testConfFile;
00090   globalsT glob;
00091   char *klattDefaultFileName = "emoSyn.conf";
00092   char *diphonBaseName = "diphonDB/";
00093   string buffer;
00094   int argNum;
00095   phrase inPhrase;
00096 
00097   argNum = argc-1;
00098 
00099   if (RETURN_OK==
00100       parse_argument_string(argc, argv, "-kd", &klattDefaultFileName))
00101     argNum -= 2;
00102 
00103   if (parse_argument_flag(argc, argv, "-h"))
00104     usage();
00105 
00106   if (parse_argument_flag(argc, argv, "-v")) {
00107     cerr<<"version: "<<version<<"\n";
00108     exit(0);
00109   }
00110 
00111   initKlattDefaults(glob, string(klattDefaultFileName));
00112 
00113   if (parse_argument_flag(argc, argv, "-vb")) {
00114     glob.verbose = true;
00115     argNum -= 1;
00116   }
00117 
00118   
00119   if (RETURN_OK== parse_argument_string(argc, argv, "-db", &diphonBaseName))
00120     argNum -= 2;
00121   
00122   if (parse_argument_string(argc, argv, "-ko", &outFileName)==RETURN_OK)
00123     glob.senSyn=false;
00124   if (parse_argument_string(argc, argv, "-so", &outFileName)==RETURN_OK)
00125     glob.senSyn=true;
00126 
00127   if (RETURN_OK==parse_argument_flag(argc, argv, "-use4Freq")) {
00128     glob.use4Freq = true;
00129     argNum--;
00130   }
00131   if (RETURN_OK==parse_argument_flag(argc, argv, "-use5Freq")) {
00132     glob.use5Freq = true;
00133     argNum--;
00134   }
00135 
00136   if (RETURN_OK==parse_argument_flag(argc, argv, "-testKlatt")) {
00137     initKlattDefaults(glob, "klattInit.asc");
00138     glob.senSyn=false;
00139     inPhrase.makeTest(glob, 1000);
00140     ofstream outFile("klattTest.par");
00141     if (outFile.good()) {
00142       inPhrase.printKlattFile(outFile);
00143     }
00144     outFile.close();
00145     return 0;
00146   }
00147   if (RETURN_OK==parse_argument_string(argc, argv, "-testSensyn", &testConfFile)) {
00148     initKlattDefaults(glob, string(testConfFile));
00149     inPhrase.makeTest(glob, 1000);
00150     ofstream outFile("klattTest.doc");
00151     if (outFile.good()) {
00152       inPhrase.printSenSynFile(glob, outFile);
00153     }
00154     outFile.close();
00155     return 0;
00156   }
00157 
00158   // this is to create a pho-file from a database, first step for copysynthesis
00159   if (parse_argument_string(argc, argv, "-makePhoFromDB", &inFileName)==RETURN_OK) {
00160     argNum -= 2;
00161     ifstream inFile(inFileName);
00162     glob.copyDB = true;
00163     if (inFile.good()) {
00164       inPhrase.readPhoList(inFile, glob);
00165       inFile.close();
00166     } else {
00167       error("couldn't open Pho-File: " + string(inFileName) + "\n", -1);
00168     }
00169     inPhrase.readF0FromDB(diphonBaseName, glob);
00170     inPhrase.printPhoFile(cout, glob);
00171     return 0;
00172   }  
00173 
00174   // here start's 'the real thing',
00175   // readin the pho-file
00176   if (parse_argument_string(argc, argv, "-i", &inFileName)==RETURN_OK) {
00177     argNum -= 2;
00178     ifstream inFile(inFileName);
00179     if (inFile.good()) {
00180       inPhrase.readPhoFile(inFile, glob);
00181       inFile.close();
00182       inPhrase.calcMeanF0();
00183     } else {
00184       error("couldn't open Pho-File: " + string(inFileName) + "\n", -1);
00185     }
00186   } else {
00187     usage();
00188   }  
00189   
00190 
00191 
00192   // read in diphon values and assign to phones
00193   inPhrase.readPhonData(diphonBaseName, glob);
00194 
00195   cout << "original phrase has mean F0-Val of "<<inPhrase.MeanF0()/10<<" Hz and F0-Range of "<<inPhrase.F0Range()<<" Semitones\n";
00196   
00197   if (parse_argument_string(argc, argv, "-mf", &modFileName)==RETURN_OK) {
00198     argNum -= 2;
00199     ifstream modFile(modFileName);
00200     if (modFile.good()) {
00201       while  (getline(modFile, buffer)) {
00202         if (buffer != "") {
00203           vector<string> bufferVec;
00204           bufferVec = string2vec(buffer);
00205           if (bufferVec.size()>=1) {
00206             string argName = bufferVec[0];
00207             if (argName != "#"&&bufferVec.size()>=1) {
00208               // modify duration parameters
00209               if (argName == "-changeSpeechRate") {
00210                 if (bufferVec.size()>=4) {
00211                   uint rate = atoi(bufferVec[1].c_str());
00212                   if (rate < MIN_SPEECHRATE || rate > MAX_SPEECHRATE)
00213                     error ("emoSyn:rate < MIN_SPEECHRATE || rate > MAX_SPEECHRATE", -3);
00214                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00215                   int method = atoi(bufferVec[3].c_str());
00216                   if (rate!=100) {
00217                     inPhrase.changeSpeechRate(rate, glob, method);
00218                   }
00219                 } else
00220                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00221               }
00222               
00223               if (argName  == "-changeDurStressed") {
00224                 if (bufferVec.size()>=4) {
00225                   int rate = atoi(bufferVec[1].c_str());
00226                   int both = atoi(bufferVec[2].c_str());
00227                   glob.changeDurMethod = atoi(bufferVec[3].c_str());
00228                   if (rate!=100) 
00229                     inPhrase.changeDurStressed(rate, both, glob); 
00230                 } else
00231                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00232                 
00233               }
00234               if (argName == "-changeDurNonStressed") {
00235                 if (bufferVec.size()>=4) {
00236                   int rate = atoi(bufferVec[1].c_str());
00237                   int both = atoi(bufferVec[2].c_str());
00238                   glob.changeDurMethod = atoi(bufferVec[3].c_str());
00239                   if (rate!=100) 
00240                     inPhrase.changeDurNonStressed(rate, both, glob); 
00241                 } else
00242                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00243               } 
00244               if (argName == "-changeDurVowels") {
00245                 if (bufferVec.size()>=3) {
00246                   int rate = atoi(bufferVec[1].c_str());
00247                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00248                   if (rate!=100) {
00249                     inPhrase.changeDurManner(long_vowel, rate, glob); 
00250                     inPhrase.changeDurManner(short_vowel, rate, glob); 
00251                   }  
00252                 } else
00253                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00254               }
00255               if (argName == "-changeDurLiquides") {
00256                 if (bufferVec.size()>=3) { 
00257                   int rate = atoi(bufferVec[1].c_str());
00258                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00259                 if (rate!=100)
00260                   inPhrase.changeDurManner(liquide, rate, glob); 
00261                 } else
00262                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00263               }
00264               if (argName == "-changeDurNasals") {
00265                 if (bufferVec.size()>=3) {
00266                   int rate = atoi(bufferVec[1].c_str());
00267                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00268                   if (rate!=100)
00269                     inPhrase.changeDurManner(nasal, rate, glob); 
00270                 } else
00271                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00272               }
00273               if (argName == "-changeDurFricV") {
00274                 if (bufferVec.size()>=3) {
00275                   int rate = atoi(bufferVec[1].c_str());
00276                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00277                   if (rate!=100)
00278                     inPhrase.changeDurManner(fricative_voiced, rate, glob); 
00279                 } else
00280                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00281               }
00282               if (argName == "-changeDurFricVL") {
00283                 if (bufferVec.size()>=3) {
00284                   int rate = atoi(bufferVec[1].c_str());
00285                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00286                   if (rate!=100)
00287                     inPhrase.changeDurManner(fricative_voiceless, rate, glob); 
00288                 } else
00289                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00290               }
00291               if (argName == "-changeDurPlosV") {
00292                 if (bufferVec.size()>=3) { 
00293                   int rate = atoi(bufferVec[1].c_str());
00294                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00295                   if (rate!=100)
00296                     inPhrase.changeDurManner(stop_voiced, rate, glob); 
00297                 } else
00298                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00299               }
00300               if (argName == "-changeDurPlosVL") {
00301                 if (bufferVec.size()>=3) { 
00302                   int rate = atoi(bufferVec[1].c_str());
00303                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00304                   if (rate!=100)
00305                     inPhrase.changeDurManner(stop_voiceless, rate, glob); 
00306                 } else
00307                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00308               }
00309               if (argName == "-changeDurSilence") {
00310                 if (bufferVec.size()>=3) {
00311                   int rate = atoi(bufferVec[1].c_str());
00312                   glob.changeDurMethod = atoi(bufferVec[2].c_str());
00313                   if (rate!=100) 
00314                     inPhrase.changeDurManner(silence, rate, glob); 
00315                 } else
00316                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00317               }
00318               // modify intensity
00319               if (argName == "-stressedIntensity") {
00320                 if (bufferVec.size()>=3) {
00321                   int dBVal = atoi(bufferVec[1].c_str());
00322                   int both = atoi(bufferVec[2].c_str());
00323                   if (dBVal!=0) 
00324                     inPhrase.changeStressedInt(dBVal, both, glob); 
00325                 } else
00326                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00327               }
00328               
00329               // modify pitch-contour
00330               if (argName == "-changeMeanF0") {
00331                 if (bufferVec.size()>=2) {
00332                   int rate = atoi(bufferVec[1].c_str());
00333                   if (rate!=100)
00334                     inPhrase.changeMeanF0(rate, glob);
00335                 } else
00336                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00337               }
00338               if (argName == "-changeStressedMeanF0") {
00339                 if (bufferVec.size()>=3) {
00340                   int rate = atoi(bufferVec[1].c_str());
00341                   int both = atoi(bufferVec[2].c_str());
00342                   if (rate!=100)
00343                     inPhrase.changeStressedAvrF0(rate, both, glob);
00344                 } else
00345                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00346               }
00347               if (argName == "-changePreStressedMeanF0") {
00348                 if (bufferVec.size()>=3) {
00349                   int rate = atoi(bufferVec[1].c_str());
00350                   int both = atoi(bufferVec[2].c_str());
00351                   if (rate!=100)
00352                     inPhrase.changePreStressedAvrF0(rate, both, glob);
00353                 } else
00354                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00355               }
00356               if (argName == "-smootheF0") {
00357                 if (bufferVec.size()>=2) {
00358                   int winsize = atoi(bufferVec[1].c_str());
00359                   if (winsize>0)
00360                     inPhrase.smootheF0(winsize, glob);
00361                 } else
00362                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00363               }     
00364               if (argName == "-changePitchContourStressed") {
00365                 if (bufferVec.size()>=4) {
00366                   CONTOUR_TYPE contType = (CONTOUR_TYPE) atoi(bufferVec[1].c_str());
00367                   uint gradient = atoi(bufferVec[2].c_str());
00368                   int both = atoi(bufferVec[3].c_str());
00369                   if (gradient!=0 || contType == straight)
00370                     inPhrase.changePitchContourStressed(contType, gradient, both, glob);
00371                 } else
00372                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00373               }
00374               if (argName == "-changeLastSylContour") {
00375                 if (bufferVec.size()>=3) {
00376                   CONTOUR_TYPE contType = (CONTOUR_TYPE) atoi(bufferVec[1].c_str());
00377                   uint gradient = atoi(bufferVec[2].c_str());
00378                   if (gradient!=0 || contType == straight)
00379                     inPhrase.changeLastSylContour(contType, gradient, glob);
00380                 } else
00381                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00382               }
00383               if (argName == "-changeF0Range") {
00384                 if (bufferVec.size()>=2) {
00385                   int rate = atoi(bufferVec[1].c_str());
00386                   if (rate!=100)
00387                     inPhrase.changeF0Range(rate, glob);
00388                 } else
00389                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00390               }
00391               if (argName == "-changeF0Variability") {
00392                 if (bufferVec.size()>=2) {
00393                   int rate = atoi(bufferVec[1].c_str());
00394                   if (rate!=100)
00395                     inPhrase.changeVariability(rate, glob);
00396                 } else
00397                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00398               }
00399               if (argName == "-changePhraseContour") {
00400                 if (bufferVec.size()>=3) {
00401                   CONTOUR_TYPE contType = (CONTOUR_TYPE) atoi(bufferVec[1].c_str());            
00402                   int rate = atoi(bufferVec[2].c_str());
00403                   if (rate!=100 || contType == straight)
00404                     inPhrase.changePhraseContour(contType, rate, glob);
00405                 } else
00406                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00407               }
00408               if (argName == "-changePhraseContourToAccent") {
00409                 if (bufferVec.size()>=2) {
00410                   int rate = atoi(bufferVec[1].c_str());
00411                   if (rate!=100)
00412                     inPhrase.changePhraseContourToAccent(rate, glob);
00413                 } else
00414                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00415               }
00416               if (argName == "-addWaves") {
00417                 if (bufferVec.size()>=4) {
00418                   int accRate = atoi(bufferVec[1].c_str());
00419                   int nonAccRate = atoi(bufferVec[2].c_str());
00420                   int method = atoi(bufferVec[3].c_str());
00421                   if (accRate!=100||nonAccRate!=100)
00422                     inPhrase.addWave(accRate, nonAccRate, method, glob);
00423                 } else
00424                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00425               }
00426               // voice/speaking-style modifications: 
00427               if (argName == "-overshootVowels") {
00428                 if (bufferVec.size()>=3) {
00429                   ACCENT_TYPE accent = (ACCENT_TYPE) atoi(bufferVec[1].c_str());
00430                   int rate = atoi(bufferVec[2].c_str());
00431                   if (rate!=0)
00432                     inPhrase.overshootVowels(accent, rate, glob);
00433                 } else
00434                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00435               }
00436               if (argName == "-undershootVowels") {
00437                 if (bufferVec.size()>=3) {
00438                   ACCENT_TYPE accent = (ACCENT_TYPE) atoi(bufferVec[1].c_str());
00439                   int rate = atoi(bufferVec[2].c_str());
00440                   if (rate!=0)
00441                     inPhrase.undershootVowels(accent, rate, glob);
00442                 } else
00443                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00444               }
00445               if (argName == "-spreadLips") {
00446                 if (bufferVec.size()>=2) {
00447                   int rate = atoi(bufferVec[1].c_str());
00448                   if (rate!=0)
00449                     inPhrase.spread(rate, glob);
00450                 } else
00451                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00452               }
00453               if (argName == "-roundedLips") {
00454                 if (bufferVec.size()>=2) {
00455                   int rate = atoi(bufferVec[1].c_str());
00456                   if (rate!=0)
00457                     inPhrase.rounded(rate, glob);
00458                 } else
00459                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00460               }
00461               if (argName == "-headSize") {
00462                 if (bufferVec.size()>=2) {
00463                   int rate = atoi(bufferVec[1].c_str());
00464                   if (rate!=0)
00465                     inPhrase.headSize(rate, glob);
00466                 } else
00467                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00468               }
00469               if (argName == "-coarticulation") {
00470                 if (bufferVec.size()>=3) {
00471                   int rate = atoi(bufferVec[1].c_str());
00472                   CO_TYPE coType  = (CO_TYPE) atoi(bufferVec[2].c_str());
00473                   if (rate!=0)
00474                     inPhrase.coarticulation(rate, coType, glob);
00475                 } else
00476                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00477               }
00478               if (argName == "-assimilateConsonants") {
00479                 inPhrase.assimilateConsonants(glob);
00480               }
00481               if (argName == "-jitter") {
00482                 if (bufferVec.size()>=4) {
00483                   ACCENT_TYPE accent = (ACCENT_TYPE) atoi(bufferVec[1].c_str());
00484                   int rate = atoi(bufferVec[2].c_str());
00485                   int method = atoi(bufferVec[3].c_str());
00486                   if (rate!=0)
00487                     inPhrase.addJitter(accent, rate, method, glob);
00488                 } else
00489                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00490               }
00491               if (argName == "-tense") {
00492                 if (bufferVec.size()>=2) {
00493                   int rate = atoi(bufferVec[1].c_str());
00494                   if (rate!=0)
00495                     inPhrase.addTense(rate, glob);
00496                 } else
00497                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00498               }
00499               if (argName == "-breathy") {
00500                 if (bufferVec.size()>=2) {
00501                   int rate = atoi(bufferVec[1].c_str());
00502                   if (rate!=0)
00503                     inPhrase.addBreathy(rate, glob);
00504                 } else
00505                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00506               }
00507               if (argName == "-whispery") {
00508                 if (bufferVec.size()>=2) {
00509                   int rate = atoi(bufferVec[1].c_str());
00510                   if (rate!=0)
00511                     inPhrase.addWhisper(rate, glob);
00512                 } else
00513                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00514               }
00515               if (argName == "-creaky") {
00516                 if (bufferVec.size()>=2) {
00517                   int rate = atoi(bufferVec[1].c_str());
00518                   if (rate!=0)
00519                     inPhrase.addCreaky(rate, glob);
00520                 } else
00521                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00522               }
00523               if (argName == "-laryngealized") {
00524                 if (bufferVec.size()>=2) {
00525                   int rate = atoi(bufferVec[1].c_str());
00526                   if (rate!=0)
00527                     inPhrase.addLaryngealized(rate, glob);
00528                 } else
00529                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00530               }
00531               if (argName == "-falsetto") {
00532                 if (bufferVec.size()>=2) {
00533                   int rate = atoi(bufferVec[1].c_str());
00534                   if (rate!=0)
00535                     inPhrase.addFalsett(rate, glob);
00536                 } else
00537                   error("missing argument in modFile at arg: "+argName+"\n", -1);
00538               }
00539             }
00540           }
00541         }
00542       }
00543       modFile.close();
00544     } else {
00545       error("couldn't open Mod-File: " + string(modFileName) + "\n", -1);
00546     } 
00547   }
00548  
00549   inPhrase.modelKlattParameters(glob);
00550    
00551   inPhrase.modelFeatures(glob);
00552 
00553   cout << "modified phrase has mean F0-Val of "<<inPhrase.MeanF0()/10<<" Hz and F0-Range of "<<inPhrase.F0Range()<<" Semitones\n";
00554  
00555   if (RETURN_OK==parse_argument_flag(argc, argv, "-printSylStats")) {
00556     argNum -= 1;    
00557     inPhrase.printSyllableVec(cerr);
00558   }  
00559 
00560   // inPhrase.printPhonFeatures(cout);
00561   
00562 
00563   if (parse_argument_string(argc, argv, "-ko", &outFileName)==RETURN_OK) {
00564     ofstream outFile(outFileName);
00565     if (outFile.good()) {
00566       inPhrase.printKlattFile(outFile);
00567       outFile.close();
00568     } else {
00569       error("problems writing to: " + string(outFileName) + "\n", -1);
00570     }
00571     argNum -= 2;
00572   }
00573   if (parse_argument_string(argc, argv, "-so", &outFileName)==RETURN_OK) {
00574     ofstream outFile(outFileName);
00575     if (outFile.good()) {
00576       inPhrase.printSenSynFile(glob, outFile);
00577       outFile.close();
00578     } else {
00579       error("problems writing to: " + string(outFileName) + "\n", -1);
00580     }
00581     argNum -= 2;
00582   }
00583   if (parse_argument_flag(argc, argv, "-po")==RETURN_OK) {
00584     inPhrase.printPhoFile(cout, glob);
00585     argNum--;
00586   }
00587   /*                                              
00588     if (parse_argument_flag(argc, argv, "-lo")==RETURN_OK) {
00589     inPhrase.printLabelFile(cout, glob);
00590     argNum--;
00591   }
00592   */
00593   if (parse_argument_string(argc, argv, "-lo", &outFileName)==RETURN_OK) {
00594     ofstream outFile(outFileName);
00595     if (outFile.good()) {
00596       inPhrase.printLabelFile(outFile, glob);
00597       outFile.close();
00598     } else {
00599       error("problems writing to: " + string(outFileName) + "\n", -1);
00600     }
00601     argNum -= 2;
00602   }
00603   if (argNum != 0)
00604     warn("unrecognized argument\n");
00605   return 0;
00606 }

void usage ( )
 

00608              {
00609   cout << "\n"
00610        << "emoSyn: program to modify pho-files and generate klatt-files\n"
00611        << "usage:\n<-i pho-file>\t\t:input file\n"
00612        << "[-v]\t:print version and exit\n"    
00613        << "[-h]\t:print usage and exit\n"    
00614        << "[-vb]\t:verbose mode\n"    
00615        << "[-printSylStats]\n"    
00616        << "[-mf modFileName]\t:file with modification parameters\n"    
00617        << "[-po]\t\t\t:output stdout pho-file\n"    
00618        << "[-lo <OF>]\t\t:output to <OF> esps label-file\n"
00619        << "<-kd klatt-defaultfile>\t:file with default parameters\n"    
00620        << "<-db diphon-base name>\t:name of dir with diphon-files\n"    
00621        << "[-testKlatt]\t\t:output 1 sec test-paramfile to klattTest.par\n"
00622        << "[-testSensyn parFile]\t:output 1 sec test-paramfile to klattTest.doc\n"
00623        << "[-makePhoFromDB phonFile]\t\n"
00624        <<"[-so klatt-file]\t:output senSyn-parameter-file\n"
00625        <<"[-ko klatt-file]\t:output klatt-parameter-file\n"
00626        <<"[-use4Freq -use5Freq -use3BW -use5BW]\n"
00627        << "\n";
00628   exit(1);
00629 }


Variable Documentation

const string version = "0.01"
 

version number.


Generated at Fri Sep 29 12:13:21 2000 for emoSyn by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000