% playscale.m
keys = [40 42 44 45 47 49 51 52 51 49 47 45 44 42 40];
dur = 0.25*ones(1,length(keys));
fs = 11025*4;
xx = zeros(1,round(sum(dur)*fs)+1);
n1 = 1;
for kk = 1:length(keys)
    keynum = keys(kk);
    tone = note(keynum, dur(kk),fs);
    n2 = n1 + length(tone) - 1;
    xx(n1:n2) = xx(n1:n2) + tone;
    n1 = n2;
end

soundsc(xx,fs)

spectrogram(xx, 256, 128, 256, fs,'yaxis')

