Browse Source

klatt.cpp: fix a sound spike in setzeroabc when f == 0.

If setzeroabc is passed f == 0, rp->a will be set to 0 and when
the coefficients get inverted (a'=1/a, b'=b/a, c'=c/a) then a',
b' and c' get set to INF. This results in an audible sound spike
when these resonators get used.

Found when investigating an issue in klatt with example1.par when
using the cascade synthesis mode.

Bug: https://github.com/rhdunn/klatt/issues/1.
master
Reece Dunn 14 years ago
parent
commit
40e63482e0
1 changed files with 11 additions and 9 deletions
  1. 11
    9
      src/klatt.cpp

+ 11
- 9
src/klatt.cpp View File

@@ -884,11 +884,6 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
f = -f;
if(f>=0)
{
f = -1;
}
/* First compute ordinary resonator coefficients */
/* Let r = exp(-pi bw t) */
arg = kt_globals.minus_pi_t * bw;
@@ -904,10 +899,17 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
/* Let a = 1.0 - b - c */
rp->a = 1.0 - rp->b - rp->c;
/* Now convert to antiresonator coefficients (a'=1/a, b'=b/a, c'=c/a) */
rp->a = 1.0 / rp->a;
rp->c *= -rp->a;
rp->b *= -rp->a;
/* If f == 0 then rp->a gets set to 0 which makes a'=1/a set a', b' and c' to
* INF, causing an audible sound spike when triggered (e.g. apiration with the
* nasal register set to f=0, bw=0).
*/
if (rp->a != 0)
{
/* Now convert to antiresonator coefficients (a'=1/a, b'=b/a, c'=c/a) */
rp->a = 1.0 / rp->a;
rp->c *= -rp->a;
rp->b *= -rp->a;
}
}



Loading…
Cancel
Save