% show and hear smoothing and differencing

load splat % load an audio signal
y = y(:);   % force a column

N = 1024;      
yl = 0.5*y +0.5*shiftcol(y,1); % averaging


figure(1);
plot(1:N,y(1:N),1:N,yl(1:N));
title('averaging or low pass filtering')

disp('Press a key'); pause
sound(y)
disp('Press a key'); pause 
sound(yl) 
Ey = energy(y)
Ey1 = energy(yl)

disp('Press a key'); pause
yh = 0.5*y -0.5*shiftcol(y,1); % differencing
figure(2);
plot(1:N,y(1:N),1:N,yh(1:N));
title('differencing or high pass filtering')

disp('Press a key'); pause
sound(y)
disp('Press a key'); pause 
sound(yh)
Ey = energy(y)
Eyh = energy(yh)