Basic MATLAB
%% Record an audio clear all; close all; clc; % Sampling frequency fs = 8000; % Set up recording object my_sound = audiorecorder(fs,16,1); % pause for user input disp('Press Any Key to Start Recording ....') pause tic % start time % Record for 8 seconds recordblocking(my_sound, 8); toc % end time % Output the acquired data into workspace as double precision array, x my_sound = getaudiodata(my_sound, 'double'); % play recorded sound soundsc(my_sound,fs); % you can save it as a wave file using the syntax below audiowrite('my_sound.wav',my_sound,fs);