Guest

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

Problem by first order LPF
September 17, 2014
3:15 am
derza
Member
Members
Forum Posts: 12
Member Since:
September 2, 2014
Offline

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)

The problem is, I didn't get the same response as in page 166. Here is the result from my implementation in linear and log:

Is there anything wrong with my calculation?

September 17, 2014
9:07 pm
derza
Member
Members
Forum Posts: 12
Member Since:
September 2, 2014
Offline

Also for the next filter which is Simple Resonator, I tried to get the response like in Figure 6.6 (book page 168), but instead of it, I got a low pass filter with steeper attenuation

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!

September 20, 2014
5:55 pm
W Pirkle
Forum Posts: 209
Member Since:
January 29, 2017
Offline

Hi Derza:

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,

Will

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
3 Guest(s)

1 Guest(s)

Top Posters:

Skyler: 48

Derek: 44

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

JimmyM: 29

EZB: 24

lppier: 23

Msaldaña: 18

Member Stats:

Guest Posters: 1

Members: 510

Moderators: 1

Forum Stats:

Groups: 11

Forums: 31

Topics: 526

Posts: 2037