% Alegato.m P.Conrad for cisc106, fALL 2007 % making legato notes Asamples = sineWavVector(44100,440,4); wavwrite(Asamples*0.95,44100,16,'4secondA.wav'); !chmod 755 4secondA.wav sampleRate = 44100; noteLength = 0.8; % fraction of the note that we hear noteSamples = floor(sampleRate * noteLength); silenceSamples = sampleRate - noteSamples; attack = 0:0.001:1; decay = 1:-0.001:0; rhythm = [ attack ... ones(1,noteSamples-length(attack)-length(decay)) ... decay zeros(1,silenceSamples) ]; measure = [ rhythm rhythm rhythm rhythm 0 ]; finalSamples = Asamples .* measure; filename = 'Alegato.wav'; wavwrite(finalSamples*0.95,44100,16,filename); system(['chmod 755 ' filename] );