Skip to content

Commit 5f7998e

Browse files
committed
synthio: improve rounding in biquad
this removes a marked DC offset and may cure the 'pops' problem.
1 parent 8a85deb commit 5f7998e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shared-module/synthio/Biquad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const
132132

133133
for (size_t n = n0; n; --n, in += n_channels, out += n_channels) {
134134
int32_t input = *in;
135-
int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1) >> BIQUAD_SHIFT;
135+
int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1 + (1 << (BIQUAD_SHIFT - 1))) >> BIQUAD_SHIFT;
136136

137137
x1 = x0;
138138
x0 = input;

0 commit comments

Comments
 (0)