% record.m --- DEMONSTRATE SOUND RECORDING % on a Sun workstation input('Hit return to start recording: ','s'); disp('Recording now.'); disp('Hit control-c to stop recording ...'); eval('!audiorecord > recorded.au'); disp('Recording complete.'); disp(' '); disp('reading au file ...'); r = auread('recorded.au'); disp('Here is what was heard:'); sound(r); % Plot a time-domain version of the recorded waveform: Rsample = 8192; %default sampling rate for Sun subplot(211); plot((1:length(r)) / Rsample, r); title('recorded waveform'); xlabel('time (seconds)'); %Plot a frequency-domain version subplot(212); psd(r,256,Rsample); xlabel('frequency (Hz)'); ylabel('dB'); title('PSD of recorded waveform');