Presentation is loading. Please wait.

Presentation is loading. Please wait.

0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick “FIR Filters” Texas Instruments University Programme Teaching.

Similar presentations


Presentation on theme: "0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick “FIR Filters” Texas Instruments University Programme Teaching."— Presentation transcript:

1 0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick “FIR Filters” Texas Instruments University Programme Teaching Materials

2 Chapter 6 - Slide 2 © 2010 Texas Instruments Inc Finite Impulse Response Filters

3 Chapter 6 - Slide 3 © 2010 Texas Instruments Inc Introduction Finite Impulse Response (FIR) filters are used for: –Low pass filters –High pass filters –Band pass filters –Band stop filters. They are widely used in Digital Signal Processing (DSP).

4 Chapter 6 - Slide 4 © 2010 Texas Instruments Inc Objectives To briefly look at a statistical data series on a graph To apply principle this to audio To introduce filter design software tools To run a range of FIR filters on the TMS320C5505 USB stick.

5 Chapter 6 - Slide 5 © 2010 Texas Instruments Inc Moving Averages

6 Chapter 6 - Slide 6 © 2010 Texas Instruments Inc Statistical Data Series Before we move on to audio, let us first look at a typical data series on a graph.

7 Chapter 6 - Slide 7 © 2010 Texas Instruments Inc A Typical Data Series Question: How do we identify the trend?

8 Chapter 6 - Slide 8 © 2010 Texas Instruments Inc Show Data Trend Answer: Calculate the moving average. Trend Line

9 Chapter 6 - Slide 9 © 2010 Texas Instruments Inc Mathematics of Moving Average The graph used the moving average of 4 samples. To calculate the moving average: –Add together 4 consecutive inputs –Divide the sum by 4:

10 Chapter 6 - Slide 10 © 2010 Texas Instruments Inc Moving Average for Audio A moving average can also be applied to audio.

11 Chapter 6 - Slide 11 © 2010 Texas Instruments Inc Frequency Response of Moving Average The moving average is a low pass digital filter

12 Chapter 6 - Slide 12 © 2010 Texas Instruments Inc Changing Some Constants This moving average can also be written as: As an experiment, change the sign of two constants: now negative

13 Chapter 6 - Slide 13 © 2010 Texas Instruments Inc Different Values of Constants The output has changed. Note the delay.

14 Chapter 6 - Slide 14 © 2010 Texas Instruments Inc New Frequency Response We now have a band pass filter.

15 Chapter 6 - Slide 15 © 2010 Texas Instruments Inc Summary of Moving Average A moving average is a digital filter There is a delay between the input and the output Change constants to change the frequency response.

16 Chapter 6 - Slide 16 © 2010 Texas Instruments Inc Finite Impulse Response Filters

17 Chapter 6 - Slide 17 © 2010 Texas Instruments Inc The FIR Filter The general formula for a FIR filter is: The moving average is a FIR filter with:

18 Chapter 6 - Slide 18 © 2010 Texas Instruments Inc Block Diagram of FIR Filter

19 Chapter 6 - Slide 19 © 2010 Texas Instruments Inc FIR Coefficients The terms h(0) to h(N) are called the coefficients. They can be calculated from the Fourier series Typically for a C program they would be stored in a.h file.

20 Chapter 6 - Slide 20 © 2010 Texas Instruments Inc Impulse Applied to FIR An impulse is commonly used to test filters.

21 Chapter 6 - Slide 21 © 2010 Texas Instruments Inc Why is the Filter Finite? The output is derived purely from the input. The output is completely gone after N samples, where N is the FIR filter size. Here N = 50. Impulse In FIR Filter Out

22 Chapter 6 - Slide 22 © 2010 Texas Instruments Inc Implementing FIR Filters

23 Chapter 6 - Slide 23 © 2010 Texas Instruments Inc Ideal vs. Practical FIR Filter Ideal FIR filter => infinite coefficients. Practical filter design is a compromise. FIR Filter 10 coefficients Practical FIR Filter 10 coefficients Ideal Filter

24 Chapter 6 - Slide 24 © 2010 Texas Instruments Inc Using Window Functions A window function modifies coefficients to approximate an infinite series.

25 Chapter 6 - Slide 25 © 2010 Texas Instruments Inc Window Types Some commonly used window functions are: –Rectangular (simple truncation of infinite series) –Hamming –Hanning (or von Hann) –Blackman –Kaiser.

26 Chapter 6 - Slide 26 © 2010 Texas Instruments Inc Rectangular vs. Hamming Window FIR Filter 5000Hz 50 coefficients Rectangular Window FIR Filter 5000Hz 50 coefficients Hamming Window -50dB Better

27 Chapter 6 - Slide 27 © 2010 Texas Instruments Inc Filter Design using Matlab

28 Chapter 6 - Slide 28 © 2010 Texas Instruments Inc Filter Design Toolbox

29 Chapter 6 - Slide 29 © 2010 Texas Instruments Inc Generation of Coefficients Matlab can export filter coefficients as a.h file.

30 Chapter 6 - Slide 30 © 2010 Texas Instruments Inc Web Based Filter Design Software

31 Chapter 6 - Slide 31 © 2010 Texas Instruments Inc Free Online Software A free online filter design package is available at: www.dsptutor.freeuk.com

32 Chapter 6 - Slide 32 © 2010 Texas Instruments Inc Free Software Output Supports low pass, band pass and high pass filters.

33 Chapter 6 - Slide 33 © 2010 Texas Instruments Inc Filter Output Coefficients Filter coefficients are in floating-point format.

34 Chapter 6 - Slide 34 © 2010 Texas Instruments Inc Converting to Fixed-Point Coefficients lie in the range -1.000 to +1.000 To convert them to fixed-point, multiply each by 32767 then round to nearest integer.

35 Chapter 6 - Slide 35 © 2010 Texas Instruments Inc C Code Implementation of FIR A simple FIR implementation in C:

36 Chapter 6 - Slide 36 © 2010 Texas Instruments Inc Introduction to Laboratory

37 Chapter 6 - Slide 37 © 2010 Texas Instruments Inc Setup for TMS320C5505 USB to PC Headphones CD Player USB Stick

38 Chapter 6 - Slide 38 © 2010 Texas Instruments Inc Installing the Application Use the code given in Application 6 FIR Filters. Follow the steps previously given in Chapter 1 to set up the new project.

39 Chapter 6 - Slide 39 © 2010 Texas Instruments Inc Create New CCS Project

40 Chapter 6 - Slide 40 © 2010 Texas Instruments Inc Files Used in Project

41 Chapter 6 - Slide 41 © 2010 Texas Instruments Inc Filter Coefficients Filter coefficients are contained in the four #include files starting at “hamming.h”:

42 Chapter 6 - Slide 42 © 2010 Texas Instruments Inc About the Program Contains a series of FIR filters. Divides music into bass and treble at different crossover frequencies: –Low pass filter puts bass on left-hand headphone. –High pass filter puts treble on right-hand headphone.

43 Chapter 6 - Slide 43 © 2010 Texas Instruments Inc Experiments

44 Chapter 6 - Slide 44 © 2010 Texas Instruments Inc Sampling Rates Run the same filters but at a lower sampling rate, for example 12000 Hz. How does this affect the frequencies of the filters?

45 Chapter 6 - Slide 45 © 2010 Texas Instruments Inc Using New Filter Coefficients You can design your own filter coefficients using Matlab FDATool or the Web-based tool discussed earlier. New coefficients can be added to a new.h file. You will need to #include this.h file in your project.

46 Chapter 6 - Slide 46 © 2010 Texas Instruments Inc Bass Middle and Treble Design a series of filters so you can work out at what frequency the transition occurs between: –bass and mid range –mid range and treble. Clue: the frequencies are lower than you might first think.

47 Chapter 6 - Slide 47 © 2010 Texas Instruments Inc Questions The filters are called Finite Impulse Response filters. Why is the word “finite” used? What is a “window” function as applied to a digital filter? How can a window function be used to improve the performance of the filter? How are filter coefficients calculated?

48 Chapter 6 - Slide 48 © 2010 Texas Instruments Inc References Digital Signal Processing, A Practical Approach by Emmanuel C. Ifeachor and Barrie W. Jervis. ISBN 0201-59619-9. Digital Signal Processing with C and the TMS320C30 by Rulph Chassaing. ISBN 0-471-557800-3.


Download ppt "0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick “FIR Filters” Texas Instruments University Programme Teaching."

Similar presentations


Ads by Google