title: Saving Text to Speech Python
body: <p>I am trying save the results of text to speech to a file on windows.  I successfully gotten it to speak (using <code>speak.Speak</code>).  However, no such luck with saving files.</p>
  
  <p>The problem is <code>AudioOutputStream</code> isn't being found, despite it <a href="https://msdn.microsoft.com/en-us/library/ms723602(v=vs.85).aspx" rel="nofollow noreferrer">being listed in the Microsoft docs</a>.</p>
  
  <p>Version information: Windows 10, Python 3.6</p>
  
  <h1>Error</h1>
  
  <pre><code>Traceback (most recent call last):
    File "...\dd.py", line 87, in &lt;module&gt;
      speak.AudioOutputStream = filestream
    File "...\win32com\client\dynamic.py", line 565, in __setattr__
      self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
  pywintypes.com_error: (-2147352573, 'Member not found.', None, None)
  </code></pre>
  
  <h1>Code</h1>
  
  <pre><code>from win32com.client import Dispatch
  import win32api
  
  speak = Dispatch("SAPI.SpVoice")
  filestream = Dispatch("SAPI.SpFileStream")
  filestream.open("out.wav", 3, False) 
  for k in speak.GetAudioOutputs():
      print(k.GetDescription())
  speak.AudioOutputStream = filestream
  speak.Speak("test")
  filestream.close()
  </code></pre>