Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 2 (Convolution and echo): There are several built-in MATLAB sounds, suc

ID: 2268582 • Letter: E

Question

Exercise 2 (Convolution and echo): There are several built-in MATLAB sounds, such as chirp, gong, handel, laughter, splat, and train. These sounds are built-in *.mat files that define the sound to appear in a vector named y, and also define the sampling rate for that sound to be in Fs. Pick two sounds and figure out the length of the sounds in seconds. Next, pass the sounds of your choice through the following system: h |1, zeros( 1, dly * Fs), 0.75 where dly is the delay of the echo in seconds. Use sound to play both the input and output for various choice of dly. Explain what you heai.

Explanation / Answer

Hello,
          Please find the answer attached as under. Please give a thumbs up rating if you find the answer useful! Have a rocking day ahead!

**** Matlab Code ****

%%%%%%%%%%%%%%%%%%%%%%%%%%
%% filtering sounds


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Loading the sound files and finding all relevant parameters
load laughter.mat;
laughter_Fs = Fs;
laughter_y = y;
laughter_time = length(laughter_y)/laughter_Fs;

load train.mat;
train_Fs = Fs;
train_y = y;
train_time = length(train_y)/train_Fs;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Generating the echo

dly1 = 0.5; dly2 = 1;                   % two delay values

h1 = [1,zeros(1,dly1*Fs),0.75];         % impulse response of first system
laughter_h1 = conv(laughter_y,h1);      % laughter passed through h1
train_h1 = conv(train_y,h1);            % train passed through h1

h2 = [1,zeros(1,dly2*Fs),0.75];         % impulse response of second system        
laughter_h2 = conv(laughter_y,h2);      % laughter passed through h2
train_h2 = conv(train_y,h2);            % train passed through h2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% generating the sound files
%% Please unmute your speakers
%% the delays have been provided to prevent sound overlaps.


sound(laughter_y);
pause(8);                       % delay of 8 secs
sound(laughter_h1);
pause(8);
sound(train_y);
pause(3);                       % delay of 3 secs
sound(train_h1);
pause(5);

sound(laughter_y);
pause(8);
sound(laughter_h2);
pause(8);
sound(train_y);
pause(3);
sound(train_h2);

*** End of Code ****

When you observe the speaker outputs, you will notice the echoing overlap of the sound in both cases. The first one has a delay of 0.5 secs and the other a value of 1 sec. The overlap may be a bit tough to synchronise for the laughter sound, because it is a long file. But you may verify that the signals with echo play longer, indicating perfect echoing overlap