SpeechRecognitionEngine.SetInputToAudioStream Method
Assigns a specific audio stream as the input for the current instance of SpeechRecognitionEngine.
Assembly: System.Speech (in System.Speech.dll)
public void SetInputToAudioStream( Stream audioSource, SpeechAudioFormatInfo audioFormat )
Parameters
- audioSource
- Type: System.IO.Stream
A valid Stream instance connected to an audio source.
- audioFormat
- Type: System.Speech.AudioFormat.SpeechAudioFormatInfo
A valid member of the SpeechAudioFormatInfo enumeration specifying the format of the audio input.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
System.Speech does not do real-time processing of voice for streams.
TLDR; There is NO way to use the System.Speech library for real-time voice recognition other than directly from a audio input device.
$0$0
$0
$0In case you are like me, and always trying to find a solution and prove those who say "it can't be done" wrong, then I heed you a warning now.$0
$0$0
$0
$0Stop trying to use any of the methods in this library for real time speech recognition on a stream. The only way to get the speech recognition library to interpret voice in real time is using an audio device input (as done by SetInputToDefaultAudioDevice()). Unless you are going to create a software audio device that reads files and sets itself as the default audio device, there is unfortunately no way that you can use this library to do real-time speech recognition.$0
$0$0
$0
$0Real-time = for every real second of input, processing takes also one-minute with results and actions performed in 'human time'. This is opposed to computational-time, where the computer takes the input as fast as computationally possible (relying on hard disk/memory speeds) and processes it without consideration to human input. Computational-time processing is obviously useful in high volume or in the case where human input/output during processing is not required.$0
$0$0
$0
$0To shame, Microsoft. To shame.$0
- 5/18/2011
- Ashley Steel
- 5/18/2011
- Ashley Steel
Doesn't support real-time input.
You may be led to believe that this allows you to stream audio to the engine in real-time, given that the other, similar methods look like they're used for pre-recorded streams, but this actually only supports a pre-recorded stream as well. The internal wrapper for the stream does not implement the ISpAudio interface required by SAPI to do real-time streaming, so this method cannot do real-time streaming.