MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / parwave

Method parwave

extlibs/soloud/src/audiosource/speech/klatt.cpp:558–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556*/
557
558void klatt::parwave(short int *jwave)
559{
560 /* Output of cascade branch, also final output */
561
562 /* Initialize synthesizer and get specification for current speech
563 frame from host microcomputer */
564
565 frame_init();
566
567 if (mF0Flutter != 0)
568 {
569 mTimeCount++; /* used for f0 flutter */
570 flutter(); /* add f0 flutter */
571 }
572
573 /* MAIN LOOP, for each output sample of current frame: */
574
575 int ns;
576 for (ns = 0; ns < mNspFr; ns++)
577 {
578 float noise;
579 int n4;
580 float sourc; /* Sound source if all-parallel config used */
581 float glotout; /* Output of glottal sound source */
582 float par_glotout; /* Output of parallelglottal sound sourc */
583 float voice = 0; /* Current sample of voicing waveform */
584 float frics; /* Frication sound source */
585 float aspiration; /* Aspiration sound source */
586 int nrand; /* Varible used by random number generator */
587
588 /* Our own code like rand(), but portable
589 whole upper 31 bits of seed random
590 assumes 32-bit unsigned arithmetic
591 with untested code to handle larger.
592 */
593 mSeed = mSeed * 1664525 + 1;
594
595 mSeed &= 0xFFFFFFFF;
596
597 /* Shift top bits of seed up to top of int then back down to LS 14 bits */
598 /* Assumes 8 bits per sizeof unit i.e. a "byte" */
599 nrand = (((int) mSeed) << (8 * sizeof(int) - 32)) >> (8 * sizeof(int) - 14);
600
601 /* Tilt down noise spectrum by soft ELM_FEATURE_LOW-pass filter having
602 * a pole near the origin in the z-plane, i.e.
603 * output = input + (0.75 * lastoutput) */
604
605 noise = nrand + (0.75f * mNLast); /* Function of samp_rate ? */
606
607 mNLast = noise;
608
609 /* Amplitude modulate noise (reduce noise amplitude during
610 second half of glottal period) if voicing simultaneously present
611 */
612
613 if (mNPer > mNMod)
614 {
615 noise *= 0.5f;

Callers

nothing calls this directly

Calls 3

clipFunction · 0.85
resonateMethod · 0.45
antiresonateMethod · 0.45

Tested by

no test coverage detected