Speech recognition Coding

조회 수: 91 (최근 30일)
Shubham
Shubham 2011년 2월 4일
답변: Praveen 2024년 10월 8일
somebody please tell me how do i go about speech recognition coding.
  댓글 수: 4
Sourav Newatia
Sourav Newatia 2020년 9월 21일
Search on google
SUHAS
SUHAS 2022년 11월 11일
이동: DGM 2022년 11월 12일
i need the matlab coding for speech recogniton

댓글을 달려면 로그인하십시오.

답변 (8개)

Raviteja
Raviteja 2011년 2월 4일
First you need fundamentals of speech processing. Witch includes speech signal basic sounds and features. DSP techniques like, FFT, Windowing,STFT.
Some basic signal processing tasks like finding energy, spectrum of speech, autocorrelation, zero crossing detection, silence speech removal techniques etc. Then feature extraction from speech signals.
Feature extraction (LPC,MFCC). Then classification process of feature vectros by VQ.
Then statistical modelling like HMM, GMM.
You need to go following books "Digital processing of speech signals" by Rabinar "Fundamentals of speech recognition" by Rabinar And good books for DSP.
Mostly you read IEEE papers.

Michelle Hirsch
Michelle Hirsch 2011년 2월 4일
Is your goal to have speech recognition running in MATLAB, or to actually learn how to implement the algorithm?
If you just want to be able to use speech recognition in MATLAB, and you are running on Windows, you can pretty easily just incorporate the existing Windows capabilities using the MATLAB interface to .NET.
Here's some code my friend Jiro happened to pass around just the other day for this exact task. (Paste into a file in the editor and save).
function rec = speechrecognition
% Add assembly
NET.addAssembly('System.Speech');
% Construct engine
rec = System.Speech.Recognition.SpeechRecognitionEngine;
rec.SetInputToDefaultAudioDevice;
rec.LoadGrammar(System.Speech.Recognition.DictationGrammar);
% Define listener callback
addlistener(rec, 'SpeechRecognized', @recognizedFcn);
% Start recognition
rec.RecognizeAsync(System.Speech.Recognition.RecognizeMode.Multiple);
% Callback
function recognizedFcn(obj, e)
% Get text
txt = char(e.Result.Text);
% Split into words
w = regexp(txt, '\s', 'split');
if length(w) > 1
% Look for the occurrence of the phrase "search for"
idx = find(strcmp(w(1:end-1), 'search') & ...
strcmp(w(2:end), 'for'), 1, 'first');
if ~isempty(idx) && length(w) >= idx+2
% The words after are the search terms
searchTerm = sprintf('%s+', w{idx+2:end});
searchTerm(end) = '';
% Search on the web
web(['http://www.google.com/search?q=', searchTerm]);
fprintf(2, 'search for "%s"\n', strrep(searchTerm, '+', ' '));
else
%disp(txt)
end
elseif length(w) == 1 && strcmpi(w{1}, 'stop')
obj.RecognizeAsyncStop;
obj.delete;
%disp(txt);
disp('Stopping Speech Recognition. Thank you for using!');
else
%disp(txt);
end
  댓글 수: 3
Frandy
Frandy 2012년 4월 15일
Hello I'm working on a project that involves using speech recognition. Now I tried to use your code but I am not sure on the actual process in which to have the code actually work. Do you mind explain?
Steven Dakin
Steven Dakin 2021년 1월 10일
Some operational example code that uses this approach would be vey useful!

댓글을 달려면 로그인하십시오.


Nada Gamal
Nada Gamal 2011년 4월 20일
Hi Raviteja , I made all steps of speech recognition except of classification because i used Elcudien Distance and calculate the minium distance to the templates .And i have a problem now in how can i implement Hidden Markove model in speech recognition . i don't understand this algrothim . Thanks a lot :) Best Regards, Nada Gamal
  댓글 수: 1
chan wei
chan wei 2015년 11월 7일
so do I!

댓글을 달려면 로그인하십시오.


veni
veni 2016년 8월 24일
how to write the speech recognisation in matlab coding? how to record the speech in matlab?

Neha Tonpe
Neha Tonpe 2022년 11월 25일
편집: Walter Roberson 2022년 11월 25일
function rec = speechrecognition
% Add assembly
NET.addAssembly('System.Speech');
% Construct engine
rec = System.Speech.Recognition.SpeechRecognitionEngine;
rec.SetInputToDefaultAudioDevice;
rec.LoadGrammar(System.Speech.Recognition.DictationGrammar);
% Define listener callback
addlistener(rec, 'SpeechRecognized', @recognizedFcn);
% Start recognition
rec.RecognizeAsync(System.Speech.Recognition.RecognizeMode.Multiple);
% Callback
function recognizedFcn(obj, e)
% Get text
txt = char(e.Result.Text);
% Split into words
w = regexp(txt, '\s', 'split');
if length(w) > 1
% Look for the occurrence of the phrase "search for"
idx = find(strcmp(w(1:end-1), 'search') & ...
strcmp(w(2:end), 'for'), 1, 'first');
if ~isempty(idx) && length(w) >= idx+2
% The words after are the search terms
searchTerm = sprintf('%s+', w{idx+2:end});
searchTerm(end) = '';
% Search on the web
web(['http://www.google.com/search?q=', searchTerm]);
fprintf(2, 'search for "%s"\n', strrep(searchTerm, '+', ' '));
else
%disp(txt)
end
elseif length(w) == 1 && strcmpi(w{1}, 'stop')
obj.RecognizeAsyncStop;
obj.delete;
%disp(txt);
disp('Stopping Speech Recognition. Thank you for using!');
else
%disp(txt);
end

Lavuri
Lavuri 2022년 12월 26일
function rec = speechrecognition
% Add assembly
NET.addAssembly('System.Speech');
% Construct engine
rec = System.Speech.Recognition.SpeechRecognitionEngine;
rec.SetInputToDefaultAudioDevice;
rec.LoadGrammar(System.Speech.Recognition.DictationGrammar);
% Define listener callback
addlistener(rec, 'SpeechRecognized', @recognizedFcn);
% Start recognition
rec.RecognizeAsync(System.Speech.Recognition.RecognizeMode.Multiple);
% Callback
function recognizedFcn(obj, e)
% Get text
txt = char(e.Result.Text);
% Split into words
w = regexp(txt, '\s', 'split');
if length(w) > 1
% Look for the occurrence of the phrase "search for"
idx = find(strcmp(w(1:end-1), 'search') & ...
strcmp(w(2:end), 'for'), 1, 'first');
if ~isempty(idx) && length(w) >= idx+2
% The words after are the search terms
searchTerm = sprintf('%s+', w{idx+2:end});
searchTerm(end) = '';
% Search on the web
web(['http://www.google.com/search?q=', searchTerm]);
fprintf(2, 'search for "%s"\n', strrep(searchTerm, '+', ' '));
else
%disp(txt)
end
elseif length(w) == 1 && strcmpi(w{1}, 'stop')
obj.RecognizeAsyncStop;
obj.delete;
%disp(txt);
disp('Stopping Speech Recognition. Thank you for using!');
else
%disp(txt);
end

pathakunta
pathakunta 2024년 1월 26일
First you need fundamentals of speech processing. Witch includes speech signal basic sounds and features. DSP techniques like, FFT, Windowing,STFT. Some basic signal processing tasks like finding energy, spectrum of speech, autocorrelation, zero crossing detection, silence speech removal techniques etc. Then feature extraction from speech signals. Feature extraction (LPC,MFCC). Then classification process of feature vectros by VQ. Then statistical modelling like HMM, GMM. You need to go following books "Digital processing of speech signals" by Rabinar "Fundamentals of speech recognition" by Rabinar And good books for DSP. Mostly you read IEEE papers.

Praveen
Praveen 2024년 10월 8일
function rec = speechrecognition
% Add assembly
NET.addAssembly('System.Speech');
% Construct engine
rec = System.Speech.Recognition.SpeechRecognitionEngine;
rec.SetInputToDefaultAudioDevice;
rec.LoadGrammar(System.Speech.Recognition.DictationGrammar);
% Define listener callback
addlistener(rec, 'SpeechRecognized', @recognizedFcn);
% Start recognition
rec.RecognizeAsync(System.Speech.Recognition.RecognizeMode.Multiple);
% Callback
function recognizedFcn(obj, e)
% Get text
txt = char(e.Result.Text);
% Split into words
w = regexp(txt, '\s', 'split');
if length(w) > 1
% Look for the occurrence of the phrase "search for"
idx = find(strcmp(w(1:end-1), 'search') & ...
strcmp(w(2:end), 'for'), 1, 'first');
if ~isempty(idx) && length(w) >= idx+2
% The words after are the search terms
searchTerm = sprintf('%s+', w{idx+2:end});
searchTerm(end) = '';
% Search on the web
web(['http://www.google.com/search?q=', searchTerm]);
fprintf(2, 'search for "%s"\n', strrep(searchTerm, '+', ' '));
else
%disp(txt)
end
elseif length(w) == 1 && strcmpi(w{1}, 'stop')
obj.RecognizeAsyncStop;
obj.delete;
%disp(txt);
disp('Stopping Speech Recognition. Thank you for using!');
else
%disp(txt);
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by