more freq-related fixes in bw_phase_gen

This commit is contained in:
Stefano D'Angelo 2024-06-20 09:52:13 +02:00
parent 861cdc427e
commit 5d3fbdbb0a

View File

@ -460,6 +460,7 @@ static inline void bw_phase_gen_reset_state(
state->phase = phase_0; state->phase = phase_0;
*y_inc_0 = bw_one_pole_get_y_z1(&coeffs->portamento_state); *y_inc_0 = bw_one_pole_get_y_z1(&coeffs->portamento_state);
*y_inc_0 = bw_absf(*y_inc_0) < 6e-8f ? 0.f : *y_inc_0; // suppress troublesome tiny frequencies (< 0.06 Hz @ fs = 1 MHz, < 0.003 Hz at @ fs = 44.1 kHz)
*y_0 = phase_0; *y_0 = phase_0;
#ifdef BW_DEBUG_DEEP #ifdef BW_DEBUG_DEEP
@ -549,7 +550,7 @@ static inline void bw_phase_gen_update_coeffs_audio(
static inline float bw_phase_gen_update_phase( static inline float bw_phase_gen_update_phase(
bw_phase_gen_state * BW_RESTRICT state, bw_phase_gen_state * BW_RESTRICT state,
float * inc) { float * inc) {
*inc = bw_absf(*inc) < 1e-7f ? 0.f : *inc; // suppress troublesome tiny frequencies (sub nHz range usually) *inc = bw_absf(*inc) < 6e-8f ? 0.f : *inc; // suppress troublesome tiny frequencies (< 0.06 Hz @ fs = 1 MHz, < 0.003 Hz at @ fs = 44.1 kHz)
state->phase += *inc; state->phase += *inc;
state->phase -= bw_floorf(state->phase); state->phase -= bw_floorf(state->phase);
return state->phase; return state->phase;