Jump to content

TTS-To-File UDF


sandman
 Share

Recommended Posts

I've seen a few topics in General Help and Support about saving TTS to file. Well, your problems are solved, thanks to this simple UDF!

The code:

Func _TTSToFile($sText, $sFile)
    Const $SSFMCreateForWrite = 3
    $objVoice = ObjCreate("SAPI.SpVoice")
    $objFile = ObjCreate("SAPI.SpFileStream.1")
    $objFile.Open($sFile, $SSFMCreateForWrite)
    $objVoice.AudioOutputStream = $objFile
    $objVoice.Speak($sText)
    _Talk($sText)
EndFunc

Func _Talk($sText)
  Local $oSpeech = ObjCreate("SAPI.SpVoice")
  $oSpeech.Speak($sText)
  $oSpeech = ""
EndFuncoÝ÷ ØLZ^jëh×6#include <_TTSToFile.au3>
_TTSToFile("This is a test", @DesktopDir & "\test.wav")

AFAIK, this is only compatible with WAVs.

Thanks to the info-giver.. http://www.microsoft.com/technet/scriptcen...s/sapi.mspx#EKH

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

  • 1 month later...

Very nice! :)

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...