September 2, 2014
I implemented the single pole filter for first-order LPF (book chapter 6, page 164).
The difference equation is as follows:
y(n) = a0*x(n) - b1*y(n-1)
I tried to get the same frequency response as in page 166, so I used 1kHz as fc and 8000 as fs (Input Sample Rate in my Setup Audio Devices) and used the LPF equation from page 165.
At the end I got this equation:
y(n) = 0.013614*x(n) - (-0.986386)*y(n-1)
Is there anything wrong with my calculation?
September 2, 2014
Here is my difference equation:
yn = xn*0.00314 - yn_1* (-1.92132) - yn_2* (0.92446525)
is there anything wrong with my calculation?
And.. one more thing. I also found something odd in page 176 equation 6.20 about how to calculate the pre-warped analog cutoff, it says that the analog frequency result = 0.07136, but it supposes to be the result inside the "tan", the complete result must be tan(0.07136) = 0.00124. Is it typo? Thank you for your help!
January 29, 2017
For your filter questions: first, the "Input Sample Rate" setting is for the audio input, meaning line/microphone input. RackAFX can process audio through your line-in as well as via a .wav file. So setting the input rate to 8kHz doesn't do anything. The second way that you can get audio into your plug-in is via a .wav file. In this case, the sample rate is set to the .wav file's rate (and delivered to your plugin during the prepareForPlay() function call).
However, when you use the Analyzer to take the frequency, impulse, step or phase response, the sample rate is fixed at 44.1kHz. So you need to use that as the fs if you are going to be using the analyzer to make comparisons with calculations. If you look at the analyzer graphs you will see Nyquist at 22kHz, not 4kHz as it would be with fs = 8kHz. If you open the analyzer controls, you will see at the right that you can't change the sample rate (you can when using the FIR Designer module).
However, if you used a .wav file with fs = 8kHz as input, your filter should work properly and sound correct.
Another tool that you can use to check your calculations at fs = 8kHz is the set of built-in Modules. The ones named "Multifilter" and "HP/LP Filter" implement many of the basic filtering algorithms in the book. There is a Block Diagram button (or View->Block Diagram) that will show you the calculated coefficients for a given filter. The coefficients are calculated using the sample rate of the .WAV file you have loaded. As you move the controls around, you can watch how the coefficients change. It shows that for most IIR filters, changing one control changes all (or nearly all) of the coefficients. So, you can load a 8kHz wav file and use the HP/LP module to check your calculations. NOTE: If you change the wav file to a new fs with these modules loaded, you must first move a control around to see the coeffs update.
As for your question about Eq. 6.20, there is no typo. The analog frequency is 0.07136 and it follows Eq . 6.14 exactly.
- All the best,
Most Users Ever Online: 36
Currently Browsing this Page:
Guest Posters: 1
Newest Members:CoraDias, Edoardo, knooierd, daniel, Merril Bradshaw, BillPlunkett, Pajczur, michaelwayneharwood, RickM
Moderators: W Pirkle: 187
Administrators: Tom: 66, JD Young: 80, Will Pirkle: 0, W Pirkle: 187