basic LPF – part 1 of 2

07/11/2012 § 1 Comment

LPF, as you may know, stands for Low Pass Filter, i.e., attenuating higher frequencies
and letting lower frequencies pass. Boosting Bass is an example of applying LPF

Lets design LPF by intuition. This is something very basic and easy to visualise

  • In z plane we know that freq 0 to fs/2 are mapped from 0 to pi
  • We also know that poles boost frequencies and zeros attenuate them
  • Lower freq are near (1,0) on z plane.
  • So lets attenuate higher freq. and place a zero on z =-1. Our channel response comes out to:
H(z) = 1 + z^-1
  • Generally sampling freq is 44100 Hz, so z = -1 corresponds to fs/2 i.e., highest present frequency.
  • Lets quickly test it on fiview. Fire up a terminal, navigate to fiview folder and type ./fiview -i x 1 1  we get this:
fiview analysis of lpf

basic lpf

  • Hmm.. that looks like a low pass filter.
  • Before we proceed scholastic matlab/octave test. Following are the commands to see how well-behaved is your (my?) filter (refer to docs if you are not sure how they work).
octave:1> [h,w]=freqz([1 1], [1], 512, 44100); 
octave:2> frwqz_plot(w,h)
  • As you may see it boosts lower freq by 6 dB. For now lets bring magnitude down to 0 dB. To do that, our filter will look like:
H(z) = .5 + (.5)*z^-1
  • You may perform test with fiview again, output will be the same.
  • There’s a point to note here: fiview might give you ‘quick peek’ into filter’s freq response, but it’s not detailed enough to see everything.

Lets do an audio test as well:

  • With reference to Z plane and testbed, edit your FIL ladspa plugin’s filters.h so that:
a0 = .5; a1 = .5; a2 = 0; b1 = 0; b2 = 0;
  • load the plugin (step 4 to 6 in testbed)
  • Fire up audacity, load a track, and apply your modified plugin (refer to testbed)

I am uploading my samples on sound cloud:
original: 
edited:

Not quite worth listening to, right ?

Lets analyze what screwed up.

  • Scholastic tests are not that bad… then what happened to my audio ? Lets analyze with Audacity’s spectrum viewer
        • Original spectrum:

        • And the spectrum of edited track:

  • So, LPF is working but looks like we have ‘aliasing’ issues.

Action plan:

  • Mixxx uses SoundTouch and SoundTouch has implemented Anti aliasing filter in an independent class.
  • Audacity has many effects built in… I’ll just hack the code and see how these ‘Masters of DSP’ manipulate maths.. till then hang on!

Meanwhile if you can’t find anything worth doing, try making a simple HPF, it’s just opposite of LPF. Never mind if it works only in theory not in audio… it’s just a matter of time before we master this. 🙂

Advertisements

§ One Response to basic LPF – part 1 of 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading basic LPF – part 1 of 2 at a tryst with DSP.

meta

%d bloggers like this: