You are reading help file online using chmlib.com
|
Interface: ISpeechRecognizer
The AudioInputStream property gets and sets the recognizer's audio input stream.
Using the AudioInputStream enables an application to use file streams or other stream objects for input rather than audio devices.
AudioInputStream is used with InProc recognizers only. Attempting to use it in a shared environment will result in an SPERR_NOT_SUPPORTED_FOR_SHARED_RECOGNIZER error.
Set: | SpeechRecognizer.AudioInputStream = ISpeechBaseStream |
Get: | ISpeechBaseStream = SpeechRecognizer.AudioInputStream |
The following Visual Basic form code demonstrates the use of AudioInputStream. The application gets a wav file and uses that as the input source.
To run this code, create a form without any controls. The file is found in the SAPI 5.1 SDK and is a small, one word file. The location is assumed to be on the C: drive, although the string may be changed to accommodate other locations.
Dim WithEvents InProcRecoContext As SpInProcRecoContext
Dim InProcRecognizer As Object
Private Sub Form_Load()
Set InProcRecognizer = CreateObject("SAPI.SpInprocRecognizer")
Set InProcRecoContext = InProcRecognizer.CreateRecoContext
Dim FileName As String
FileName = "C:\Program Files\Microsoft Speech SDK 5.1\Samples\CPP\Engines\TTS\MkVoice\selected.wav"
Dim FileStream As ISpeechFileStream
Set FileStream = CreateObject("SAPI.SpFileStream")
FileStream.Open FileName
Set InProcRecognizer.AudioInputStream = FileStream
End Sub
You are reading help file online using chmlib.com
|