SGN Bachelor s Laboratory Course in Signal Processing Audio frequency band division filter ( ) Name: Student number:

Similar documents
ASC-50. OPERATION MANUAL September 2001

Laboratory Assignment 1 Sampling Phenomena

Exploring DSP Performance

ELEC3104: Digital Signal Processing Session 1, 2013

EE 422G - Signals and Systems Laboratory

Sampling and Reconstruction

Pre-Lab. Introduction

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Build Your Own Bose WaveRadio Bass Preamp Active Filter Design

ECE 203 LAB 2 PRACTICAL FILTER DESIGN & IMPLEMENTATION

SP.718 Special Topics at Edgerton Center: D-Lab Health: Medical Technologies for the Developing World

THE NEXT GENERATION AIRBORNE DATA ACQUISITION SYSTEMS. PART 1 - ANTI-ALIASING FILTERS: CHOICES AND SOME LESSONS LEARNED

Using the CODEC ReadMeFirst

MATLAB for Audio Signal Processing. P. Professorson UT Arlington Night School

Lab #1 Lab Introduction

Experiment 1.A. Working with Lab Equipment. ECEN 2270 Electronics Design Laboratory 1

Filters. Phani Chavali

Digital Filters IIR (& Their Corresponding Analog Filters) Week Date Lecture Title

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Signal Processing Toolbox

Stratix II Filtering Lab

EE 3302 LAB 1 EQIUPMENT ORIENTATION

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Experiment No. 6. Audio Tone Control Amplifier

Laboratory Experiment #1 Introduction to Spectral Analysis

Introduction to basic laboratory instruments

Sapphire Instruments Co., Ltd. Calibration Procedure of SI-9101

LLS - Introduction to Equipment

ELEC3104: Digital Signal Processing Session 1, 2013

Brief Introduction to Signals & Systems. Phani Chavali

Lab 2: Linear and Nonlinear Circuit Elements and Networks

Massachusetts Institute of Technology Department of Electrical Engineering & Computer Science 6.341: Discrete-Time Signal Processing Fall 2005

ECE 4213/5213 Homework 10

UNIT-II MYcsvtu Notes agk

Lab 0: Introduction to TIMS AND MATLAB

The oscilloscope and RC filters

Precalculations Individual Portion Introductory Lab: Basic Operation of Common Laboratory Instruments

Introduction to basic laboratory instruments

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

Experiment # 4. Frequency Modulation

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

3-Way Active Crossover Model XOVER-3. Xkitz.com. User s Manual. Features. Rev 2.1

Cyclone II Filtering Lab

ECE 2274 Lab 1 (Intro)

Discrete-Time Signal Processing (DTSP) v14

Electrical & Computer Engineering Technology

Lab 6 - MCU CODEC IIR Filter ReadMeFirst

EE 462G Laboratory #1 Measuring Capacitance

Frequency Selective Circuits

The University of Queensland School of Information Technology and Electrical Engineering. ELEC3004/7312: Signals, Systems and Controls

Electrical Engineer. Lab2. Dr. Lars Hansen

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

Design Implementation Description for the Digital Frequency Oscillator

Appendix B. Design Implementation Description For The Digital Frequency Demodulator

Octave Functions for Filters. Young Won Lim 2/19/18

Class #7: Experiment L & C Circuits: Filters and Energy Revisited

STANFORD UNIVERSITY. DEPARTMENT of ELECTRICAL ENGINEERING. EE 102B Spring 2013 Lab #05: Generating DTMF Signals

Operational Amplifiers

UNIVERSITY OF NORTH CAROLINA AT CHARLOTTE Department of Electrical and Computer Engineering

Lab 4: Using the CODEC

BME 3512 Bioelectronics Laboratory Two - Passive Filters

Worksheet for the afternoon course Tune measurements simulated with a DSP card

EECS 216 Winter 2008 Lab 2: FM Detector Part II: In-Lab & Post-Lab Assignment

Experiment Five: The Noisy Channel Model

Rowan University Freshman Clinic I Lab Project 2 The Operational Amplifier (Op Amp)

UCE-DSO210 DIGITAL OSCILLOSCOPE USER MANUAL. FATIH GENÇ UCORE ELECTRONICS REV1

PHYSICS 107 LAB #9: AMPLIFIERS

Study of Analog Phase-Locked Loop (APLL)

HARDWARE IMPLEMENTATION OF LOCK-IN AMPLIFIER FOR NOISY SIGNALS

Experiment 6: Multirate Signal Processing

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Page 1/10 Digilent Analog Discovery (DAD) Tutorial 6-Aug-15. Figure 2: DAD pin configuration

IIR Filter Design Chapter Intended Learning Outcomes: (i) Ability to design analog Butterworth filters

Laboratory Exercise #1

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

Operational Amplifiers 2 Active Filters ReadMeFirst

Experiment 1: Instrument Familiarization (8/28/06)

Digital Filters FIR and IIR Systems

Stratix Filtering Reference Design

2 Oscilloscope Familiarization

Developer Techniques Sessions

Moku:Lab. Specifications INSTRUMENTS. Moku:Lab, rev

ECE 4670 Spring 2014 Lab 1 Linear System Characteristics

Experiment 2 Effects of Filtering

When you have completed this exercise, you will be able to relate the gain and bandwidth of an op amp

Experiment 1: Instrument Familiarization

ME 461 Laboratory #3 Analog-to-Digital Conversion

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Laboratory 3 (drawn from lab text by Alciatore)

2-Way Active Crossover Model XOVER-2. Xkitz.com. User s Manual. Features. Rev 5.0

Additive Synthesis OBJECTIVES BACKGROUND

Experiment I: An Introduction to the Arduino Due + Sampling and Reconstruction

Islamic University of Gaza. Faculty of Engineering Electrical Engineering Department Spring-2011

LLRF4 Evaluation Board

Introduction to Basic Laboratory Instruments

Fill in the following worksheet-style pages. A colored pen or pencil works best. The procedure is:

Group: Names: (1) In this step you will examine the effects of AC coupling of an oscilloscope.

Transcription:

TAMPERE UNIVERSITY OF TECHNOLOGY Department of Signal Processing SGN-16006 Bachelor s Laboratory Course in Signal Processing Audio frequency band division filter (2013-2014) Group number: Date: Name: Student number: email: The idea of this laboratory work is to give a practical example of the applications of signal processing. Please, read these instructions through before doing anything else! The task is to implement the band division filtering for the lowest frequency loudspeaker (a.k.a. subwoofer). First we will make some concepts clear concerning the filter to be implemented. After that we implement the actual filter using both analog and digital signal processing and compare the characteristics of both approaches. Finally we get to listen to our results with the real appliances. All the information required for completing the work can be found for example in the books: Ifeachor & Jervis: "Digital Signal Processing, A practical approach" M. E. Van Valkenburg: "Analog Filter Design" (or some other corresponding) The work is to be done in pairs. The reservation list for the laboratory is on top of the shelf next to the door of room TC305. The work place is in laboratory TF304. For the work the lab has a PC, signal generator (Agilent 33220A), oscilloscope (Agilent DSO3102A) and an adjustable analog filter. The computer has a sound card which contains the A/D and D/A converters needed in digital signal processing. It is assumed that you know how to use the signal generator and oscilloscope. Manuals for both can be found in the lab. Both should also be familiar from previous courses. Digital filtering is done using Matlab. If you are interested in learning more about audio signal processing you may find a folder with some articles on the subject next to the work place (not part of the course, though). 1

To get this work accepted you must answer the questions in this instruction and return it at latest 11.5.2014 to Hanna Silen (room TF317) or to the locker next to the room TC305. You can ask further information by coming to TF317 or by email: hanna.silen@tut.fi. 2

1. BASICS OF SIGNAL PROCESSING You don t need to write a separate report in this work so the questions in this instruction need to be answered properly. 1.1 Responses 1. Below is the amplitude response of a filter. Draw and name in the figure the following: pass-band, stop-band, and transition band What type of a filter is this? What are the 3dB cutoff frequencies of the filter? How did you specify the above values? Draw in the figure: 1.2 Suodattimen Amplitudivaste 1 0.8 0.6 0.4 0.2 0 0 2000 4000 6000 8000 10000 12000 Hz 2. What is meant by the Q factor of a filter in case of a) band-pass filter b) low- or high-pass filter? 3. When the output of a filter at frequency Fs is attenuated by 3dB with respect to the input, what is the ratio of the output and input amplitudes. 3

1.2 Concepts Below are some concepts related to filtering. Mark in the boxes whether the concept is originally a term of digital (1) or analog (2) signal processing. Explain on the lines shortly where the term refers to (comprehensive explanation not required). 1.3 Analog filter In the figure below there is a simple analog filter. In the laboratory you can find a folder with some material to help you answer the following questions. What is the transfer function of this filter? 4

What are the poles of the filter? Is the filter stable and why/why not? What is the Q factor of the filter? What is the type of the filter (Butterworth, Bessel )? What is the cutoff frequency of the filter [Hz] (3dB)? Is it a low-, high-, band-pass, or band-stop filter? Draw the frequency response of the filter between 1 1000 Hz using Matlab function freqs. (Write below the Matlab code and parameters you used.) 5

2. ANALOG FILTERING Make sure that the volume of the amplifier is set to zero before switching it on. The work place has a signal generator, oscilloscope and an analog filter with its power source. The filter and power source are enclosed in a plastic box under a transparent lid. The filter has no power switch so the power cord plug works as one. The analog filter used in this exercise Note that the analog filter consists of operational amplifiers, resistors and capacitors. The circuit diagram of the filter is in the figure below. The filter we use here is a band-pass filter whose cutoff frequencies can be adjusted with the potentiometer VR2. Potentiometer VR3 is used to adjust the Q factor of the filter. Potentiometer VR1 can be used to control the resistance of the whole filter. A suitable value could be for example 1 in the pass-band. Note: do not set VR3 to a value less than 4 because it can break the filter! In this filter the cutoff frequency is adjustable between about 40-145Hz. 6

Circuit diagram of the filter Your task is now to adjust the filter so that it can be used as a band division filter for a subwoofer. For the subwoofer we have the following Target Function : 1.2 tavoitevaste 1 0.8 0.6 0.4 0.2 50 100 150 200 Hz Target frequency response for the filter of a subwoofer The objective is thus to have the -3dB points at frequencies of about 25Hz and 80Hz. 2.1 Signal generator The signal generator in the lab can be connected with a PC via a USB bus. In the lab PC you can find Agilent Intuilink Waveform Editor program for creating the signals. Start this program and open a connection to the oscilloscope from Communications/Connection Create a test signal with Matlab. Generate a signal (sampling frequency 65536 Hz and length 65536 samples) which you think can be used to study the frequency response of the band division filter. As an example this could be a signal with sine components of several different frequencies (say, 50Hz and for both -3dB frequencies). Scale the signal values to a range [-1, 1] and save the signal you designed to a text file (for example command dlmwrite in Matlab) as a column vector. Also send the signal to the assistant by email. Now load the signal you just saved into Waveform Editor. (Note: Matlab uses dot (. ) as the decimal separator while Waveform Editor uses the system decimal separator, which can be comma (, ). In case there is an error about wrong file format while loading, you can try to change the dots to commas for example by using the function dots2commas in 7

the folder C:\siglab.) Make sure you see 65536 points on the screen (if not, change the signal length from File/Properties). Send the signal to the signal generator (Send arbitrary waveform). Use frequency 1Hz and peak-to-peak amplitude 0.5V. (Note: too large amplitudes can break the filter) Using the signal generator and oscilloscope, find the settings of the potentiometers with which the filter satisfies the objective as accurately as possible. Note that the target response cannot always be obtained precisely. However, with this filter the response given in the previous page (note: linear scale) should be possible. The output from the signal generator is branched into two so you can see on the oscilloscope both the input and output of the filter. In particular, it is useful to look at the FFT of the signals fed to the oscilloscope. The needed wires can be found at the lab (BNC-BNC, RCA-BNC, RCA-RCA). BEFORE YOU CONNECT THE SIGNAL TO THE FILTER: make sure there is no DC component ( DC offset ) in the signal generator output. 8

2.2 Write down the final settings: Input level: Maximum output level of the filter: -3dB points and the corresponding voltage levels: The oscilloscope is connected to the PC in the lab. You can save an image from the oscilloscope screen to the PC using Scope Connect Software (icon DSO3000 on Desktop). When the program has started wait for the oscilloscope to be detected (states connected in the lower right corner). Due to operating system update the connection between the oscilloscope and PC does not work so take pictures of the oscilloscope screen with your phone or the camera near the workstation. Save for example images that show both the input and output signals of the filter. Save also at least one image of a FFT. Attach the images to the work report. 2.3 Settings of the potentiometers: 2.4 Testing When you have adjusted the filter correctly, switch off the signal generator and disconnect the wires from the IN and OUT connectors of the filter. Now use cable (2xRCA stereo plug) to connect the sound card of the PC to the IN connector of the filter with the one RCA-connector and to the amplifier s right AUX-channel with the other RCA-connector. Also connect the output of the filter to the amplifier s left AUX-connector using an RCA- RCA wire. Choose AUX-input from the amplifier and switch on the amplifier. Now you can play some music files from the directory C:\siglab and listen if all of this work was of use at all. The right channel of the amplifier is connected to a small loudspeaker that plays the higher frequencies. The files in folder C:\siglab are mono-files so the signal is the same in both 9

channels and the sound from both our subwoofer and small loudspeaker should fit together in case you adjusted the filter correctly. The smaller loudspeaker playing back the higher frequencies is much more sensitive than the subwoofer so you need to control the subwoofer sound level higher. You can do this with the two-piece volume controller (R=small loudspeaker, L=subwoofer). Please use consideration when controlling the volume as there may be other people in the lab and on the 3rd floor! Was it worth all the trouble? WHEN YOU FINISH, SWITCH OFF THE FILTER (=UNPLUG THE FILTER POWER CORD)! 2.4 EXTRA for those interested in filters If you are not sure about the consequences, don t do this experiment. If you do this test, do it according to the instructions. Active filters have a nasty property, namely resonance. This means that a badly designed or implemented filter may start oscillating at some frequency. In such a case the filter produces an output signal even though the input were zero. These phenomena appear both in analog and digital filters. If you want to try this, MAKE SURE THE SIGNAL CANNOT GET TO THE AMPLIFIER AND LOUDSPEAKERS. So switch off the amplifier! Disconnect the wire from the input of the filter. Now you can see the oscillation on the oscilloscope as you increase the Q factor (=in the scale of VR3 this means smaller values of VR3) and keep an eye on the output with the oscilloscope. Somewhere below value 4 of VR3 the output starts to resonate. Do not let the filter resonating for a long time and always leave VR3 to a value >4! Did you try this? Did you notice the resonance? What was the frequency of resonation? What are the disadvantages of this phenomenon? 10

3. DIGITAL FILTERING Note! This instruction is modified from time to time so the work reports done at different days are not similar. Next we design a digital filter for the subwoofer using Matlab, filter a music sample and listen to the result. 3.1 Filters Digital linear filters can be divided into two groups: FIR (finite impulse response) and IIR (infinite inpulse response) filters. In this work we filter an audio signal using both types of filters. Is the filter in Figure 3.1 a FIR or IIR filter? What is the order of the filter? Figure 3.1. How do the structures of FIR and IIR filters differ from each other? (confer to the above figure) 11

3.2 FIR filter Digital FIR filter can be implemented for example in the form presented in the figure on the previous page. If you want, you can test in Matlab with, e.g., FIR1, FIR2, FIRLS, etc... (>> help signal ) First we must decide the target values of a filter: 1) type of the filter, 2) pass-band cutoff frequency, 3) stop-band cutoff frequency, 4) ripple in pass-band, and 5) stop-band minimum attenuation. For playing back low frequencies it is of course natural to design a low-pass filter. The pass-band cutoff frequency should be 100Hz and stop-band cutoff frequency 200 Hz. The ripple at pass-band can in this case be 1 db. Minimum attenuation at stop-band is more of a matter of opinion but let us use here value 50dB. What is in this case the ratio of amplitude in stop-band to that in pass-band? 3.2.1 Implementation Here >> describes the prompt of Matlab. Start Matlab on the PC and change the directory to C:\siglab: >>cd c:\siglab; clear all This takes you to the right directory and clears the possible previous settings and variables. We will use 44.1 khz as our sampling frequency (the music samples are sampled at the frequency of 44.1 khz): >>Fs=44100; What is in this case the Nyquist frequency? We design a FIR filter using the Remez algorithm. The required order of the filter can be estimated with function firpmord. >>help firpm >>help firpmord 12

Calculate using function firpmord the order of the filter. What are the different parameters you need to give to the function (and how exactly do you give them)? What is the required order according to firpmord? Now calculate the filter coefficients using function firpm. Draw now the amplitude response of the filter. Does the filter satisfy the set objectives? What can you do if the objectives were not met? Try to design the filter such that the given requirements are satisfied. What is in that case the order of the filter? Print the amplitude, phase, and impulse responses of the filter. Print also the zero-pole plot. Attach these figures to the work report. What do you think about the filter? (is its implementation realistic etc.) Remember to save the coefficients for later use!!! (>>help save ) 13

3.2.2 A realistic implementation: The order of the filter becomes too high for the implementation to be realistic. In this case it is best to use so called multi-rate signal processing because we want to separate a narrow sub-band from the frequency band of 22050 Hz (100/22050=0.0045, i.e. 0,45 % of the band). We will drop the sampling frequency so the ratio of the pass-band to the Nyquist frequency is more desirable and hence we can use a filter with smaller order. At the same time the transition band becomes wider which also further helps the filtering. What does decimation mean? We now design a new filter for a signal decimated by a factor of 8. The original sampling frequency (Fs) was 44100 Hz. What is the sampling frequency of the decimated signal? What is the new Nyquist frequency? Estimate using function firpmord the order of the new filter. What are the different parameters you need to give to firpmord? 14

What is the required order according to firpmord? Calculate the filter coefficients using firpm. Plot the amplitude response of the resulting filter. Does it satisfy the requirements? With what order does the filter meet the requirements? Print the amplitude, phase, and impulse responses of the filter. Print also the zero-pole plot. Attach these figures to the work report. Remember to save the filter coefficients for latter use!!! 3.3 IIR filter Design now an elliptic IIR filter with 1) the original sampling frequency, and 2) decimated frequency. (help ellipord and help ellip) (Use the same requirements as for the FIR filter). Print the amplitude, phase, and impulse responses in both cases. Print also the zero-pole plots. What can you say about the order of the filters? Draw also the block diagram of the filter. Remember to save the filter coefficients for later use!!! 15

3.4 Filtering We now load a music sample, decimate, filter, and interpolate. The folder C:\siglab contains wav-files (mono, Fs = 44100 Hz). Read a part (for example 30 seconds) of one of these files to Matlab using function wavread (>> help wavread ). Write down the Matlab-commands you used. Check that you have the signal in Matlab in variable Y (or whatever you named it). >> whos Decimate the signal Y by a factor of 8. ( >>help decimate or resample ). How did you do it? >> help If everything is ok, then filter the signal going to the subwoofer (>> help filter ): Filter the decimated signal both with FIR and IIR filters. (write below the needed Matlab commands). Calculate also how many floating-point operations were required in the filtering (FIR and IIR separately): Check the frequencies in the signals with FFT. (>>help fft ) (write below the Matlab commands). Print the figures and attach to the work report. 16

Next the filtered signal needs to be restored to the original sampling frequency, i.e. interpolated (>> help interp tai>> help resample ). (write below the Matlab command/commands) 3.5 FINALLY...playback time. Connect the sound card output to the AUX-connectors of the amplifier. (wire num.3 2xRCA stereo plug). Connect the red RCA-connector to the left channel of the amplifier and the black RCA-connector to the right channel. Check also that the loudspeakers are connected to the amplifier (subwoofer to the left channel and the normal loudspeaker to the right channel). Combine the filtered and original signals to a new variable >> Y2=[Y1 Y] Now the filtered signal is in the left channel and the original in the right channel. You can listen to the signals using Matlab function soundsc (>> help soundsc ). (write below the Matlab command). Was the filtering result useful? Did you notice any differences between the FIR and IIR implementations? 17

4 COMPARISON You have now applied analog and digital signal processing. Compare the pros and cons of analog and digital filtering (and hardware): (performance, versatility, price, applications...) analog: digital: How much do you estimate making the analog filter used would cost (parts + work)? How about the corresponding digital filter (parts + work)? (estimates of single filters, no need to think about effects of mass-production) 5 GRADING THE LABORATORY WORK Do you feel you learnt something from this work? If so, what? Your grade for this laboratory work (0-5): Comments & suggestions: 18

6 LEAVING THE LAB When you finish working with Matlab, please remove all the files you have saved. When you exit the lab, leave the PC on. Unplug the power cord of the analog filter and switch off the other devices using their power switches. 19