Skip to content

Commit

Permalink
Let's scale our maximum attenuation correctly...
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorR committed Sep 21, 2018
1 parent ac477f1 commit 6168a49
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/denoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,10 @@ float rnnoise_process_frame(DenoiseState *st, float *out, const float *in) {
if (min < st->max_attenuation) {
if (min < MIN_MAX_ATTENUATION)
min = MIN_MAX_ATTENUATION;
mult = st->max_attenuation / min;
mult = (1.0f-st->max_attenuation) / (1.0f-min);
for (i=0;i<NB_BANDS;i++) {
if (g[i] < MIN_MAX_ATTENUATION) g[i] = MIN_MAX_ATTENUATION;
g[i] *= mult;
if (g[i] > 1) g[i] = 1;
g[i] = 1.0f-((1.0f-g[i]) * mult);
st->lastg[i] = g[i];
}
}
Expand Down

0 comments on commit 6168a49

Please sign in to comment.