What is SAPI and when would you use it?

SAPI stands for “Server API” (and API stands for “Application Programming Interface”). It is the mechanism that controls the interaction between the “outside world” and the PHP/Zend engine. So, you would always want to use it. In fact, you cannot avoid using it without a lot of effort since even CLI is considered a SAPI.

Streaming input to System.Speech.Recognition.SpeechRecognitionEngine

I got live speech recognition working by overriding the stream class: class SpeechStreamer : Stream { private AutoResetEvent _writeEvent; private List<byte> _buffer; private int _buffersize; private int _readposition; private int _writeposition; private bool _reset; public SpeechStreamer(int bufferSize) { _writeEvent = new AutoResetEvent(false); _buffersize = bufferSize; _buffer = new List<byte>(_buffersize); for (int i = 0; i … Read more