Skip to content

Commit

Permalink
Merge pull request #635 from timothyschoen/patch-4
Browse files Browse the repository at this point in the history
Fix div-by-zero and potential blowing up in phaseshift~
  • Loading branch information
porres authored Nov 19, 2023
2 parents dd86037 + f061aad commit afd7828
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cyclone_objects/binaries/audio/phaseshift.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ static t_int *phaseshift_perform(t_int *w){
float omega, alphaQ, b0, a0, a1, yn, xn = *in1++, f = *in2++, q = *in3++;
if (q < 0) q = lastq;
lastq = q;
if (f < 0) f = 0;
if (f < 10) f = 10;
if (f > nyq) f = nyq;
q = fmax(q, 0.1f);
omega = f * PI/nyq;
alphaQ = sinf(omega) / (2*q);
b0 = alphaQ + 1;
Expand Down

0 comments on commit afd7828

Please sign in to comment.