
% clipping.m

[y, fs, bits] = wavread('speech.wav');

y = y/max(abs(y));

sound(y,fs);

disp('Paused ... hit any key');
pause


N = length(y);
cliplevel = 0.02;

for i = 1:N,
  if abs(y(i)) > cliplevel
    y(i) = sign(y(i))*cliplevel;
  end
end

sound(y,fs);