speech to text conversion
devika asokan asked
on 1 Apr 2011
Latest activity:
Answer by Sandeep Kaur
on 7 Feb 2012
am getting a dimension mismatch error in this code as: Error in ==> lpc_training1 at 57.cud sum1 pls help correct it? fw(i,:) = a; Fs = 10000; % Sampling Frequency (Hz) n = 12; % LPC order Nseconds = 1; % Length of speech signal % List of words (you can add more words to this list but make sure
% each word has five characters (if less then pad it with spaces)
words = [' up';
' down';
' left';
'right'];
% Matrix to store features for each word (rows correspond to words) %fw = zeros(size(words,1),n); fprintf('You will get one second to say each word.\n\n');
% For each word, get the word from microphone and compute its features
for i=1:size(words,1)
fprintf('Hit enter and say immediately ''%s'':',words(i,:));
% pause for enter key
junk=input('');
% get a word from microphone
x = wavrecord(Nseconds*Fs, Fs, 'double');
% Calculate the features of the word
% f = lpc_feature(y,n);
% x: Speech signal
M = n; % M: Order of LPC model
seg = 240; % Segment or frame size
if (size(x,2) == 1)
x = x';
end
npts = length(x);
nseg = floor(npts/seg); % nseg: Number of segments in the signal
% Perform the following for each and every segment of the speech
for each = 1:nseg
xx = x((each - 1)*seg + [1:seg]);
[a,G] = lpc(xx, M);
e = filter(a,1,xx); % Computer residual error signal
G = sqrt(G);
e = e/G;
% Save lpc parameter, gain and redidual errors
%parameter(each,:) = a; gain(each) = G; residu((each - 1)*seg + [1:seg]) = e; end %[residu,Q] = quantization(residu,16); % Save them in the features matrix
fw(i,:) = a;
% abs(f)
% plot(1:Fs,fft(y));
end
% Save features matrix to a file (this file will be loaded into Matlab during speech recognition) save words_lpc.mat Fs n words fw; Products |
|---|
@devika asokan,please mail me the above corrected code at sandeepkharaud@yahoo.com. I need it urgently.I m working on a project "controlling mouse movement using speech", So i need your help.
i am unable to understand this lpc() funtion. plzzzzz send me the code of this lpc() method.
Contact us at files@mathworks.com
1 comment
Please go back in to the editor and select all of your code and click on the 'Code {}' button, so that all of it is reformatted to be readable.
Please also indicate specifically which line is line 57.
At the time you get the error, what is the size of the variable on the left side of the assignment and what is the size of the expression on the right side of the assignment?