CT2a_Lab1/echo_sound.m

11 lines
404 B
Matlab

clear all;close all; clc
load handel; % the signal is y and sampling freq in Fs
sound(y,Fs); pause(10); % Play the original sound
alpha = 0.9; D = 4196; % Echo parameters
b = [1,zeros(1,D),alpha]; % Filter parameters
x = filter(b,1,y); % Generate sound plus its echo
sound(x,Fs); % Play sound with echo
%%=== Echo Removal
pause(10);
w = filter(1,b,x);
sound(w,Fs); %The echo should no longer be audible.