| 467 | */ |
| 468 | |
| 469 | void klatt::frame_init() |
| 470 | { |
| 471 | int mOverallGaindb; /* Overall gain, 60 dB is unity 0 to 60 */ |
| 472 | float amp_parF1; /* mFormant1Ampdb converted to linear gain */ |
| 473 | float amp_parFN; /* mParallelNasalPoleAmpdb converted to linear gain */ |
| 474 | float amp_parF2; /* mFormant2Ampdb converted to linear gain */ |
| 475 | float amp_parF3; /* mFormant3Ampdb converted to linear gain */ |
| 476 | float amp_parF4; /* mFormant4Ampdb converted to linear gain */ |
| 477 | float amp_parF5; /* mFormant5Ampdb converted to linear gain */ |
| 478 | float amp_parF6; /* mFormant6Ampdb converted to linear gain */ |
| 479 | |
| 480 | /* Read speech frame definition into temp store |
| 481 | and move some parameters into active use immediately |
| 482 | (voice-excited ones are updated pitch synchronously |
| 483 | to avoid waveform glitches). |
| 484 | */ |
| 485 | |
| 486 | mF0FundamentalFreq = mFrame.mF0FundamentalFreq; |
| 487 | mVoicingAmpdb = mFrame.mVoicingAmpdb - 7; |
| 488 | |
| 489 | if (mVoicingAmpdb < 0) mVoicingAmpdb = 0; |
| 490 | |
| 491 | mAmpAspir = DBtoLIN(mFrame.mAspirationAmpdb) * .05f; |
| 492 | mAmpFrica = DBtoLIN(mFrame.mFricationAmpdb) * 0.25f; |
| 493 | mSkewnessOfAlternatePeriods = mFrame.mSkewnessOfAlternatePeriods; |
| 494 | |
| 495 | /* Fudge factors (which comprehend affects of formants on each other?) |
| 496 | with these in place ALL_PARALLEL should sound as close as |
| 497 | possible to CASCADE_PARALLEL. |
| 498 | Possible problem feeding in Holmes's amplitudes given this. |
| 499 | */ |
| 500 | amp_parF1 = DBtoLIN(mFrame.mFormant1Ampdb) * 0.4f; /* -7.96 dB */ |
| 501 | amp_parF2 = DBtoLIN(mFrame.mFormant2Ampdb) * 0.15f; /* -16.5 dB */ |
| 502 | amp_parF3 = DBtoLIN(mFrame.mFormant3Ampdb) * 0.06f; /* -24.4 dB */ |
| 503 | amp_parF4 = DBtoLIN(mFrame.mFormant4Ampdb) * 0.04f; /* -28.0 dB */ |
| 504 | amp_parF5 = DBtoLIN(mFrame.mFormant5Ampdb) * 0.022f; /* -33.2 dB */ |
| 505 | amp_parF6 = DBtoLIN(mFrame.mFormant6Ampdb) * 0.03f; /* -30.5 dB */ |
| 506 | amp_parFN = DBtoLIN(mFrame.mParallelNasalPoleAmpdb) * 0.6f; /* -4.44 dB */ |
| 507 | mAmpBypas = DBtoLIN(mFrame.mBypassFricationAmpdb) * 0.05f; /* -26.0 db */ |
| 508 | |
| 509 | // Set coeficients of nasal resonator and zero antiresonator |
| 510 | mNasalPole.initResonator(mFrame.mNasalPoleFreq, mFrame.mNasalPoleBandwidth, mSampleRate); |
| 511 | |
| 512 | mNasalZero.initAntiresonator(mFrame.mNasalZeroFreq, mFrame.mNasalZeroBandwidth, mSampleRate); |
| 513 | |
| 514 | // Set coefficients of parallel resonators, and amplitude of outputs |
| 515 | mParallelFormant1.initResonator(mFrame.mFormant1Freq, mFrame.mFormant1ParallelBandwidth, mSampleRate); |
| 516 | mParallelFormant1.setGain(amp_parF1); |
| 517 | |
| 518 | mParallelResoNasalPole.initResonator(mFrame.mNasalPoleFreq, mFrame.mNasalPoleBandwidth, mSampleRate); |
| 519 | mParallelResoNasalPole.setGain(amp_parFN); |
| 520 | |
| 521 | mParallelFormant2.initResonator(mFrame.mFormant2Freq, mFrame.mFormant2ParallelBandwidth, mSampleRate); |
| 522 | mParallelFormant2.setGain(amp_parF2); |
| 523 | |
| 524 | mParallelFormant3.initResonator(mFrame.mFormant3Freq, mFrame.mFormant3ParallelBandwidth, mSampleRate); |
| 525 | mParallelFormant3.setGain(amp_parF3); |
| 526 |
nothing calls this directly
no test coverage detected