Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim msg, dgeek, oFileStream, oVoice, i, text
- dim filesys, newfolder
- Const SAFT48kHz16BitStereo = 39
- Const SSFMCreateForWrite = 3 'creates the wav file even if it is present in our folder
- Set dgeek=CreateObject("sapi.spvoice")
- i=hour(time) 'custom greeting
- if i < 12 Then
- i=("Good morning, I am Susy, Speech expert created by Daniel the geek")
- dgeek.Speak i
- Else
- i=("Good day, I am Susy, Speech expert created by Daniel the geek")
- End If
- text=msgBox("Welcome - Dann v0.0.1 Text to audio converter")
- msg=InputBox("Enter your text for conversion","Dann v0.0.1 Text to audio converter")
- If msg = ("Fuck") Then 'word filtering add your preffered words
- Err.Clear
- Wscript.Echo ("F words are not allowed, this response was trigerred because you entered an F word into the text field") 'display the rules
- Else If msg = ("") Then 'setting a response if no text has been entered
- dgeek.Speak ("You did not type anything for me to say, check back later, since your mind is blank")
- dgeek.WaitUntilDone(1000)
- Else
- dgeek.Speak msg
- End If
- End If
- 'creating a folder to export the sound file to
- set filesys=CreateObject("Scripting.FileSystemObject")
- 'checking if the folder does not exist
- If Not
- filesys.FolderExists("c:\Danntextaudio\rec\") Then
- newfolder = filesys.CreateFolder("c:\Danntextaudio\rec\") 'creating a custom folder
- Wscript.Echo ("A new folder '" newfolder "' has been created") 'alerting user about the new folder
- End If
- 'Saving the text entered as a wav
- Set oFileStream = CreateObject("SAPI.SpFileStream")
- oFileStream.Format.Type = SAFT48kHz16BitStereo
- oFileStream.Open "C:\Danntextaudio\rec\recording.wav", SSFMCreateForWrite
- Set oVoice = CreateObject("SAPI.SpVoice")
- Set oVoice.AudioOutputStream = oFileStream
- oVoice.Speak msg
- oVoice.WaitUntilDone(10000)
- oFileStream.Close
- 'I posted this as a guest before but discovered a little error. So here is an update
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement