% program tone1.m % This program plays middle A over a computer speaker. % S. Scott Moor January 2006 % first we will set input variables for the sampling frequency (sd) and duration (dur) sf = 8000; dur = 0.5; % we set up the time vector that is ‘dur’ seconds long and % has times every 1/sf sec. t = 0:1/sf:dur; % next we create an amplitude series for a sine wave. a=sin(2*pi*440*t); % finally we can play the tone we have created sound(a,sf)