Skip to content

Commit 91ef401

Browse files
committed
Limiting the gain decay
1 parent 3d2acb8 commit 91ef401

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/denoise.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct DenoiseState {
9393
float last_gain;
9494
int last_period;
9595
float mem_hp_x[2];
96+
float lastg[NB_BANDS];
9697
RNNState rnn;
9798
};
9899

@@ -487,6 +488,11 @@ float rnnoise_process_frame(DenoiseState *st, float *out, const float *in) {
487488
if (!silence) {
488489
compute_rnn(&st->rnn, g, &vad_prob, features);
489490
pitch_filter(X, P, Ex, Ep, Exp, g);
491+
for (i=0;i<NB_BANDS;i++) {
492+
float alpha = .6f;
493+
g[i] = MAX16(g[i], alpha*st->lastg[i]);
494+
st->lastg[i] = g[i];
495+
}
490496
interp_band_gain(gf, g);
491497
#if 1
492498
for (i=0;i<FREQ_SIZE;i++) {

0 commit comments

Comments
 (0)