تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[مثال] قراءة النص باستخدام جوجل Google Text To Speech
#1
أول شيء يتم إضافة المكتبة من Reference
Reference:> [COM] Windows Media Player :>wmp.dll
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    GoogleTextToSpeech("ar", TextBox1.Text)
End Sub

Private Sub GoogleTextToSpeech(ByVal lang As String, ByVal text As String)
    Try
        Dim wc As New Net.WebClient()
        wc.Headers.Add(Net.HttpRequestHeader.UserAgent, "Mozilla/5.0")
        Dim data As Byte() = wc.DownloadData(String.Format("http://translate.google.com/translate_tts?tl={0}&q={1}", lang, text))
        Dim file As String = IO.Path.GetTempFileName.Replace(".tmp", "") & ".mp3"
        IO.File.WriteAllBytes(file, data)
        Dim mp As New WMPLib.WindowsMediaPlayer()
        mp.URL = file
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub
الرد }}}
تم الشكر بواسطة: abulayth , Mostafa Saad



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم