% Middle C to high C by eigth's
% Observe that the abrupt changes in notes causes a 
% noticeable click.
 
clear all
sf = 8192;                 % sampling frequency (Hz)
d = .25;                   % duration for each harmonic
n = sf * d;                % number of samples
s = (1:n) / sf;            % sampling vector preparation
%
for j=1:9
    cf = 261.63*2^((j-1)/8);              %middle C up 
    notes(j,:) = 1*sin(2 * pi * cf * s);  % building notes
    sound(notes(j,:), sf);              
    %
    pause(d + 0.01);       % waiting for sound end
end
