|
| Working Sample of Speech Recognition from a file? |
 |
Thu, 7 Feb 2008 04:35:12 -0600 |
Please direct me to a working sample of Speech Recognition from a file
preferably
with (as many as possible of) the following traits:
Runable on XP/2003 (not just Vista)
installation of some specific SDK/Net version is ok here as long as
that works
on the older OSs
.Net (recent is better but previous item takes precedence)
C# (or C++ then VB etc)
Using MP3 file (but if this isn't possible please tell me so that I can
plan to convert
to WAV (etc)
My initial searches found either partial or non-working samples.
(I.e., wouldn't compile in VS2008)
I intend to train the engine with a fixed set of recorded responsed (less
than
50), and then expect it to recognize these distinctive short phrases
combined
in continous speech of 5-10 of these elements.
Thanks in advance.
--
Herb Martin
|
| Post Reply
|
| RE: Working Sample of Speech Recognition from a file? |
 |
Thu, 7 Feb 2008 19:41:01 -0800 |
I don't know if this helps. It's C# and does work. Although I haven't trained
my engine properly so result is not very good!
//Class members
SpInProcRecoContext sprec = null;
ISpeechRecoGrammar spg = null;
//Initialiozation
sprec = new SpInProcRecoContext();
sprec.Recognition += new
_ISpeechRecoContextEvents_RecognitionEventHandler(SPRec_Recognition);
sprec.StartStream += new
_ISpeechRecoContextEvents_StartStreamEventHandler(SPRec_StartStream);
sprec.EndStream += new
_ISpeechRecoContextEvents_EndStreamEventHandler(SPRec_EndStream);
spg = sprec.CreateGrammar(null);
spg.DictationLoad(null, SpeechLoadOption.SLOStatic);
//Event handlers
void SPRec_EndStream(int StreamNumber, object StreamPosition, bool
StreamReleased)
{
//whatever you want to do
}
void SPRec_StartStream(int StreamNumber, object StreamPosition)
{
//
}
void SPRec_Recognition(int StreamNumber, object StreamPosition,
SpeechRecognitionType RecognitionType, ISpeechRecoResult
Result)
{
spg.DictationSetState(SpeechRuleState.SGDSInactive);
string s = "";
for (int i = 0; i < Result.PhraseInfo.Elements.Count; i++)
{
ISpeechPhraseElement e = Result.PhraseInfo.Elements.Item(i);
s += e.DisplayText + " ";
}
MessageBox.Show(s);
}
//Open file
SpFileStream fs = new SpFileStream();
fs.Open(filename, SpeechStreamFileMode.SSFMOpenForRead,false);
sprec.Recognizer.AudioInputStream = fs;
spg.DictationSetState(SpeechRuleState.SGDSActive);
"Herb Martin" wrote:
> Please direct me to a working sample of Speech Recognition from a file
> preferably
> with (as many as possible of) the following traits:
>
> Runable on XP/2003 (not just Vista)
> installation of some specific SDK/Net version is ok here as long as
> that works
> on the older OSs
>
> .Net (recent is better but previous item takes precedence)
>
> C# (or C++ then VB etc)
>
> Using MP3 file (but if this isn't possible please tell me so that I can
> plan to convert
> to WAV (etc)
>
> My initial searches found either partial or non-working samples.
> (I.e., wouldn't compile in VS2008)
>
> I intend to train the engine with a fixed set of recorded responsed (less
> than
> 50), and then expect it to recognize these distinctive short phrases
> combined
> in continous speech of 5-10 of these elements.
>
> Thanks in advance.
>
> --
> Herb Martin
>
>
|
| Post Reply
|
| Re: Working Sample of Speech Recognition from a file? |
 |
Thu, 7 Feb 2008 23:43:00 -0600 |
"raminarya" <raminarya@discussions.microsoft.com> wrote in
message
news:6F9A0AE2-38CB-497A-A123-CF07968F07E4@microsoft.com...
>I don't know if this helps. It's C# and does work. Although I haven't
>trained
> my engine properly so result is not very good!
I didn't even come close to getting a compile -- even by trying to look
up the missing class definitions and such...
> //Class members
> SpInProcRecoContext sprec = null;
> ISpeechRecoGrammar spg = null;
> //Initialiozation
> sprec = new SpInProcRecoContext();
> sprec.Recognition += new
> _ISpeechRecoContextEvents_RecognitionEventHandler(SPRec_Recognition);
> sprec.StartStream += new
> _ISpeechRecoContextEvents_StartStreamEventHandler(SPRec_StartStream);
> sprec.EndStream += new
> _ISpeechRecoContextEvents_EndStreamEventHandler(SPRec_EndStream);
> spg = sprec.CreateGrammar(null);
> spg.DictationLoad(null, SpeechLoadOption.SLOStatic);
> //Event handlers
> void SPRec_EndStream(int StreamNumber, object StreamPosition, bool
> StreamReleased)
> {
> //whatever you want to do
> }
> void SPRec_StartStream(int StreamNumber, object StreamPosition)
> {
> //
> }
> void SPRec_Recognition(int StreamNumber, object StreamPosition,
> SpeechRecognitionType RecognitionType, ISpeechRecoResult
> Result)
> {
> spg.DictationSetState(SpeechRuleState.SGDSInactive);
> string s = "";
> for (int i = 0; i < Result.PhraseInfo.Elements.Count; i++)
> {
> ISpeechPhraseElement e = Result.PhraseInfo.Elements.Item(i);
> s += e.DisplayText + " ";
> }
> MessageBox.Show(s);
> }
> //Open file
> SpFileStream fs = new SpFileStream();
> fs.Open(filename, SpeechStreamFileMode.SSFMOpenForRead,false);
> sprec.Recognizer.AudioInputStream = fs;
> spg.DictationSetState(SpeechRuleState.SGDSActive);
>
>
> "Herb Martin" wrote:
>
>> Please direct me to a working sample of Speech Recognition from a file
>> preferably
>> with (as many as possible of) the following traits:
>>
>> Runable on XP/2003 (not just Vista)
>> installation of some specific SDK/Net version is ok here as
long
>> as
>> that works
>> on the older OSs
>>
>> .Net (recent is better but previous item takes precedence)
>>
>> C# (or C++ then VB etc)
>>
>> Using MP3 file (but if this isn't possible please tell me so that I
can
>> plan to convert
>> to WAV (etc)
>>
>> My initial searches found either partial or non-working samples.
>> (I.e., wouldn't compile in VS2008)
>>
>> I intend to train the engine with a fixed set of recorded responsed
(less
>> than
>> 50), and then expect it to recognize these distinctive short phrases
>> combined
>> in continous speech of 5-10 of these elements.
>>
>> Thanks in advance.
>>
>> --
>> Herb Martin
>>
>>
>>
|
| Post Reply
|
| Re: Working Sample of Speech Recognition from a file? |
 |
Sat, 9 Feb 2008 08:18:01 -0800 |
You should add SAPI (MS Speech in COM objects) to your references and then
"using SpeechLib;" to your source code. Sorry I should have mentioned.
You
can download a sample (MySR.zip) here:
http://www.csit.carleton.ca/~arya/tmp/
If you are using .NET 3.5 then there are speech classes under System.Speech
but I'm using .NET 2.
"Herb Martin" wrote:
>
>
> I didn't even come close to getting a compile -- even by trying to look
> up the missing class definitions and such...
>
|
| Post Reply
|
| Re: Working Sample of Speech Recognition from a file? |
 |
Mon, 11 Feb 2008 09:01:33 -080 |
Claudius Coenen posted this recently:
http://msdn2.microsoft.com/en-us/library/system.speech.recognition.speechrecogni
tionengine.setinputtowavefile.aspx
Just use SetInputToWaveFile instead of SetInputToDefaultAudioDevice. You'll
need to figure out how to convert to WAV though.
Thanks,
Phil.
--
This post is provided "AS IS" with no warranties, and confers no
rights.
"Herb Martin" <news@learnquick.com> wrote in message
news:uF7VgUXaIHA.1168@TK2MSFTNGP02.phx.gbl...
> Please direct me to a working sample of Speech Recognition from a file
> preferably
> with (as many as possible of) the following traits:
>
> Runable on XP/2003 (not just Vista)
> installation of some specific SDK/Net version is ok here as long as
> that works
> on the older OSs
>
> .Net (recent is better but previous item takes precedence)
>
> C# (or C++ then VB etc)
>
> Using MP3 file (but if this isn't possible please tell me so that I can
> plan to convert
> to WAV (etc)
>
> My initial searches found either partial or non-working samples.
> (I.e., wouldn't compile in VS2008)
>
> I intend to train the engine with a fixed set of recorded responsed (less
> than
> 50), and then expect it to recognize these distinctive short phrases
> combined
> in continous speech of 5-10 of these elements.
>
> Thanks in advance.
>
> --
> Herb Martin
>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|