Friday, August 7, 2015

Recording sound from Microphone



MATLAB command "wavrecord" to read the audio signals from the microphone directly. The command format is

y = wavrecord(n, fs);



fs=16000; % Sampling rate

duration=2; % Recording duration

fprintf('Press any key to start  %g seconds of recording...', duration); pause

fprintf('Recording...');

y=wavrecord(duration*fs, fs);  % duration*fs is the total number of sample points

fprintf('Finished recording.\n');

 fprintf('Press any key to play the recording...'); pause;

fprintf('\n');

wavplay(y,fs);

No comments:

Post a Comment