Skip to content

Instantly share code, notes, and snippets.

@alshell7
Created July 10, 2016 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alshell7/4557588efef763bb81c1295aff1c02a4 to your computer and use it in GitHub Desktop.
Save alshell7/4557588efef763bb81c1295aff1c02a4 to your computer and use it in GitHub Desktop.
Convert text to speech with having the output be saved in specified location in *.wav format file.
Imports System.Speech.Synthesis
Public Class Form1
Dim spsynth As New Speech.Synthesis.SpeechSynthesizer
Private Sub SaveTTStoFile(ByVal TextToSpeak As String,ByVal FileLocation As String )
Try
With spsynth
.Volume = 100
.SetOutputToDefaultAudioDevice()
.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult)
.SetOutputToWaveFile(FileLocation) 'Example "D:\mypara.wav"
End With
spsynth.SpeakAsync(TextToSpeak) 'blah blah blah
'Process.Start(TextToSpeak)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment