15
 Assignment 03-04 July 24 2014 Audio Equalizer Short Report SIDRA FAHIM Fa-2012-MSEE-056

Audio Equalizer Report.pdf

Embed Size (px)

Citation preview

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 1/15

Assignment 03-04 July 24

2014 Audio Equalizer ShortReport

SIDRA FAHIM

Fa-2012-MSEE-056

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 2/15

Sidra FahimFa2012 MSEE 056

Table of Contents

Problem Statement.......................................................................................................... 3 Deliverables .................................................................................................................... 4

Requirements .................................................................................................................. 4

1. AUDIO EQUALIZATION .......................................................................................... 5

1. Graphic Equalizers ............................................................................................. 5

2. Parametric Equalizer .......................................................................................... 6

2. SOFTWARE DESIGN METHODOLOGY ................................................................. 7

1. Graphic Interface of Audio Equalizer .................................................................. 7 1. Push buttons ................................................................................................... 7

2. Panel ............................................................................................................... 7

3. Sliders ............................................................................................................. 8

4. Static Text ....................................................................................................... 8

5. Edit Texts ........................................................................................................ 8

6. Tools ............................................................................................................... 8

2. Run GUI interface .............................................................................................. 9 3. M-file editing ....................................................................................................... 9

1. Browsing function ............................................................................................ 9

2. Processing Function ..................................................................................... 10

3. Scrolling sliders and Updating Gains ............................................................ 11

4. Update Filters ............................................................................................... 12

5. Play Sound ................................................................................................... 14

6. Reset Gains .................................................................................................. 14 3. Bibliography ........................................................................................................... 15

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 3/15

Sidra FahimFa2012 MSEE 056

Table of Figures

Figure 1 Graphic Equalizer .............................................................................................. 5

Figure 2 Parametric Equalizer ......................................................................................... 6

Figure 3 GUI Design........................................................................................................ 7

Figure 4 Toolbars in Software ......................................................................................... 8

Figure 5 Basic GUI ......................................................................................................... 9

Figure 6 Browsing ........................................................................................................... 9

Figure 7 Processing ...................................................................................................... 11

Figure 9 Editing sliders .................................................................................................. 11

Figure 8 Changing sliders value .................................................................................... 11

Figure 10 H/L shelving filter [2] ...................................................................................... 13

Figure 11 Peak Filtering ................................................................................................ 14

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 4/15

Sidra FahimFa2012 MSEE-056

4

Problem Statement

Make a software audio equalizer with the following frequency bands

[0 – 60 Hz], [60 Hz – 170 Hz], [170 Hz – 310 Hz], [310 Hz – 600 Hz], [600 Hz – 1 kHz],

[1 kHz – 3kHz], [3 kHz – 6 kHz], [6 kHz – 12 kHz], [12 kHz – 14 kHz], [14 kHz – 16 kHz]

Deliverables

1. A software with GUI of an audio equalizer.

2. A short report containing problem statement and the methodology used. Explain allthe steps in methodology.

Requirements

1. Variable range of gain for all bands (-20dB to 20dB)

2. Read audio file from computer

3. Equalization in real-time

4. Play audio file. Button to play file.

5. Sliders to change frequency level.

6. Figure showing the frequency response of a multiband equalizer based on the

values of sliders

7. GUI in MATLAB.

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 5/15

Sidra FahimFa2012 MSEE 056

1. AUDIO EQUALIZATION

Theory:-

It is a process to deliberately alter the tonal quality of audio passing through it. It doesthis by using a number of filter circuits, which are capable of applying gain to audio

signals within specific frequency ranges — both positive gain, referred to a 'boost', and

negative gain, referred to as 'cut'. [1]

There are two different types of equalizers:

1. Graphic Equalizers

In the graphic equalizer , the input signal is sent to a bank of filters. Each filter passes

the portion of the signal present in its own frequency range or band . The amplitude

passed by each filter is adjusted using a slide control to boost or cut frequency

components passed by that filter. The vertical position of each slider thus indicates the

gain applied at that frequency band, so that the knobs resemble a graph of the

equalizer's response plotted versus frequency. [2]

Figure 1 Graphic Equalizer

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 6/15

Sidra FahimFa2012 MSEE 056

2. Parametric Equalizer

Parametric equalizers are multi-band variable equalizers which allow users to control

the three primary parameters: amplitude, center frequency and bandwidth . [2]The

amplitude of each band can be controlled, and the center frequency can be shifted, and

bandwidth ("Q") can be widened or narrowed.

Figure 2 Parametric Equalizer

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 7/15

Sidra FahimFa2012 MSEE 056

2. SOFTWARE DESIGN METHODOLOGY

1. Graphic Interface of Audio Equalizer

Firstly, a graphical overview of the required equalizer is designed with appropriatebuttons, sliders and axes placements.

Figure 3 GUI Design

1. Push buttons

Browse the ‘.*wav’ files from computer to read and equalized.

After selecting the file, process button plots the frequency response of the

speech/audio file.

Play sound button for playing audio selected.

Gains can be set to zero by pressing Reset Gains button.

2. Panel

Process, Play Sound and Reset Gains options are grouped into an ‘Option’ panel for the

user accessibility.

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 8/15

Sidra FahimFa2012 MSEE 056

3. Sliders

10 different sliders with required cutoff frequencies are placed which can be changed by

user in real time.

4. Static Text

Few static texts are introduces such as ‘Select, Frequencies, -20dB and 20dB’. These

texts can’t be edited in run -time.

5. Edit Texts

When users vary the gain of the sliders, the gain values appear in the edit text gadget

below each slider. Also, when user select the audio file from computer it’s path also

appear in an edit text box.

6. Tools

Following tools are added in tool bar:

Save figure, Legend, Print, Color Bar, Data cursor

Figure 4 Toolbars in Software

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 9/15

Sidra FahimFa2012 MSEE 056

2. Run GUI interface

Now when all the desired buttons are set, click play or Run Fig to see layout.

Figure 5 Basic GUI

3. M-file editing

Now click on open editor to see m-file related to the project. Audio_equalizer_sidra.m

contains a variety of functions related to sliders, push button, edit text buttons etc

Functions which are edited are shown below:

1. Browsing function

Figure 6 Browsing

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 10/15

Sidra FahimFa2012 MSEE 056

2. Processing Function

This function reads and plots the sound wave as shown below:

% --- Executes on button press in Browse. function pushbutton12_Callback(hObject, eventdata, handles) global s fs Fs [FileName,PathName,FilterIndex] =uigetfile({ '*.wav' }, 'Load Wav File' ); isok=true; if length(FileName)==1

if FileName==0 isok=false;

end end

if isok fln=[PathName FileName]; set(handles.edit3, 'string' ,fln); [s, fs]=wavread(fln);

end

% --- Executes on button press in Process. function Process_Callback(hObject, eventdata, handles) % hObject handle to Process (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global s Fs fs Y=fftshift(fft(s)); % plot spectrum of bottom 5000Hz hzFs=Fs*length(Y)/fs; f=(0:hzFs)*fs/length(Y); plot(handles.axes3,f,20*log10(abs(Y(1:length(f)))+eps)); legend( 'Spectrum' ); xlabel( 'Frequency (Hz)' ); ylabel( 'Magnitude (dB)' ); drawnow;

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 11/15

Sidra FahimFa2012 MSEE 056

Figure 7 Processing

3. Scrolling sliders and Updating Gains

Similar functions are used to update other sliders and edit test string below each slider.

Figure 9 Editing sliders

% --- Executes on slider movement. function slider12_Callback(hObject,eventdata, handles) g1=get(hObject, 'Value' );

set(handles.edit4, 'string' ,g1); updategains; update_filters;

function edit4_Callback(hObject,eventdata, handles) get(handles.edit4, 'string' );

Figure 8 Changing sliders value

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 12/15

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 13/15

Sidra FahimFa2012 MSEE 056

Update_filter is the core part of equalizer. Filters used in equalizer are

1. Low/High shelving filter

A filter designed to alter the level of all signals beyond a certain frequency by a user-

definable amount.

Figure 10 H/L shelving filter [2]

function [b a]=get_high_shelving_filter(g,Q,f,Fs) A=10^(g/40); w=2*pi*f/Fs; sn=sin(w); cs=cos(w); bt=sqrt(A)/Q; b=A*[(A+1)+(A-1)*cs+bt*sn, ...

-2*((A-1)+(A+1)*cs), ...

(A+1)+(A-1)*cs-bt*sn];

a=[(A+1)-(A-1)*cs+bt*sn, ... 2*((A-1)-(A+1)*cs), ... (A+1)-(A-1)*cs-bt*sn];

b=b/a(1); a=a/a(1);

function [b a]=get_low_shelving_filter(g,Q,f,Fs) A=10^(g/40); w=2*pi*f/Fs; sn=sin(w); cs=cos(w); bt=sqrt(A)/Q; b=A*[(A+1)-(A-1)*cs+bt*sn, ...

2*((A-1)-(A+1)*cs), ...

(A+1)-(A-1)*cs-bt*sn];

a=[(A+1)+(A-1)*cs+bt*sn, ... -2*((A-1)+(A+1)*cs), ... (A+1)+(A-1)*cs-bt*sn];

b=b/a(1); a=a/a(1);

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 14/15

Sidra FahimFa2012 MSEE 056

2. Peak Filter:-

It boosts a specific band of frequencies. Q is a measure of the width of the frequency

range altered by a peaking filter.

F

5. Play Sound

This button reads the file from the path given in the browse window.

6. Reset Gains

This button set all the gains of the frequency bands to zero.

function [b a]=get_peak_filter(g,Q,f,Fs)

A=10^(g/40); w=2*pi*f/Fs; sn=sin(w); cs=cos(w); al=sn/(2*Q);

b=[1+al*A -2*cs 1-al*A]; a=[1+al/A -2*cs 1-al/A];

b=b/a(1); a=a/a(1);

% --- Executes on button press in Reset. function Reset_Callback(hObject, eventdata, handles) global g n; n=10; g=zeros(n,1); set(handles.slider12, 'value' ,0); set(handles.edit4, 'string' ,0); get(handles.edit4, 'string' );

Figure 11 Peak Filtering

% --- Executes on button press in Play Sound. function pushbutton13_Callback(hObject, eventdata, handles) global s fs;

8/12/2019 Audio Equalizer Report.pdf

http://slidepdf.com/reader/full/audio-equalizer-reportpdf 15/15

Sidra FahimFa2012 MSEE 056

3. Bibliography

[1] "Equalizer Explained," 1985. [Online]. Available:http://www.soundonsound.com/sos/jul01/articles/equalisers1.asp. [Accessed 24 July

2014].

[2] G. Massenburg, "Parametric Equalization," ITI Audio Products.

[3] D. Bohn, "Operator Adjustable Equalizers: An Overview," Rane Corporation.

[4] A. Degani, "DIGITAL AUDIO PROCESSING," University of Brescia - Communication

Technology and Multimedia.