Skip to content

Instantly share code, notes, and snippets.

@thbar
Created February 16, 2010 09:18
Show Gist options
  • Save thbar/305408 to your computer and use it in GitHub Desktop.
Save thbar/305408 to your computer and use it in GitHub Desktop.
def apply(input0:float[], output0:float[], sampleFrames:int)
output0[0] = @a1 * input0[0] + @a2 * @ih1_1 + @a3 * @ih1_2 - @b1*@oh1_1 - @b2*@oh1_2
output0[1] = @a1 * input0[1] + @a2 * input0[0] + @a3 * @ih1_1 - @b1*output0[0] - @b2*@oh1_1
sample = 2
while sample < sampleFrames
output0[sample] = @a1*input0[sample] + @a2*input0[sample-1] + @a3*input0[sample-2] - @b1*output0[sample-1] - @b2*output0[sample-2]
sample += 1
end
@ih1_1 = input0[sampleFrames-1]
@ih1_2 = input0[sampleFrames-2]
@oh1_1 = output0[sampleFrames-1]
@oh1_2 = output0[sampleFrames-2]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment