Skip to content

Commit

Permalink
repaired a bug that made the autocorrelation method have one coeffici…
Browse files Browse the repository at this point in the history
…ent missing
  • Loading branch information
davidweenink committed Nov 23, 2024
1 parent 8655b73 commit 1e16767
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions LPC/SoundToLPCWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ bool structSoundToLPCAutocorrelationWorkspace :: inputFrameToOutputFrame (void)
a [1] = 1.0;
a [2] = rc [1] = - r [2] / r [1];
thy gain = r [1] + r [2] * rc [1];
integer iend = 1;
for (integer i = 2; i <= m; i ++) {
integer i = 1;
for (i = 2; i <= m; i ++) {
long double s = 0.0;
for (integer j = 1; j <= i; j ++)
s += r [i - j + 2] * a [j];
Expand All @@ -131,11 +131,10 @@ bool structSoundToLPCAutocorrelationWorkspace :: inputFrameToOutputFrame (void)
frameAnalysisInfo = 2;
break;
}
iend ++;
}
-- iend;
thy a.part (1, iend) <<= a.part (2, iend + 1);
thy a.resize (iend);
-- i;
thy a.part (1, i) <<= a.part (2, i + 1);
thy a.resize (i);
thy nCoefficients = thy a.size; // maintain invariant
return true;
}
Expand Down

0 comments on commit 1e16767

Please sign in to comment.