K
kronecker
I have a short routine that writes to a wav file. The details of the
wav write file bit is not important. At present it put a file dialog
up and you type in a name for the file name and you save. Works fine.
Actually I want this to be much easier and fix the file name to say
file_name.wav instead of a dialog pop-up. How do I do this apparent
simple task!
Dim sfd As New SaveFileDialog()
Try
sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav"
sfd.Title = "Save to a wave file"
sfd.FilterIndex = 2
sfd.RestoreDirectory = True
If sfd.ShowDialog() = DialogResult.OK Then
Dim SpFileMode As SpeechStreamFileMode =
SpeechStreamFileMode.SSFMCreateForWrite
Dim SpFileStream As New SpFileStream()
SpFileStream.Open(sfd.FileName, SpFileMode, False)
' Write text to speech to wav file here
vox.AudioOutputStream = SpFileStream
vox.Speak(read_speak.TextBox1.Text,
SpeechVoiceSpeakFlags.SVSFlagsAsync)
vox.WaitUntilDone(Timeout.Infinite)
SpFileStream.Close()
End If
Catch
' Some stuff here
End Try
wav write file bit is not important. At present it put a file dialog
up and you type in a name for the file name and you save. Works fine.
Actually I want this to be much easier and fix the file name to say
file_name.wav instead of a dialog pop-up. How do I do this apparent
simple task!
Dim sfd As New SaveFileDialog()
Try
sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav"
sfd.Title = "Save to a wave file"
sfd.FilterIndex = 2
sfd.RestoreDirectory = True
If sfd.ShowDialog() = DialogResult.OK Then
Dim SpFileMode As SpeechStreamFileMode =
SpeechStreamFileMode.SSFMCreateForWrite
Dim SpFileStream As New SpFileStream()
SpFileStream.Open(sfd.FileName, SpFileMode, False)
' Write text to speech to wav file here
vox.AudioOutputStream = SpFileStream
vox.Speak(read_speak.TextBox1.Text,
SpeechVoiceSpeakFlags.SVSFlagsAsync)
vox.WaitUntilDone(Timeout.Infinite)
SpFileStream.Close()
End If
Catch
' Some stuff here
End Try