Bom dia amigos, estou trabalhando em um projeto que transformo text to speech.
Ja consgio transformar o texto de uum richtextbox em .WAV esse é o código
Private Sub btSalvarWAV_Click(sender As Object, e As EventArgs) Handles btSalvarWAV.Click
Try
SaveFileDialog1.DefaultExt = ".wav"
SaveFileDialog1.Filter = ""
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Speech.SetOutputToWaveFile(SaveFileDialog1.FileName, New SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Stereo))
Speech.Speak(RichTextBox1.Text.ToLower)
End If
Catch ex As Exception
End Try
End Sub
=============================funciona muito bem, agora transforma para .mp3 da dando o seguinte erro==>
Erro => O sistema não pode encontrar o arquivo especificado, o código é esse.
Try
SaveFileDialog2.DefaultExt = ".mp3"
If SaveFileDialog2.ShowDialog = Windows.Forms.DialogResult.OK Then
Speech.SetOutputToWaveFile(Application.StartupPath & "\1.wav", New SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Stereo))
Speech.Speak(TextBox1.Text.ToLower)
Speech.SetOutputToNull()
Dim Lame As Process = New Process()
Lame.StartInfo.FileName = "Lame.exe"
Lame.StartInfo.Arguments = " -h -V 0 " + """" + Application.StartupPath & "\1.wav" + """" + " " + """"
+ SaveFileDialog2.FileName + """"
Lame.StartInfo.CreateNoWindow = True
Lame.StartInfo.UseShellExecute = False
Lame.StartInfo.RedirectStandardOutput = True
Lame.StartInfo.RedirectStandardError = True
Lame.Start()
While Not Lame.StandardError.EndOfStream
Lame.StandardError.ReadLine()
Application.DoEvents()
End While
Lame.WaitForExit()
If Lame.HasExited Then
MessageBox.Show("Arquivo processado com sucesso!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
Catch ex As Exception
' MessageBox.Show("Ocorreu algum problema no processo de gravação", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
MsgBox(ex.Message)
End Try
Try
My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\1.wav")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Estero que alguém entenda, valeu!!!!
Até mais.
Anderson.mds