title: C++ Microsoft SAPI: How to set Windows text-to-speech output to a memory buffer?
body: <p>I have been trying to figure out how to "speak" a text into a memory buffer using Windows SAPI 5.1 but so far no success, even though it seems it should be quite simple.</p>
  
  <p>There is <a href="http://www.nextup.com/sapi5doc/WhitePapers/WP_SimpleTTS.htm" rel="noreferrer">an example</a> of streaming the synthesized speech into a .wav file, but no examples of how to stream it to a memory buffer.</p>
  
  <p>In the end I need to have the synthesized speech in a char* array in 16 kHz 16-bit little-endian PCM format. Currently I create a temp .wav file, redirect speech output there, then read it, but it seems to be a rather stupid solution.</p>
  
  <p>Anyone knows how to do that?</p>
  
  <p>Thanks!</p>