Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
Problem by first order LPF
No permission to create posts
September 17, 2014
3:15 am
Avatar
derza
Member
Members
Forum Posts: 12
Member Since:
September 2, 2014
sp_UserOfflineSmall 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:
http://imagizer.imageshack.us/v2/xq90/538/LW0HwV.pngImage Enlargerhttp://imagizer.imageshack.us/v2/xq90/673/DlrEAN.pngImage Enlarger

Is there anything wrong with my calculation?

September 17, 2014
9:07 pm
Avatar
derza
Member
Members
Forum Posts: 12
Member Since:
September 2, 2014
sp_UserOfflineSmall 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
T29v5K.pngImage Enlarger

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
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall 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)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 476

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 482

Posts: 1876

Newest Members:

sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143