Ali - Lab 09 Report
Ali - Lab 09 Report
Lab – 9
• Software
o MATLAB
Instructions
1. This is an individual lab. You will perform the tasks individually and submit a report.
2. Some of these tasks are for practice purposes only while others (marked as ‘Exercise’) have
to be answered in the report.
3. When asked to display an image/ graph in the exercise, either save it as jpeg or take a
screenshot, in order to insert it in the report.
4. The report should be submitted on the given template, including:
a. Code (copy and pasted, NOT a screenshot)
b. Output values (from command window, can be a screenshot)
c. Output figure/graph (as instructed in 3)
d. Explanation where required
5. The report should be properly formatted, with easy to read code and easy to see figures.
6. Plagiarism or any hint thereof will be dealt with strictly. Any incident where plagiarism is
caught, both (or all) students involved will be given zero marks, regardless of who copied whom.
Multiple such incidents will result in disciplinary action being taken.
Background
Audio signal processing involves the manipulation, analysis, and enhancement of sound waves
using digital techniques. Initially, analog audio signals are converted into digital format through
analog-todigital converters (ADCs). Once digitized, various processing techniques can be applied,
including filtering, equalization, compression, and reverberation, among others. Filtering can
remove unwanted frequencies or enhance specific ones, while equalization adjusts the frequency
balance of the signal. Compression reduces the dynamic range of the signal, making it more
uniform in volume, often used in music production and broadcasting. Reverberation adds
simulated acoustic reflections to create a sense of space or ambiance. These techniques can be
implemented using algorithms in software or hardware, providing flexibility and control over
audio content in applications ranging from music production and mixing to telecommunications
and entertainment. Additionally, advancements in machine learning and artificial intelligence have
further expanded the capabilities of audio signal processing, enabling tasks such as noise reduction,
source separation, and automatic audio tagging.
Exercise:
Task 1:
Code:
a = sin(2*pi*174.61*t);
b = sin(2*pi*195.99*t);
g = sin(2*pi*220*t);
f = sin(2*pi*246.94*t);
line1 = [a,b,g,f,f,b,b];
line2 = [a,b,b,f,f,g,g];
Task2:
Code:
fs=8000;
t = 0:1/fs:2;
a = sin(2*pi*174.61*t);
b = sin(2*pi*195.99*t);
g = sin(2*pi*220*t);
f = sin(2*pi*246.94*t);
line1 = [a,b,g,f,f,b,b];
line2 = [a,b,b,f,f,g,g];
Task3:
Code:
% Define the time variable
fs=8000;
t = 0:1/fs:1;
a = sin(2*pi*174.61*t);
b = sin(2*pi*195.99*t);
g = sin(2*pi*220*t);
f = sin(2*pi*246.94*t);
line1 = [a,b,g,f,f,b,b];
line2 = [a,b,b,f,f,g,g];
Task4:
Code:
fs=8000;
t = 0:1/fs:1;
a = sin(2*pi*174.61*t);
b = sin(2*pi*195.99*t);
g = sin(2*pi*220*t);
f = sin(2*pi*246.94*t);
line1 = [a,b,g,f,f,b,b];
line2 = [a,b,b,f,f,g,g];
Code:
fs=8000;
t = 0:1/fs:1;
a = sin(2*pi*174.61*t);
b = sin(2*pi*195.99*t);
g = sin(2*pi*220*t);
f = sin(2*pi*246.94*t);
line1 = [a,b,g,f,f,b,b];
line2 = [a,b,b,f,f,g,g];
cutoff2=300/(fs/2);
order=100;
d=designfilt('bandpassfir','CutoffFrequency1',cutoff1,'CutoffFrequency2',cu
toff2,'FilterOrder',order);
output= filter(d,z);
sound(output,fs);
Task6:
myVoice = audiorecorder;
t = 0:1/8000:1;
disp('Start speaking.')
Start speaking.
recordblocking(myVoice, 10)
disp('End of recording. Playing back ...')
play(myVoice)
ans =
audioplayer with properties:
a=getaudiodata(myVoice);
% Time domain plot
t = 0:1/fs:(length(a)-1)/fs; % Time vector
figure; % Create a new figure window
plot(t, a);
title('Time Domain Signal');
xlabel('Time (seconds)');
ylabel('Amplitude');
y = fft(a);
f = (0:length(y)-1)*fs/length(y); %
magnitudeY = abs(y);
figure; % Create a new figure window
stem(f, magnitudeY);
title('Frequency Domain Spectrum');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
Explanation of all tasks is give below:
Conclusion:
Evaluation Rubric
• Method of Evaluation: In-lab marking by instructors, Report submitted by students
• Measured Learning Outcomes:
CLO1: Develop algorithms to perf orm signal processing techniques on digital signals using MATLAB and DSP Kit
DSK6713 CLO3: Deliver a report/lab notes/presentation/viva, ef f ectively communicating the design and analysis of
the given problem