???? ????? ?? ?????, ??????????? ???????????????? ????????????, ??? ?????? ???????? ?????? ???????? (??????, ?? ?????? ??????, ??? ????; ??? ?????????? ????????, ? ????????? ? ??? ?????? ????????? ??? ?????… J), ?????? ???????? ?? ?????????? ??????? ??????????? ? ??????????? ?????????? ???????. ????? ???????? ??????? ???????? ???, ????? ????????? ???-?? ??????????, ????? ?????? ??? ?? ?????? ????-??, ? ?????????????? ???? ?????? ????????? ?????????? ? ?. ?.
?? ???????? ??, ????? ??????? ????? ???? ??????? ? ???????. ? ??! ???? ?? ???????, ???? ?? ??? ?????????? ??????? ???????????? ?????? ?????.
??????, ??? ???? ?? ??? ???? ?????? ??? ??????, ?? ?????? ???
??????????? ????????? ?????? ?? ????? ??????? (Marco Minerva) ????? ??? ???? «????? ?????? ?????????? ?????????????? ?????? ? ????» ? ??? ?????? ??????? ?????? ? ???? ??? .Net ? .Net Micro Framework, ??????????? Azure DataMarket, ?????????? ?? Microsoft Translator Service.
??????? ?????? ? ???? (?????? ????) ? ??????? Microsoft Translator Service
?????????? ?????????? ?????? Microsoft Translator Service ??? ????????? ?????? ????? ????????????? ?????? ?? ???????? ?????. ?? ?????? ????????? ?????????????? 44 ?????, ??????? ??????????, ???????????, ????????, ???????????, ?????????, ???????? ? ?????????.
???? ??? ????? ??????? ?????????? ??? .NET Micro Framework, ?? ???????? ?? ??????: http://code.msdn.microsoft.com/Text-To-Speech-for-NET-9cea4462.
???????? ???????
???, ??????? ????? ????????? ? ???? ???????? ???????? ?????????? ??????? TranslatorService.Speech, ?????????????? ??? ??????????? ???????????????? ?? ??????? ???? ??? ????? ??????????. ?? ????? ???????? ????????? ?????????? ?????????? TranslatorSpeakExample, ??????????????? ???????? ??????? ?? ?????????????.
????? ????????? ??????????, ???? ?????? ? Azure DataMarket ? ???????? ????? Client ID ? Client Secret ??? ????????????? ????? ???????.
????????
?????????? ???????? ?????? Microsoft Translator Service, ????????? ???????????? ?????? .NET HttpWebRequest, ? ???????????? ????? REST. ??????? ?? ????????????? ????? ??????:
??????? ?????? ? ???? ??? .NET Micro Framework ? ??????? Microsoft Translator Service
?????????? ?????????? ?????? Microsoft Translator Service ??? ????????? ?????? ????? ????????????? ?????? ?? ???????? ?????. ?? ?????? ????????? ?????????????? 44 ?????, ??????? ??????????, ???????????, ????????, ???????????, ?????????, ???????? ? ?????????.
???? ??? ????? ??????? ?????????? ??? .NET Framework, ?? ???????? ?? ??????: http://code.msdn.microsoft.com/Speech-Synthesis-with-7658fa03
???????? ???????
???, ??????? ????? ????????? ? ???? ???????? ???????? ?????????? ??????? TranslatorService.Speech, ?????????????? ??? ??????????? ???????????????? ?? ??????? ???? ??? ????? ??????????. ?? ????? ???????? ????????? ?????????? ?????????? TranslatorSpeakExample, ??????????????? ???????? ??????? ?? ?????????????.
????? ????????? ??????????, ???? ?????? ? Azure DataMarket ? ???????? ????? Client ID ? Client Secret ??? ????????????? ????? ???????.
????????
?????????? ???????? ?????? Microsoft Translator Service, ????????? ???????????? ?????? .NET Micro Framework HttpWebRequest, ? ???????????? ????? REST. ??????? ?? ????????????? ????? ??????:
???? ?? ????? ?? ??????? ? Azure DataMarket, ??? ? ?, ?? ???????? ?? ??????, ??? «??? ????????????? ??????? ?????????? ?????? ? Azure DataMarket ? ???????? ????? Client ID ? Client Secret.
Microsoft Translator – ????????? ?????? ???????
?? ?????? ???????? ????? ??????? ??? ????????????? Microsoft Translator API. ????? ??????? ?????????? ? ?????? ??????? API ? ??????????? ??? ?????????????? ?????? ??????? ? Microsoft Translator API. ?? ???????????? ?????????? ?????? ? Microsoft Translator API ? ????????? API ??????? ?????? ?????? ?????????? ? ?????? Microsoft Translator ? ????? ??????? ??????? ? Azure Marketplace.
Microsoft ???????????? ?????? ??? ???????????, ???????????? ? ???????? ??????? ????????? ???????. ????? ???????? ????? ???????, ????????? ????????? ????????:
- ??????????? ?? Microsoft Translator API ? Azure Marketplace
- ??????????????? ?????????? ? Azure DataMarket
- ????????? ?????? HTTP POST ? ??????? ???????
1. ??????????? ?? Microsoft Translator API ? Azure Marketplace
??????????? ?? Microsoft Translator API ? Azure Marketplace. ??????? ????????, ??????????? ???????? ?? 2 ????????? ???????? ? ?????, ?????????. ??????? ????? 2 ??? ???????? ? ????? ??????? ??????. ????? ??????? ????? ????????? ????????.
2. ??????????????? ?????????? ? Azure DataMarket
????? ???????????????? ?????????? ? Azure DataMarket, ???????? ???????? https://datamarket.azure.com/developer/applications/, ????????? ???????, ?????????? ?? ???? 1, ? ???????? ?? ?????? “Register”. ? ??????? «Register your application» ??????? ??????????? ????????? Client ID ? Name. ???? «URI ???????????????» ?? ???????????? ? Microsoft Translator API. ?????? ??? ??????????? ? ??? ?????????? ?????? URI, ????? ???????? ??? ???????. ???????? ?? ???????????.
???????? ????????? client ID ? client secret
…
????????? ?????????? ???? 1
????????? ??? ???? 2;
?????? ???????? ????????? Client Id ? Client secret ? ???????? ?? ? ??????????:
?????? ????? ????????? ??????!
????????? ??????????. ????????????? ????????? ??????? ?????? ???????? (???? ? ??????? ?? ???? ? ??? ??? ??????? J).
??? ???????? ??????? ???.Net:
static void Main(string[] args) { if (string.IsNullOrEmpty(CLIENT_ID) || string.IsNullOrEmpty(CLIENT_SECRET)) { Console.WriteLine("You must obtain a Client ID and Secret in order to use this application. Please visit Azure DataMarket at https://datamarket.azure.com/developer/applications to get one.\n"); Console.ReadKey(); return; } // Create the object to retrieve spoken streams. SpeechSynthesizer speech = new SpeechSynthesizer(CLIENT_ID, CLIENT_SECRET); speech.SpeakCompleted += new EventHandler<SpeechEventArgs>(speech_SpeakCompleted); speech.AudioFormat = SpeakStreamFormat.Wave; speech.AudioQuality = SpeakStreamQuality.MaxQuality; Console.WriteLine("Retrieving the list of supported languages..."); try { string[] languages = speech.GetLanguages(); Console.WriteLine("Found {0} supported languges:", languages.Length); foreach (var lang in languages) { Console.WriteLine("{0} - {1}", lang, CultureInfo.GetCultureInfo(lang).DisplayName); } } catch (Exception ex) { Console.WriteLine("Error during the request: {0}", ex.Message); } Console.WriteLine("\n"); bool quit = false; while (!quit) { try { Console.Write("Insert the text to be spoken (empty to terminate): "); string text = Console.ReadLine(); if (string.IsNullOrWhiteSpace(text)) { quit = true; continue; } Console.Write("Specify the text language (empty to terminate): "); string language = Console.ReadLine(); if (string.IsNullOrWhiteSpace(language)) { quit = true; continue; } Console.Write("Submitting request... "); // Retrieve the stream of wave-file speaking the passed-in text in the desired language. //using (Stream stream = speech.GetSpeakStream(text, language)) //{ // var length = stream.Length; // using (SoundPlayer player = new SoundPlayer(stream)) // player.PlaySync(); //} // Speak the passed-in text in the desired language, in an asynchronous way. // When this operation completes, the speech_SpeakCompleted event is raised. speech.SpeakAsync(text, language); } catch (Exception ex) { Console.WriteLine("Error during the request: {0}", ex.Message); } Console.WriteLine("\n"); } } private static void speech_SpeakCompleted(object sender, SpeechEventArgs e) { if (e.Error != null) Console.WriteLine("Erorr: " + e.Error.Message); } }
?????? TranslatorService.Speech ????? ?????? ? ??? ????????? ???????????????:
/// <summary> /// Initializes a new instance of the <strong>SpeechSynthesizer</strong> class, using the specified Client ID and Client Secret and the desired language. /// </summary> /// <param name="clientID">The Application Client ID. /// </param> /// <param name="clientSecret">The Application Client Secret. /// </param> /// <param name="language">A string representing the supported language code to speak the text in. The code must be present in the list of codes returned from the method <see cref="GetLanguages"/>.</param> /// <remarks>You must register your application on Azure DataMarket, https://datamarket.azure.com/developer/applications, to obtain the Client ID and Client Secret needed to use the service. /// </remarks> /// <seealso cref="ClientID"/> /// <seealso cref="ClientSecret"/> /// <seealso cref="Language"/> public SpeechSynthesizer(string clientID, string clientSecret, string language) { ClientID = clientID; ClientSecret = clientSecret; Language = language; AudioFormat = SpeakStreamFormat.Wave; AudioQuality = SpeakStreamQuality.MinSize; } #region Get Languages /// <summary> /// Retrieves the languages available for speech synthesis. /// </summary> /// <returns>A string array containing the language codes supported for speech synthesis by <strong>Microsoft Translator Service</strong>.</returns> /// <exception cref="ArgumentException">The <see cref="ClientID"/> or <see cref="ClientSecret"/> properties haven't been set.</exception> /// <remarks><para>This method will block until the array is returned. If you want to perform a non-blocking request to be notified when the operation is completed, use the <see cref="GetLanguagesAsync"/> method instead.</para> /// <para>For more information, go to http://msdn.microsoft.com/en-us/library/ff512415.aspx. /// </para> /// </remarks> /// <seealso cref="GetLanguagesAsync"/> public string[] GetLanguages() { // Check if it is necessary to obtain/update access token. this.UpdateToken(); string uri = LANGUAGES_URI; HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri); httpWebRequest.Headers.Add(AUTHORIZATION_HEADER, headerValue); if (Proxy != null) httpWebRequest.Proxy = Proxy; using (WebResponse response = httpWebRequest.GetResponse()) { using (Stream stream = response.GetResponseStream()) { DataContractSerializer dcs = new DataContractSerializer(typeof(string[])); string[] results = (string[])dcs.ReadObject(stream); return results; } } }
???? ??? ???? ???????? ? ??? ?????? Net ??? .Net Micro Framework ???? ? ???? ?????????????? ?????? ? ???? ? ?????????????? ????????? ?? ?????? ????? ??? ???? ?????? ? ?? ???? ? ???????? ???? ??????…









Comments are closed.