Hertz to alpha converter
  • WhenI was working on the FSK oscillator the other day, I wanted to use a low-pass filter on the switching waveform to reduce aliasing. I used the HZ to cutoff converter posted ages ago on the forum and discovered that it has an error in the formula to convert the cutoff frequency to an alpha value. The formula in the converter is 1-((2*pi*cutoff)/(Fs-(2*pi*cutoff))), but should be 1-((2*pi*cutoff)/(Fs+(2*pi*cutoff))). Here's a corrected converter and lowpass filter.
    Hertz to alpha.audulus
  • Whoa! Thanks! I was using the heck out of the old one you posted too. This is one that really should be in the default modile collection if you ask me. Using HighPass or LowPass without it is a little hit or miss otherwise.
  • I found the earlier formula in a post when I was was trying to figure out what the heck alpha meant. When the cutoff frequency is low the incorrect formula is pretty close. When I tried using it at around 10 kHz, I was getting alpha values over 1 which I knew couldn't be correct. Since I usually tune things by ear anyway I never noticed that the formula was wrong.
  • I'm not sure I can trust my algebra, what is the alpha to Hz expression?
  • If I did it right I get fc=(a*fs)/((1-a)*2*pi) where fc is the cutoff frequency, fs is the sample rate and a is alpha
  • I drank some coffee and did the equation twice, then I simplified the original equation
    "a=1-((2bc)/(d+2bc)) solve for c"
    a= aplha
    b= pi
    c= cut off
    d= sample rate
    and plugged it into wolfram alpha https://www.wolframalpha.com/input/?i=a=1-((2bc)%2F(d%2B2bc))+solve+for+c

    In the end, I'm pretty sure the correct expression is Fs*((1-a)/(2*pi*a) where Fs is sample rate and a is alpha.
  • You are correct. I based my answer on the formula in Wikipedia article on lowpass filters. I forgot that the alpha definition that Taylor is using is the inverse of the Wikipedia article. In the Wikipedia article 1 is no smoothing and 0 is full smoothing which is the reverse of the lowpass node. It drove me crazy when I was working out the Hz to alpha, I can't believe I forgot it already. If you substitute 1-a for a in my answer you get your correct one!
  • Well it makes sense for hi pass filters :P
  • From what I read alpha is sometimes defined one way and sometimes the other.