Hello, I am making a dictionary program for learning foreign languages. I want to do the following: in the database to store the file with the pronunciation of the word / expression that I want to take from Google, tell me? How do I

  1. "speak" the word in real time from Google (or other service)
  2. how to download the specified word mp3 and add it to the database and then, being offline, listen to them.

If there are Russian-language solutions, tell me, please, because in English is not yet strong. (although it is possible in English :)).

Thank.



    1 answer 1

    var input = "hello world"; var url_fmt = "http://translate.google.com/" + "translate_tts?ie=UTF-8" + "&q={0}" + "&tl=en" + "&total=1" + "&idx=0" + "&textlen={1}" + "&prev=input"; var url = string.Format(url_fmt, WebUtility.HtmlEncode(input), input.Length); var data = new WebClient().DownloadData(url); using (var file = File.OpenWrite("audio.mpeg")) { file.Write(data, 0, data.Length); } 

    You can speak a word using the NAudio library, for example