% Astaccatto.m   P.Conrad for cisc106, fALL 2007 
% making staccatto notes

 Asamples = sineWavVector(44100,440,4);          
 wavwrite(Asamples*0.95,44100,16,'4secondA.wav');
 !chmod 755 4secondA.wav 

 sampleRate = 44100;
 stacLength = 0.2; % fraction of the note that we hear
 stacSamples = floor(sampleRate * stacLength);
 silenceSamples = sampleRate - stacSamples;

 rhythm = [ ones(1,stacSamples) zeros(1,silenceSamples) ];      
 measure = [ rhythm rhythm rhythm rhythm 0 ];    
 finalSamples = Asamples .* measure;        

 filename = 'Astaccatto.wav';
 wavwrite(finalSamples*0.95,44100,16,filename);
 system(['chmod 755 ' filename] );
 