mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-04 15:49:48 +00:00
Merge pull request #1104
This commit is contained in:
@@ -1399,10 +1399,10 @@ static int LoadEnvelope2(FILE *f)
|
|||||||
env_y[n_points] = env_y[n_points-1];
|
env_y[n_points] = env_y[n_points-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ix = -1;
|
ix = 0;
|
||||||
ix2 = 0;
|
ix2 = 0;
|
||||||
if (n_points > 0) for (x = 0; x < ENV_LEN; x++) {
|
if (n_points > 0) for (x = 0; x < ENV_LEN; x++) {
|
||||||
if (n_points > 3 && x > env_x[ix+4])
|
if (n_points > 3 && x > env_x[ix+3])
|
||||||
ix++;
|
ix++;
|
||||||
if (n_points > 2 && x >= env_x[ix2+1])
|
if (n_points > 2 && x >= env_x[ix2+1])
|
||||||
ix2++;
|
ix2++;
|
||||||
|
|||||||
@@ -60,24 +60,24 @@ float polint(float xa[], float ya[], int n, float x)
|
|||||||
float y; // result
|
float y; // result
|
||||||
float c[9], d[9];
|
float c[9], d[9];
|
||||||
|
|
||||||
dif = fabs(x-xa[1]);
|
dif = fabs(x-xa[0]);
|
||||||
|
|
||||||
for (i = 1; i <= n; i++) {
|
for (i = 1; i <= n; i++) {
|
||||||
if ((dift = fabs(x-xa[i])) < dif) {
|
if ((dift = fabs(x-xa[i-1])) < dif) {
|
||||||
ns = i;
|
ns = i;
|
||||||
dif = dift;
|
dif = dift;
|
||||||
}
|
}
|
||||||
c[i] = ya[i];
|
c[i] = ya[i-1];
|
||||||
d[i] = ya[i];
|
d[i] = ya[i-1];
|
||||||
}
|
}
|
||||||
y = ya[ns--];
|
y = ya[--ns];
|
||||||
for (m = 1; m < n; m++) {
|
for (m = 1; m < n; m++) {
|
||||||
for (i = 1; i <= n-m; i++) {
|
for (i = 1; i <= n-m; i++) {
|
||||||
ho = xa[i]-x;
|
ho = xa[i-1]-x;
|
||||||
hp = xa[i+m]-x;
|
hp = xa[i+m-1]-x;
|
||||||
w = c[i+1]-d[i];
|
w = c[i+1]-d[i];
|
||||||
if ((den = ho-hp) == 0.0)
|
if ((den = ho-hp) == 0.0)
|
||||||
return ya[2]; // two input xa are identical
|
return ya[1]; // two input xa are identical
|
||||||
den = w/den;
|
den = w/den;
|
||||||
d[i] = hp*den;
|
d[i] = hp*den;
|
||||||
c[i] = ho*den;
|
c[i] = ho*den;
|
||||||
|
|||||||
Reference in New Issue
Block a user