There are several situations where it would be to your benefit to listen to a WAV file rather than read a text file.

  • When you are driving home.
  • Someone who is visually impaired.
  • You do not want the contents of a text file edited.

So, I started looking into how difficult it would be to create such a program. As it turns out, not very difficult.

I used AutoIT to create a simple executable that lets you either double click on the program and select a text file or drop a text file right on it. It will then automatically create a WAV file with the same name in the same folder as your original file.

You can download the MakeWAV application for free.

Also, if you are interested, here is the source code that you can copy and compile to make your own application. It’s open source so have fun!

#NoTrayIcon

Opt("MustDeclareVars", 1)
Dim $strTXTFile ;Name of the text file to convert to a WAV
Dim $strWAVFile ;Name of the WAV file to create
Dim $strTextData ;Text information to convert to a

WAV file

If $CmdLine[0] > 0 Then
$strTXTFile = $CmdLine[1]
Else
$strTXTFile = FileOpenDialog("Select Text File...", @MyDocumentsDir, "All (*.*)|Text files (*.txt;*.csv;*.log;*.msg;*.asc)", 1)
EndIf

If Not FileExists($strTXTFile) Then Exit

$strWAVFile = StringLeft($strTXTFile, StringLen($strTXTFile) - 3) & "wav"
$strTextData = FileRead($strTXTFile)
SplashTextOn("", "Creating WAV file. Please be patient.", 275, 20, -1, -1, 1)
_MakeWAV($strTextData, $strWAVFile)

Func _MakeWAV($strSentence, $strFileName)
Dim $oVoice ;SAPI voice object
Dim $oFilestream ;SAPI file stream object
$oVoice = ObjCreate("SAPI.SpVoice")
$oFilestream = ObjCreate("SAPI.SpFileStream")
$oFilestream.Open($strFileName, 3, False)
$oVoice.AudioOutputStream = $oFilestream
$oVoice.Speak($strSentence)
$oFilestream.Close
$oFilestream = 0
$oVoice = 0
EndFunc ;==>_MakeWAV

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?