Render the text       This is an example of speech synthesis      as speech.



Related task

   using a speech engine to highlight words




      SPF_ASYNC = 1
      ON ERROR SYS `CoUninitialize` : PRINT 'REPORT$ : END
      ON CLOSE SYS `CoUninitialize` : QUIT
 
      SYS "LoadLibrary","OLE32.DLL" TO O%
      SYS "GetProcAddress",O%,"CoInitialize" TO `CoInitialize`
      SYS "GetProcAddress",O%,"CoUninitialize" TO `CoUninitialize`
      SYS "GetProcAddress",O%,"CoCreateInstance" TO `CoCreateInstance`
 
      SYS `CoInitialize`,0
      voice% = FN_voice_create
      PROC_voice_speak(voice%, "This is an example of speech synthesis")
      PROC_voice_wait(voice%)
      PROC_voice_free(voice%)
      SYS `CoUninitialize`
      END
 
      DEF FN_voice_create
      LOCAL C%, D%, F%, I%, M%, P%, V%
      DIM C% LOCAL 15, I% LOCAL 15
      C%!0 = &96749377 : C%!4 = &11D23391 : C%!8 = &C000E39E : C%!12 = &9673794F
      I%!0 = &6C44DF74 : I%!4 = &499272B9 : I%!8 = &99EFECA1 : I%!12 = &D422046E
      SYS `CoCreateInstance`, C%, 0, 5, I%, ^V%
      IF V%=0 ERROR 100, "SAPI5 not available"
      = V%
 
      DEF PROC_voice_speak(V%, M$)
      DIM M% LOCAL 2*LENM$+1
      SYS "MultiByteToWideChar", 0, 0, M$, -1, M%, LENM$+1
      SYS !(!V%+80), V%, M%, SPF_ASYNC, 0
      ENDPROC
 
      DEF PROC_voice_wait(V%)
      SYS !(!V%+128), V%
      ENDPROC
 
      DEF PROC_voice_free(V%)
      SYS !(!V%+8), V%
      ENDPROC