Source code: | batres.cpp |
The batres program uses the radio batons to control the poles of a two-pole resonating filter.
Moving towards the center of the unit circle causes less filtering of the input sound. Moving towards the edge of the circle causes a specific pitch to be transmitted. Depending on how close you are to the unit circle with baton stick 1, the bandwith around this center pitch will change. Baton stick 1 controls one of the pole locations of the filter, and the other pole is a mirror image of that pole.
The difference equation for a two pole filter is:
y[n] = x[n] + a * x[n-1] + b x[n-2]where y[n] is the current output, x[n] is the current input, and x[n-1] is the previous input. a is a value equal to the radius of the pole position indicated by stick1. b is the value 2 * radius * cos(angle), where the angle is in radians.
Here is a flow diagram of a two-pole resonator filter: