AUDIO SIEVING USING SIGNAL FILTERS

Similar documents
Brief Introduction to Signals & Systems. Phani Chavali

ECE 203 LAB 2 PRACTICAL FILTER DESIGN & IMPLEMENTATION

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 3

Analog Lowpass Filter Specifications

Filters. Phani Chavali

Signal Processing. Naureen Ghani. December 9, 2017

Digital Processing of

Subtractive Synthesis. Describing a Filter. Filters. CMPT 468: Subtractive Synthesis

Discretization of Continuous Controllers

Digital Processing of Continuous-Time Signals

ECE438 - Laboratory 7a: Digital Filter Design (Week 1) By Prof. Charles Bouman and Prof. Mireille Boutin Fall 2015

Review of Filter Types

PHYS225 Lecture 15. Electronic Circuits

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

ECE 2713 Design Project Solution

Chapter 15: Active Filters

Signal Processing of DC/DC converter inductor current measurement

UNIT-II MYcsvtu Notes agk

Performance Evaluation of Mean Square Error of Butterworth and Chebyshev1 Filter with Matlab

EE 422G - Signals and Systems Laboratory

EEO 401 Digital Signal Processing Prof. Mark Fowler

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

Comparative Study of RF/microwave IIR Filters by using the MATLAB

LECTURER NOTE SMJE3163 DSP

Active Filter Design Techniques

Designing Filters Using the NI LabVIEW Digital Filter Design Toolkit

FX Basics. Filtering STOMPBOX DESIGN WORKSHOP. Esteban Maestre. CCRMA - Stanford University August 2013

ECE 3793 Matlab Project 4

Biosignal filtering and artifact rejection. Biosignal processing I, S Autumn 2017

DIGITAL FILTERS. !! Finite Impulse Response (FIR) !! Infinite Impulse Response (IIR) !! Background. !! Matlab functions AGC DSP AGC DSP

ELEC3104: Digital Signal Processing Session 1, 2013

Electric Circuit Theory

3 Analog filters. 3.1 Analog filter characteristics

Infinite Impulse Response (IIR) Filter. Ikhwannul Kholis, ST., MT. Universitas 17 Agustus 1945 Jakarta

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

EE 470 Signals and Systems

APPENDIX A to VOLUME A1 TIMS FILTER RESPONSES

NOVEMBER 13, 1996 EE 4773/6773: LECTURE NO. 37 PAGE 1 of 5

Digital Signal Processing

EEM478-DSPHARDWARE. WEEK12:FIR & IIR Filter Design

Design and comparison of butterworth and chebyshev type-1 low pass filter using Matlab

Introduction (cont )

Bode plot, named after Hendrik Wade Bode, is usually a combination of a Bode magnitude plot and Bode phase plot:

Continuous-Time Analog Filters

Biosignal filtering and artifact rejection. Biosignal processing, S Autumn 2012

A PACKAGE FOR FILTER DESIGN BASED ON MATLAB

Lecture 3 Review of Signals and Systems: Part 2. EE4900/EE6720 Digital Communications

Signals and Filtering

DESIGN OF FIR AND IIR FILTERS

Digital Filters IIR (& Their Corresponding Analog Filters) 4 April 2017 ELEC 3004: Systems 1. Week Date Lecture Title

SMS045 - DSP Systems in Practice. Lab 1 - Filter Design and Evaluation in MATLAB Due date: Thursday Nov 13, 2003

ijdsp Workshop: Exercise 2012 DSP Exercise Objectives

PROBLEM SET 6. Note: This version is preliminary in that it does not yet have instructions for uploading the MATLAB problems.

Application Note 7. Digital Audio FIR Crossover. Highlights Importing Transducer Response Data FIR Window Functions FIR Approximation Methods

Pre-Lab. Introduction

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

Keywords FIR lowpass filter, transition bandwidth, sampling frequency, window length, filter order, and stopband attenuation.

4. K. W. Henderson, "Nomograph for Designing Elliptic-Function Filters," Proc. IRE, vol. 46, pp , 1958.

System on a Chip. Prof. Dr. Michael Kraft

Digital Filters FIR and IIR Systems

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

Analysis The IIR Filter Design Using Particle Swarm Optimization Method

Analog and Telecommunication Electronics

FIR Filter For Audio Practitioners

Analog Design-filters

Analog and Telecommunication Electronics

Signal processing preliminaries

Design of 5 th -Order Low-Pass Switched Capacitor Elliptic Filter Allen Waters, ECE 626

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

Instruction Manual for Concept Simulators. Signals and Systems. M. J. Roberts

Classic Filters. Figure 1 Butterworth Filter. Chebyshev

Design of IIR Digital Filters with Flat Passband and Equiripple Stopband Responses

Signals and Systems Lecture 6: Fourier Applications

Design of FIR Filter for Efficient Utilization of Speech Signal Akanksha. Raj 1 Arshiyanaz. Khateeb 2 Fakrunnisa.Balaganur 3

SCUBA-2. Low Pass Filtering

Design Digital Non-Recursive FIR Filter by Using Exponential Window

Developer Techniques Sessions

Signal Processing Summary

Design IIR Filter using MATLAB

Aparna Tiwari, Vandana Thakre, Karuna Markam Deptt. Of ECE,M.I.T.S. Gwalior, M.P, India

Discrete-Time Signal Processing (DTSP) v14

APPLIED SIGNAL PROCESSING

Design of infinite impulse response (IIR) bandpass filter structure using particle swarm optimization

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

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

Performance Analysis of FIR Filter Design Using Reconfigurable Mac Unit

A comparative study on main lobe and side lobe of frequency response curve for FIR Filter using Window Techniques

Electrical & Computer Engineering Technology

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

Decoding a Signal in Noise

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

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

A filter is appropriately described by the transfer function. It is a ratio between two polynomials

F I R Filter (Finite Impulse Response)

The University of Texas at Austin Dept. of Electrical and Computer Engineering Final Exam

A Lower Transition Width FIR Filter & its Noise Removal Performance on an ECG Signal

FYS3240 PC-based instrumentation and microcontrollers. Signal sampling. Spring 2017 Lecture #5

Experiment 2 Effects of Filtering

University of Southern Queensland Faculty of Health, Engineering & Sciences. Investigation of Digital Audio Manipulation Methods

George Mason University Signals and Systems I Spring 2016

Transcription:

AUDIO SIEVING USING SIGNAL FILTERS A project under V.6.2 Signals and System Engineering Yatharth Aggarwal Sagar Mayank Chauhan Rajan

Table of Contents Introduction... 2 Filters... 4 Butterworth Filter... 7 Chebyshev Filter (Type 1)... 9 Chebyshev Filter (Type 2)... 11 Filter performance... 13 Bibliography... 15 1 P age

Introduction Noise-cancellation feature in headphones measure the external ambient noise with a microphone, and generate a signal that matches the noise, but with the opposite amplitude. This anti-noise (filter) is added to the original music signal and effectively interfere destructively with the ambient noise. This addition of anti-noise might also depend upon certain mathematical function which is known as filtering process. The motivation for the project came from a question paper of University of Colorado of ECE department. With that lead we will: Design a bandstop filter with the following specifications: Passbands: 0 1400 Hz and 1,900 5,512.5Hz Stopband: 1,600-1,700Hz Tolerance in the passband: 0.5 db Maximum gain in the stopband: 100 db. And will implement the filter using each of the following design methods: Butterworth Chebyshev Type I Chebyshev Type II For a noisy signal(sound file) given here [1] The software tool used here is MATLAB provided by Mathworks[2]. The purpose of this assignment is to compare the above mentioned bandstop filters with the same cut-off frequencies, transition band, and ripple. 2 P age

The sound file consists of a song which we need and filter out rest of the other sounds which in this is heard at maximum decibels. The following graphs are that of noisy sound signal. Frequency Figure I: Graph (top) is x(t) versus time and bottom graph represents the fourier transform X(f) and f (frequency) The x(t) graph seems to periodic at some point indicating the sound is repetitive. The second graph left part (beginning from x-axis = 6000) should not be considered as it is made just for numerical values by the software. 3 P age

Filters In signal processing, a filter is a device or process that removes from a signal some unwanted component or feature[3]. Filtering is a class of signal processing, which involves the designing of filters in such a manner that they either do complete or partial suppression of some aspect of the signal. Filters can be classified in several different groups, depending on what criteria are used for classification. The two major types of digital filters are finite impulse response digital filters (FIR filters) and infinite impulse response digital filters (IIR). Some basic terminology: The frequency response can be classified into a number of different band forms describing which frequency bands the filter passes (the passband) and which it rejects (the stopband): o o o o o o o Low-pass filter: low frequencies are passed, high frequencies are attenuated. High-pass filter: high frequencies are passed, low frequencies are attenuated. Band-pass filter: only frequencies in a frequency band are passed. Band-stop filter: only frequencies in a frequency band are attenuated. Notch filter: rejects just one specific frequency - an extreme band-stop filter. Comb filter: has multiple regularly spaced narrow passbands giving the bandform the appearance of a comb. All-pass filter: all frequencies are passed, but the phase of the output is modified. Cut-off frequency is the frequency beyond which the filter will not pass signals. Roll-off is the rate at which attenuation increases beyond the cut-off frequency. Transition band, the (usually narrow) band of frequencies between a passband and stopband. Ripple is the variation of the filter's insertion loss in the passband. The order of a filter is the degree of the approximating polynomial and in passive filters corresponds to the number of elements required to build it. Increasing order increases roll-off and brings the filter closer to the ideal response, but also the longer the impulse response is and the longer the latency will be. Designing filters comes with many trade-offs; among the parameters to take into account are the cut-off frequencies, transition band, ripple, processing power available, and whether linear phase is necessary. In this case the filter should allow frequencies on the range of [0, 1400] and [1900, 5,512.5] Hz with a tolerance of 0.5dB. The stopband is a region from [1600, 1700] Hz with a maximum gain of -100dB. The filters are then applied to a song with noise in the stopband region; the filtered song can then be heard. Digital filter attenuation is usually expressed in terms of the logarithmic decibel scale (db). The attenuation measured in decibels can be found using the following expression: 4 P age

a = 20 log (H(f)) where H(f) is the transfer function of the filter. This transfer function tells how the filter behaves as it is defined as: H(f) = Y(f) X(f), where Y(f) is the output signal and X(f) is the input signal to the system in terms of their z- transforms when function is linear and discrete in time. The transfer function of all linear time-invariant filters generally share certain characteristics: For filters which are constructed of discrete components, their transfer function must be the ratio of two polynomials in f, i.e. a rational function of f. The order of the transfer function will be the highest power of f encountered in either the numerator or the denominator. The coefficients of the polynomials of the transfer function will be real or occur in complex conjugate pairs. where: H(z) = b z a z = H (1 q z ) (1 p z ) bi are the feedforward filter coefficients (non-recursive part) aj are the feedback filter coefficients (recursive part) H0 is a constant qi are the zeros of the transfer function pj are the poles of the transfer function. 5 P age

Let us now define the three filters mathematically The passband and stopband gains Gp, Gs and the corresponding attenuations in db are defined in terms of the ripple parameters εp, εs as follows: The magnitude responses of the analog Butterworth, Chebyshev, and elliptic filters are given as functions of the analog frequency Ω by: where CN(x) is the order-n Chebyshev polynomial, that is, CN(x)= cos(n cos 1 x), and cd(x, k) denotes the Jacobian elliptic function cd with modulus k and real quarter-period K 6 P age

Butterworth Filter Butterworth filters[4] are designed to be maximally flat; when compared to other filters, it has a slower roll off, but no ripple near the corner frequencies. In this case the order comes out to be 18. Figure 2 displays the magnitude. Note how there is no ripple in the magnitude transition, just a smooth decay. The pole-zero diagram in Figure 3 illustrates how the Butterworth had 9 zeros on the unit circle at 1650 Hz surrounded by a semicircle of nine poles. Each zero and pole is accompanied by its complex conjugate mirrored across the real (x) axis. With a relatively low order, the Butterworth design only needs 37 (=2n+1 calculations, where n is the order of the transfer function) add/multiply operations per input sample. Figure II: Butterworth magnitude versus frequency response 7 P age

Figure III: Butterworth pole-zero plot Figure IV: Butterworth impulse response with 100 data points 8 P age

Chebyshev Filter (Type 1) Chebyshev filters[5] are based on a concept called Chebyshev polynomials; put simply, these coefficients describe polynomials that are bounded to a one by one box centered at the origin and diverge elsewhere. Though these filters have a steeper roll off than Butterworth, they have ripple in the passband. The ripple is difficult to see in Figure 5, the magnitude as phase plot Note the difference between Figure 5 and Figure 2, the magnitude responses of the Chebyshev Type I and Butterworth filters, respectively. Though Chebyshev filters have a faster roll off, the rate of attenuation change seems similar here. The pole-zero diagram, Figure 6, is different than that of the Butterworth, but has the same idea: surround n zeros locally with n poles. The impulse response is shown in Figure 7 and is fairly similar in shape to the Butterworth. 25 add/multiply operations are required as order here goes 12. Figure V: Magnitude of Chebyshev- 1 response (Notice ripples near the passband segment) 9 P age

Figure VI: Chebyshev Type 1 pole-zero plot Figure VII: Chebyshev Type 1 impulse response with 100 sample points 10 P age

Chebyshev Filter (Type 2) The Chebyshev Type II filter[5] is very similar to the Type I. However, instead of ripple in the passband, it occurs in the stopband. Figure 8, the magnitude, shows how the Type II filter rolls off smoothly (with no ripple), then ripples between 1600 and 1700 Hz before smoothly returning to the passband. The pole-zero diagram in Figure 9 more closely resembles the Butterworth; the zeros are not in one location, but the poles surround the zeros in a semicircle fashion. The impulse response in Figure 10 takes a similar form to the previous two filters with different coefficient magnitudes. The order of this filter is the same as Chebyshev Type I, 12, and therefore requires 25 add/multiply operations. Figure VIII: Magnitude response of Chebyshev filter (notice the ripples in stop band) 11 P age

Figure IX: Chebyshev 2 plot for pole-zero Figure X: Chebyshev 2 impulse response for 100 data points 12 P age

Filter performance Filter Order Quality Butterworth 18 Sound quality ok, slight ringing in background Chebyshev Type I 12 Better than Butterworth, no background ringing Chebyshev Type II 12 Similar to Butterworth with background ringing The below given plots show the response from three given filter, through which the signal is made to pass. Although output data value v/s time are similar in all three cases, but there is a change in FFT v/s frequency plot. As plot between 1500 Hz 1800 Hz show some values in case of Chebyshev 2 filter. Frequency Figure XI: Butterworth output signal 13 P age

Frequency Figure XII: Output for Chebyshev Type 1 filter Frequency Figure XIII: Output for Chebyshev Type 2 filter 14 P age

Bibliography [1] index. [Online]. Available: http://ecee.colorado.edu/~fmeyer/class/ecen4632/. [2] MATLAB and Simulink for Technical Computing - MathWorks India. [Online]. Available: http://in.mathworks.com/index.html?s_tid=gn_loc_drop. [3] Filter (signal processing), Wikipedia, the free encyclopedia. 08-Oct-2015. [4] I. W. Selesnick and C. S. Burrus, Generalized digital Butterworth filter design, IEEE Trans. Signal Process., vol. 46, no. 6, pp. 1688 1694, Jun. 1998. [5] J. D. Rhodes and S. A. Alseyab, The generalized chebyshev low-pass prototype filter, Int. J. Circuit Theory Appl., vol. 8, no. 2, pp. 113 125, Apr. 1980. 15 P age

Appendix for Audio Sieving using Signal Filters Note: Setup, must be run before all else. It need only be run once per session. after that run any type function (like butter_function.m or chebyshev1_func.m or chebyshev2_func.m ), that filter you want to do. The filter should allow frequencies on the range of [0, 1400] and [1900, 5,512.5] Hz with a tolerance of 0.5dB. The stopband is a region from [1600, 1700] Hz with a maximum gain of -100dB. The noise signal is sound file named as noisy.wav is of duration 0.39 sec. Now we have: nyquist frequency Passband ranges Stopband ranges Ripples in passband Ripples in stopband Cutoff frequency Magnitudes (stopband) Now it s time to plot and sing the noise free song of the filter Butterworth or Chebyshev1 or Chebyshev2 and to so, run the plot_output_func.m Setup(setup.m) nyq = 11025 / 2; Wp = [1400 1900] / nyq; Ws = [1600 1700] / nyq; Rp =.5; Rs = 100; [noise, Fs] = audioread('noisy.wav'); sound(noise,fs) n=length(noise)-1; f=0:fs/n:fs; wavefft=abs(fft(noise)); plot(f,wavefft);

Butterworth Filter (butter_func.m) type = 'Butterworth'; [n, Wn] = buttord(wp, Ws, Rp, Rs); disp([type ' order: ' num2str(2*n)]); [z,p,k] = butter(n,wn,'stop'); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); Chebyshev Type I Filter(chebyshev1_func.m) type = 'Chebyshev Type I'; [n, Wn] = cheb1ord(wp, Ws, Rp, Rs); disp([type ' order: ' num2str(2*n)]); [z,p,k] = cheby1(n,rp,wn, 'stop'); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); Chebyshev Type II Filter(chebyshev2_func.m) type = 'Chebyshev Type II'; [n, Wn] = cheb2ord(wp, Ws, Rp, Rs); disp([type ' order: ' num2str(2*n)]); [z, p, k] = cheby2(n,rs,wn, 'stop'); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g);

Plotting of Filter and Output(plot_and_output.m) xtick = (cumsum(ones(1,51)) - 1) * 100 * 2 / 11025; h = fvtool(hd); set(gca, 'Fontsize', 14); set(gca, 'XTick', xtick); set(gca, 'XTickLabel', num2str(xtick' * 11025 / 2)); xlabel('frequency (Hz)', 'FontSize', 14); title(' Magnitude Response'); xlim([.2431.3556]); ylim([-110 10]); zplane(hd); set(gca, 'FontSize', 14); title([type ' Pole-Zero Plot'], 'FontSize', 16); set(get(gca, 'XLabel'), 'FontSize', 14); set(get(gca, 'YLabel'), 'FontSize', 14); figure; hold on; set(gca, 'FontSize', 14); title([type ' Impulse Response (size 100)'], 'FontSize', 16); xlabel('n', 'FontSize', 14); ylabel('h[n]', 'FontSize', 14); y = filter(hd,[1 zeros(1,99)]); stem(1:100, y); output = filter(hd, noise); output = output / max(output); sound(output, Fs);