time recording problem with matlab
Show older comments
hello,
I am trying to record my voice using the codes below:
% Before starting, we will use the following commands
clear all % clear all workspace variables
close all % close all open figures
clc % clear command window
% Speech synthesis (recording and saving audio signal) and loading into
% matlab
% Input paramters (default values)
fs= 16000; % sample frequency
nobits = 8; % number of bits per sample
nochannels = 1; % number of channels (mono)
x = audiorecorder(fs, nobits, nochannels);
get(x);
x = audiorecorder;
disp('Start speaking.')
recordblocking(x, 3);
disp('End of Recording.');
% Play audio signal
play(x);
% Save data (double precision array)
x = getaudiodata(x);
% Save recorded signal as an audio file with "wav" extention (type of file)
audiowrite ('x.wav', x,fs)
% Codes to asnwer questions (1-4) of (5.Problem Statement)
% 1. Code to find sample rate of the audio signal
% Read (download) audio file into matlab
[x,fs] = audioread('x.wav');
for some reasons, the recorded audio file is less than 3 seconds and when I play it using real player it only last for 1.5 seconds,
The strange thing is that the codes and recorded signal are working properly with Fs= 8000 Hz. Could anyone help me with this issue?
Thank a lot and I really appreciate quick response as I have to submit my project tomorrow.
1 Comment
Jan
on 7 May 2016
Your question is funny. You try to push the voluntary helpers, because you started to solve the problems very late. ;-) Of course, I have been almost too late many times also, but I did not publish this in the forum.
Accepted Answer
More Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!