CS计算机代考程序代写 matlab gui EEEE4120:

EEEE4120:
Digital Signal Processing
Coursework 1 – Filtering of Sound
Department of Electrical and Electronic Engineering

October 2021

1 Introduction

As part of the Digital Signal Processing module (EEEE4120), students will be required to com-
plete two coursework assignments – each assignment will contribute 30 % towards the module
assessment. The projects outlined in these documents are based on real world problems –
students will have ample time (around 41⁄2 weeks) to research different approaches to the prob-
lem, design and code these approaches, record the results of the implementation, and write a
report on all these aspects.

This coursework is an individual assignment – it is expected that students DO NOT collaborate
on the project assignment itself or the written report.

1.1 Background

In the modern setting, sound signals are often recorded using analogue transducers (e.g.
microphones, magnetic pickups, etc), amplified, and converted to a digital signal. This allows
the sound to be stored and copied on media that will not degrade after use. However, during
all the electronic stages outlined, the sound signal will be susceptible to noise influence, which
includes when the signal is transmitted between these states. Further, the act of computer
compression (lossy) can add aberrations to the signal.

The content and sources of this noise is an unknown and engineers will often only receive the
output waveform to operate with. The post-processing of recorded data, sound in this case, is
a common practice in engineering and understanding what and how to filter correctly, without
losing the underlying signal is a useful skill.

In normal circumstances, development of the process only forms part of an engineer’s duty –
communicating on the problem, solutions, design and results in a concise manner are equally
as important – for this coursework, this will take the form of a report document.

1.2 Aims

The aim of the project is to process the waveform in the provided .wav clip to recover the much
of the original signal as possible. For this coursework, students will make use of MATLAB to
process a sound signal which has been corrupted by noise and aberrations.

The learning outcomes for Coursework 1 are as follows:

• An introduction to digital spectral analysis and applying filtering techniques to noisy sig-
nals

• Obtain an appreciation of design issues when filtering signals (i.e. improvement of signal
to noise versus the distortion of the underlying signal)

October 2021 Page 2

Students will have the opportunity to research and apply a wide variety of filters and other
signal processing techniques, and by the end of the coursework, students should have a better
understanding of these techniques.

1.3 Deliverables

Based on the application of the signal processing techniques, students will produce a short re-
port that is at maximum 10 pages in length (excluding ancillary pages, e.g.
cover/contents/references pages).

Submission of the coursework will be online using the Moodle page for Digital Signal Process-
ing (https://moodle.nottingham.ac.uk/course/view.php?id=121772).

Students should submit their report as a .pdf file, and their .m MATLAB program file/s and/or
their MATLAB saved sessions .mldatx file in a single .zip compressed file.

– Notes on submission:

• Other compression formats or individual files will NOT be accepted for submission

• Do NOT submit any data files in the .zip file as these inflate the file size unnecessarily

• The MATLAB program files should be self-contained (e.g. all non-toolbox functions used
should be placed inside the script)

• Students should submit their tasks as a single file or one file per processing solution

• The submitted .m must be able to reproduce all the signals presented in the report using
only the supplied .wav file

• The submission deadline will be given at the start of the project (via the Moodle page/lecture
slides)

October 2021 Page 3

https://moodle.nottingham.ac.uk/course/view.php?id=121772

2 Resources

2.1 MATLAB

MATLAB is a powerful software environment and programming language – it is used in a variety
of industrial and academic fields. Digital Signal Processing is one of these areas, and MATLAB
has a suite of functions and toolboxes that aid engineers in this area.

MATLAB usually requires a paid license to operate, however registered students at the Uni-
versity of Nottingham are entitled to download and run a copy of MATLAB for free on their
personal device – this includes student’s PC/laptop running Windows, MacOS or a Linux dis-
tribution.

To begin, students will need to register with MathWorks using your university email address
( .uk) on their website:

https://www.mathworks.com/licensecenter/licenses/add?s_v1=elg-chk-yes-1

Once students have received a confirmation email, students will be able to download the base
MATLAB software and all the toolboxes students require:

https://www.mathworks.com/academia/tah-portal/university-of-nottingham-646274.html

When deciding which toolboxes to install, students will need to include the Signal Processing
Toolbox, the DSP System Toolbox and the Image Processing Toolbox. However, students may
find that during their investigation, they may require other toolboxes – these all can be installed
with MATLAB or are available after installation using the Addon feature.

Once installed, students can begin to analyse waveforms using the graphical user interface
(GUI) program signalAnalyzer provided by the MATLAB Signal Processing Toolbox (see
subsection 4.3). Students may also write their own .m programs using standard MATLAB
functions to filter signals (see section 4).

An online version of MATLAB is also available for students to use –
https://matlab.mathworks.com. If students need a refresher on using MATLAB, they can take
the MATLAB academy online courses – https://matlabacademy.mathworks.com.

October 2021 Page 4

https://www.mathworks.com/licensecenter/licenses/add?s_v1=elg-chk-yes-1
https://www.mathworks.com/academia/tah-portal/university-of-nottingham-646274.html
https://matlab.mathworks.com
https://matlabacademy.mathworks.com

2.2 Data files

In order to complete this coursework, students will be provided with two sound files:

• clean-sound21.wav: This is a clean version of the 12 second input music clip (waveform
shown in Figure 1a) – used under CC BY-NC 3.0 license[1].

• corrupt-sound21.wav: This is the corrupted sound file that students will need to signal
process (waveform shown in Figure 1b).

The clean-sound21.wav file is provided for student’s reference and can be referred to as the
ideal outcome in their reports. However, the information from this file must NOT be used in
any part of assignment, i.e. it cannot be used to process the corrupt-sound21.wav. The
waveforms for the two sound files are shown in Figure 1:

0 5 10 15

Time/s

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

R
e
la

tiv
e
a

m
p
lit

u
d
e
(

a
rb

.
u
n
its

)

Clean sound waveform

(a) clean-sound21.wav

0 5 10 15

Time/s

-1.5

-1

-0.5

0

0.5

1

1.5

R
e
la

tiv
e
a

m
p
lit

u
d
e
(

a
rb

.
u
n
its

)
Corrupt sound waveform

(b) corrupt-sound21.wav

Figure 1: Waveforms of the provided sound files for the assignment

October 2021 Page 5

3 Assignment

For this coursework, students are to process the provided corrupted sound file
(corrupt-sound21.wav) to reduce the noise utilising various filtering and processing tech-
niques using MATLAB. This will require students to use the knowledge gained during the Digital
Signal Processing lectures, as well as through their own individual research around the topic.
Students should investigate the impact different processing techniques have on the corrupted
sound signal and analyse the efficacy of these techniques. In order to do this, students may
use a combination of the GUI software provided by MATLAB and their own written programs
using MATLAB functions (see section 4).

When submitting, students must submit all written programs that they have used to obtain
results (including the input parameters), and if the students have used the signalAnalyzer or
other GUI programs, they should give ALL input parameters used in the report, and save the
session .mldatx file in the submitted .zip file.

Typically, students would attempt four different processing solutions to filter the data. Some
suggestion that students could attempt include different combinations of digital filters (lowpass,
bandpass, etc), using a Wiener filter in combination with a digital filter, using an FFT filter or
any other method students have researched.

3.1 Report

Assessment of the coursework will take the form of a short report. A key skill of any engineer
is the ability to present findings in a concise form – as such, this coursework will have a 10
page limit (excluding ancillary pages, e.g. cover/contents/references pages). Students should
use Arial, font size 10 (or an equivalent sized font) on A4 sized pages, with all margins no
smaller than 25.4 mm. Text should be sectioned with suitable headings. All figures should
contain legible label text, be well presented, be referred to, and captioned correctly. References
should be placed at the end of the report using the IEEE reference guidelines (i.e. square
bracketed numbers in the text, reference list at the end with the associated square bracketed
numbers)[2].

A standard report should contain the following sections and discussion topics:

October 2021 Page 6

(1) Introduction

A concise introduction should be provided by the student that outlines the project background,
problem and aims/objectives.

(2) Review of methods

The review section should include a description of the signal processing methods the students
have used as part of the project. The review could include, if appropriate, a short explanation
of how they work or a theoretical comparison.

(3) Methods and Results

This is the major section of the report and should describe the following:

• How the student has implemented their chosen processing solutions in MATLAB.

• Justification for using the chosen methods in each solution and the choices of input pa-
rameters.

• The results obtained from processing, which will include graphical figures of the results.

• A discussion/analysis of the obtained results and the efficacy of the solutions presented.

(4) Conclusion

The report conclusions should contain:

• A brief summary of the project.

• Discuss which combination of signal processing methods worked well or badly, and ex-
plain why that was the case.

• Recommendation, justification and optimal input parameters of the best combination of
signal processing methods to be used.

It should be noted that adding additional topics of analysis, measurement or discussions will
enhance the report, however increasing the number of processing combinations may not nec-
essarily improve the project (particularly when considering the report page limit).

October 2021 Page 7

4 Processing suggestions

4.1 Initial steps

MATLAB is a routinely used for the processing of sound files – there are number of tutorials
available on the module Moodle page, on the MathWorks help pages[3], and generally on the
internet.

To get started, students should first make sure that the files are in the Current Folder. Alter-
natively, students can navigate to their working directory of choice, and copy the required files
into the MATLAB window. The audioread function allows for the loading of audio files, such
as the pulse-code modulated (PCM) corrupt-sound21.wav file, into MATLAB workspace as an
array, y , of double values between ±1 representing relative amplitude. To do this, type into
the Command Window :

> [y, fs] = audioread(‘corrupt-sound21.wav’);

where fs will give you the sampling frequency of the input sound in Hertz. It is possible
to recreate the sound waveform using the sample values ( y ) and sample frequency ( fs ) –
to do this in MATLAB, students can use the sound function to playback the data stored in
Workspace:

> sound(y,fs );

Hearing the signal after processing may give students an indication of how close to the clean
signal their processed signal is – this is in addition to comparing the graphical plots (only the
graphical representations are suitable for the written report):

> t = linspace(0, (size(y,1)/fs), size(y,1));
> plot(t,y);

After processing the data, students can write the data array to a .wav file using the audiowrite
function:

> audiowrite(‘processed.wav’,y,fs);

4.2 Reducing noise using filtering

When students first listen to corrupt.wav using the sound command, they will hear a crackling
sound. This is often heard in old recordings, for example, this is common if the original source
was on a vinyl record, where there is deterioration of the record’s surface, and when the sound
goes through the analogue-digital conversion (ADC) process.

This is a problem that can be alleviated through digital signal processing – students can,
for example, attempt to process data using a median filter[4] before applying any other digi-

October 2021 Page 8

tal signal processing methods. The MATLAB function for one-dimensional median filtering is
medfilt1 [5]. The data has been corrupted with added random noise spikes and the median
filtering is a good method to reduce the effects of noise ‘spikes’.

4.3 Spectral analysis and digital filtering

Students may find it useful to use the MATLAB signalAnalyzer GUI program[6]. This is a
convenient way to apply filtering methods to signals. Suppose that the sound data is saved as
the variable y . The environment should look something like the images shown Figures 2, 3,
4, 5;

Figure 2: Drag the array name to the Filter Signals window as shown in Figure 3.

October 2021 Page 9

Figure 3: To plot the signal, drag the variable name from the Filter Signals window to the
plotting screen. Select the box next to the filename in the window. The display should look like
Figure 4. Note: The data shown has not been pre-filtered.

Figure 4: The x-axis shows the sample index. To convert this to time, right-click on the vari-
able name in the Filter Signals box, select Time Values, then under Time Specification select
Sample Rate and Start Time. For sample rate, put in the value stored in Fs , in this case
8000 Hz, and put in 0 for start time. The x-axis for the figure will now be converted to seconds.
To obtain the amplitude spectrum, select the Display tab at the top (if not already done so),
click on the Spectrum, and the amplitude spectrum will be displayed in the panel below; if you
have specified that the signal is plotted in time, then the spectrum will be plotted against the
frequency in Hertz as shown in Figure 5.

October 2021 Page 10

Figure 5: Note that the y-axis of the spectrum is in decibels and that the frequency content
only goes up to ‘almost’ half the input sampling frequency (consider the FFT). Displaying the
signal response in the frequency domain allows students to visualise the efficacy of their pro-
cessing methods on reducing the noise and signal aberrations – click the Analyzer tab at the
top and (with the sound signal still highlighted) select filters to apply by clicking on the option
in Preprocessing selection box.

As an initial example, apply a Lowpass filter to the corrupted sound data. Adjust some of
the threshold and variable inputs to the digital filter. The Passband Frequency gives the 3
dB cut-off – try inputting 1000 Hz. Leave the default values for the Steepness and Passband
attenuation as they are for the moment. Press the Lowpass ‘green arrow’. Note: this will
overwrite the original variable in the workspace – the original data can always be re-read
in using audioread . The filtered time-domain waveform and its frequency spectrum will be
displayed.

Go back to the Analyser tab (close the current panel using the Close Lowpass button), and
add further processing steps to this filtered signal.

Students can save the current session to a .mldatx file and open it again later. If the student’s
submitted coursework involves using the signalAnalyzer program, the saved session should
be include in the coursework submission .zip file, along with the ALL the input parameters
used for processing given in the report. Students may also transfer their workspace to the main
MATLAB workspace or to a .mat file using the Export button under the Analyzer tab.

The functionality provided by the signalAnalyzer program can also be translated into a MAT-
LAB code – under the Analyzer or Display tab, explore the Generate Function or Generate
Script button to produce different MATLAB scripts – these can be used by students to create
their own .m programs.

October 2021 Page 11

4.4 Other Suggestions

In the Digital Signal Processing lectures, the application of using FFTs for filtering was ex-
plored. The simplest digital filter would be compute the FFT amplitude spectrum of noisy sig-
nals, and put zeroes under the unimportant frequency components – students can attempt this
approach to see if it works better than using the digital filters offered by the signalAnalyzer .
Students should write their own program to do this.

Wiener filtering will also be covered in the lectures – students should consider how this could
be applied to this problem, in particular the estimation of the amplitude spectrum of the signal
and noise (without using the clean signal that is given).

Another MATLAB GUI program that students may wish to use is the filterDesigner [7] – this
can be used to design constant coefficient digital filters.

During the course of this module, various MATLAB commands will be noted in the lectures
– students should familiarise themselves with these in the MathWorks web site to see if they
could be useful.

Spectral analysis:

• fft; ifft; fftdemo; FFT and demonstration

• bartlett; triang; hanning; hamming; blackman; chebwin; kaiser; Windows

• spectrogram; JTFA

• pwelch; PSD (Welch)

Digital Filtering:

• fir1; Truncation and weighting for common filters (LP etc)

• fir2; Truncation and weighting for a sampled magnitude response

• firls; Least square design

• firpm; Chebyshev design

• grpdelay; freqz; impz; zplane; Filter properties

The methods students use to analyse and implement for signal processing is entirely up to the
student. The module convenors welcome discussion of signal processing ideas and will be
willing to help in implementing them. Students will not be penalised for attempting a justifiable
method that does not work in its entirety – this happens all the time in research. Whether or not
a method works well, students will be expected to explain why the implemented method was
chosen, and why it worked well or badly. Student will not receive credit if a lot of results are

October 2021 Page 12

presented with no explanation – students should attempt to try a variety of processing method
combinations, comparing the advantages and disadvantages of each combination.

References

[1] Luis Sarro, “Bach Orchestral Suite no. 3 in D major “Air on the G string”, BWV 1068.”
https://musopen.org/music/3775-orchestral-suite-no-3-in-d-major-bwv-1068/, Oct. 2021.

[2] “IEEE Citation Guidelines.” https://ieee-dataport.org/sites/default/files/analysis/27/IEEE Ci-
tation Guidelines.pdf, Oct. 2021.

[3] “Read and Write Audio Files – MATLAB & Simulink – MathWorks United Kingdom.”
https://uk.mathworks.com/help/matlab/import_export/read-and-get-information-about-
audio-files.html#d120e12602, Oct. 2021.

[4] “Median Filter.” http://fourier.eng.hmc.edu/e161/lectures/smooth_sharpen/node2.html, Oct.
2021.

[5] “1-D median filtering – MATLAB medfilt1 – MathWorks United Kingdom.”
https://uk.mathworks.com/help/signal/ref/medfilt1.html, Oct. 2021.

[6] “Using Signal Analyzer App – MATLAB & Simulink – MathWorks United Kingdom.”
https://uk.mathworks.com/help/signal/ug/using-signal-analyzer-app.html, Oct. 2021.

[7] “Introduction to Filter Designer – MATLAB & Simulink Example – MathWorks United King-
dom.” https://uk.mathworks.com/help/signal/examples/introduction-to-filter-designer.html,
Oct. 2021.

October 2021 Page 13

Introduction
Background
Aims
Deliverables

Resources
MATLAB
Data files

Assignment
Report

Processing suggestions
Initial steps
Reducing noise using filtering
Spectral analysis and digital filtering
Other Suggestions