void klatt::pitch_synch_par_reset(int ns) { if (mF0FundamentalFreq > 0) { mT0 = (40 * mSampleRate) / mF0FundamentalFreq; /* Period in samp*4 */ mAmpVoice = DBtoLIN(mVoicingAmpdb); /* Duration of period before amplitude modulation */ mNMod = mT0; if (mVoicingAmpdb > 0) { mNMod >>= 1; }
void klatt::pitch_synch_par_reset(klatt_frame *frame, int ns) { /* * Constant natglot[] controls shape of glottal pulse as a function * of desired duration of open phase N0 * (Note that N0 is specified in terms of 40,000 samples/sec of speech) * * Assume voicing waveform V(t) has form: k1 t**2 - k2 t**3 * * If the radiation characterivative, a temporal derivative * is folded in, and we go from continuous time to discrete * integers n: dV/dt = mVWave[n] * = sum over i=1,2,...,n of { a - (i * b) } * = a n - b/2 n**2 * * where the constants a and b control the detailed shape * and amplitude of the voicing waveform over the open * potion of the voicing cycle "mNOpen". * * Let integral of dV/dt have no net dc flow --> a = (b * mNOpen) / 3 * * Let maximum of dUg(n)/dn be constant --> b = gain / (mNOpen * mNOpen) * meaning as mNOpen gets bigger, V has bigger peak proportional to n * * Thus, to generate the table below for 40 <= mNOpen <= 263: * * natglot[mNOpen - 40] = 1920000 / (mNOpen * mNOpen) */ static const short natglot[224] = { 1200, 1142, 1088, 1038, 991, 948, 907, 869, 833, 799, 768, 738, 710, 683, 658, 634, 612, 590, 570, 551, 533, 515, 499, 483, 468, 454, 440, 427, 415, 403, 391, 380, 370, 360, 350, 341, 332, 323, 315, 307, 300, 292, 285, 278, 272, 265, 259, 253, 247, 242, 237, 231, 226, 221, 217, 212, 208, 204, 199, 195, 192, 188, 184, 180, 177, 174, 170, 167, 164, 161, 158, 155, 153, 150, 147, 145, 142, 140, 137, 135, 133, 131, 128, 126, 124, 122, 120, 119, 117, 115, 113, 111, 110, 108, 106, 105, 103, 102, 100, 99, 97, 96, 95, 93, 92, 91, 90, 88, 87, 86, 85, 84, 83, 82, 80, 79, 78, 77, 76, 75, 75, 74, 73, 72, 71, 70, 69, 68, 68, 67, 66, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 41, 41, 40, 40, 39, 39, 38, 38, 38, 38, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 27, 27 }; if (mF0FundamentalFreq > 0) { mT0 = (40 * mSampleRate) / mF0FundamentalFreq; /* Period in samp*4 */ mAmpVoice = DBtoLIN(mVoicingAmpdb); /* Duration of period before amplitude modulation */ mNMod = mT0; if (mVoicingAmpdb > 0) { mNMod >>= 1; }
mT0 = (40 * mSampleRate) / mF0FundamentalFreq; /* Period in samp*4 */ mAmpVoice = DBtoLIN(mVoicingAmpdb); /* Duration of period before amplitude modulation */ mNMod = mT0; if (mVoicingAmpdb > 0) { mNMod >>= 1; } /* Breathiness of voicing waveform */ mAmpBreth = DBtoLIN(mFrame.mVoicingBreathiness) * 0.1f; /* Set open phase of glottal period */ /* where 40 <= open phase <= 263 */ mNOpen = 4 * mFrame.mNoSamplesInOpenPeriod; if (mNOpen >= (mT0 - 1)) { mNOpen = mT0 - 2; } if (mNOpen < 40) { mNOpen = 40; /* F0 max = 1000 Hz */ }
mT0 = (40 * mSampleRate) / mF0FundamentalFreq; /* Period in samp*4 */ mAmpVoice = DBtoLIN(mVoicingAmpdb); /* Duration of period before amplitude modulation */ mNMod = mT0; if (mVoicingAmpdb > 0) { mNMod >>= 1; } /* Breathiness of voicing waveform */ mAmpBreth = DBtoLIN(frame->mVoicingBreathiness) * 0.1f; /* Set open phase of glottal period */ /* where 40 <= open phase <= 263 */ mNOpen = 4 * frame->mNoSamplesInOpenPeriod; if (mNOpen >= (mT0 - 1)) { mNOpen = mT0 - 2; } if (mNOpen < 40) { mNOpen = 40; /* F0 max = 1000 Hz */ }