Skip to content

Commit

Permalink
Make smoothing of fres dependent on Q
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Nov 16, 2024
1 parent 0949bdd commit 916cebb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rvoice/fluid_iir_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,12 @@ void fluid_iir_filter_calc(fluid_iir_filter_t *iir_filter,
}
else if(FLUID_FABS(fres_diff) > 0.01f)
{
static const int fres_incr_count = FLUID_BUFSIZE;
int fres_incr_count = FLUID_BUFSIZE;
fluid_real_t num_buffers = iir_filter->last_q;
fluid_clip(num_buffers, 1, 8);
// For high values of Q, the phase gets really steep. To prevent clicks when quickly modulating fres in this case, we need to smooth out "slower".
// This is done by simply using Q times FLUID_BUFSIZE samples for the interpolation to complete, capped at 8.
fres_incr_count *= num_buffers;
iir_filter->fres_incr = fres_diff / (fres_incr_count);
iir_filter->fres_incr_count = fres_incr_count;
iir_filter->target_fres = fres;
Expand Down

0 comments on commit 916cebb

Please sign in to comment.