Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function recorder()
- option = 'n';
- option_rec = 'n';
- record_len = 0.7; % Record time length in seconds
- sample_freq = 8192; % Sampling frequency in Hertz
- sample_time = sample_freq * record_len;
- name = input('Enter the file name you want to save the file with: ', 's');
- file_name = sprintf('%s.wav', name);
- option_rec = input('Press y to record: ', 's');
- if option_rec == 'y'
- while option == 'n',
- input('Press enter when ready to record--> ');
- record = wavrecord(sample_time, sample_freq);
- input('Press enter to listen the recorded voice--> ');
- sound(record, sample_freq);
- option = input('Press y to save or n to record again: ', 's');
- end
- wavwrite(record, sample_freq, file_name);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement