XAudio2 filter radian frequency
-
22-06-2021 - |
Question
In the documentation for the XAudio2 filter parameters it mentions
Filter radian frequency calculated as (2 * sin(pi * (desired filter cutoff frequency) / sampleRate))
Can someone explain to me where that formula comes from? Because the only source of frequency conversion that would make sense to me would come from sin(f * t) and cosine(f * t) vs sin(2*pi*f * t) and cosine(2*pi*f * t) where f is a "frequency" and t is time.
Solution
(2 * sin(pi * (desired filter cutoff frequency) / sampleRate))
This value will go monotonically from 0 to 2.0 as the filter cut-off frequency goes from DC to half the sample rate.
Digital filters scale relative to the sample rate, and your other offered options don't.
OTHER TIPS
It's been a while since I've done filter math. It's kind of gnarly, but here's a basic interpretation: The part that's a little confusing is the Sin no? I'm a little confused by it too, but I bet it's to keep the output of the conversion in the desired range. Looks like Microsoft's filter can only take up 8000hz. Forgive me if this way off base, I can't visualize what a sine function would do to the results at the moment.
2 * sin(pi * (desired filter cutoff frequency) / WHOLE THING
PARTS
2 * sin //// The 2*pi*f part you're used to.
(pi *
(
desired filter cutoff frequency) //// This in hertz will become radian freqs
/ sampleRate //// Sets up the whole equation for 1 sample