Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1533

Translator with Sound/Speech

$
0
0
Here is a little word translation sample i would like people to have.. if you have any questions feel free to ask. you can also download the sounds/speech, ask me how if you need and i will show you how

i only used textbox and mine does not display (chinese,arabic...) languages its shows up as ?????... if you need other languages i would recommend switch to other types of control that will support other languages such as "Microsoft Forms 2.0 Object Library" (or other controls)

Speech translation will work however, even if it does not display correctly in textbox

anyways here is a working translator with sound


***Additional*** Example of how to get speech/sound status
Code:

Private Sub Command1_Click()
WindowsMediaPlayer1.URL = "http://translate.google.com/translate_tts?ie=UTF-8&tl=" & GetLanguage(cmbTo) & "&q=" & ieGoogle.document.getElementById("result_box").innertext
ChangeStatus "Loading Speech/Audio...."
Do Until WindowsMediaPlayer1.playState = wmppsPlaying
  DoEvents
Loop
ChangeStatus "Playing Speech/Audio..."
Do Until WindowsMediaPlayer1.playState = wmppsStopped
  DoEvents
Loop
ChangeStatus "Ready"
End Sub

Private Sub Command2_Click()
WindowsMediaPlayer1.URL = "http://translate.google.com/translate_tts?ie=UTF-8&tl=" & GetLanguage(cmbFrom) & "&q=" & txtTranslate.Text
ChangeStatus "Loading Speech/Audio...."
Do Until WindowsMediaPlayer1.playState = wmppsPlaying
  DoEvents
Loop
ChangeStatus "Playing Speech/Audio..."
Do Until WindowsMediaPlayer1.playState = wmppsStopped
  DoEvents
Loop
ChangeStatus "Ready"
End Sub

Private Sub cmdTranslate_Click()
On Error Resume Next
  Command1.Enabled = True
  Command2.Enabled = True
  txtResult.Enabled = True
  txtResult.Text = ieGoogle.document.getElementById("result_box").innertext
 
  ChangeStatus "Preparing Speech/Audio...."
 
  WindowsMediaPlayer1.URL = "http://translate.google.com/translate_tts?ie=UTF-8&tl=" & GetLanguage(cmbFrom) & "&q="
 
  Do Until WindowsMediaPlayer1.playState = wmppsReady
    DoEvents
  Loop
  ChangeStatus "Ready"
End Sub

Attached Files

Viewing all articles
Browse latest Browse all 1533

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>