none
Text to speech RRS feed

  • Question

  • Hi. For everyone!

    Win 10 home runs on my machine (asus vivobook).

    I would write an application in C # with English and Hungarian text reading.

    English reading works fine, but with Hungarian I have no luck. Although "Szabolcs" appears in the settings, it works great as a narrator, but I can't access it from the program anymore. When I query for available sounds, I only get English (deskstop - zira).

    Is there a chance to use the Hungarian voice or forget it?

    Thank you in advance for your answer(s).
    Saturday, September 7, 2019 4:30 PM

Answers

  • Hi Castorix,

    I'm already stuck here:

    // Reference SpeechLib // Microsoft Speech Object Library

    i do not found SpeechLib in the reference..


    In the COM tab, SAPI.DLL :

    • Marked as answer by Riha46 Thursday, October 3, 2019 7:19 PM
    Tuesday, October 1, 2019 5:37 PM

All replies

  • Hello Riha46,

    This forum is for "Discuss Windows SDK Documentation, Samples and Tools." It is C++ focused.

    Since your issue about C# I'll move it to C# forum for more professional support.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 9, 2019 2:15 AM
  • Hi Richa46,

    Thank you for posting here.

    Based on my research, you could try System.Speech.Synthesis to do text to speech.

    First, it is necessary for you to install Hungarian language pack.

    Second, I write a simple code, you could have a look.

     using (SpeechSynthesizer synth = new SpeechSynthesizer())
                {
    
                    // Output information about all of the installed voices. 
                    Console.WriteLine("Installed voices -");
                    foreach (InstalledVoice voice in synth.GetInstalledVoices())
                    {
                        VoiceInfo info = voice.VoiceInfo;
                        Console.WriteLine(" Voice Name: " + info.Name);
                    }
                    synth.SelectVoice("Microsoft David Desktop");  // select one Hungarian voice name from the above voice name
                    PromptBuilder builder = new PromptBuilder();
                    builder.Culture = new System.Globalization.CultureInfo("hu-HU");
                    builder.AppendText("Helló");
    
                    // Speak the prompt.
                    synth.Speak(builder);
                }
                Console.ReadKey();

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, September 9, 2019 8:17 AM
    Moderator
  • Hi Jack,
    Thank you for your answer but unfortunately it didn't help.
    I installed the Hungarian sound.
    I ran your code and got the following error message:
    "Cannot set audio. No sound installed or audio is disabled."
    How can I check, e.g. the existence of an installation in regedit.

    best regards sincerely,

    Riha

    Wednesday, September 11, 2019 8:37 AM
  • Hi 

    Thanks for the feedback.

    I think it may be a problem for voice package. Because I tested it for chinese or english, it works well both.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, September 11, 2019 9:35 AM
    Moderator
  • What neither of you are mentioning is what browser you are using.

    Chrome has tightened use of voice synth, requiring user interaction before it will work.

    https://www.chromestatus.com/feature/5687444770914304

    Best regards,
    Pete

     


    #PEJL
    Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

    Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!

    Wednesday, September 11, 2019 12:45 PM
    Moderator
  • Hi,

    Sorry, but my development has nothing to do with chrome. This would be a desktop application in wpf.

    I would like to ask you, how can I check if the Hungarian sound installation was successful?

    Best regards,

    Riha


    • Edited by Riha46 Wednesday, September 11, 2019 5:51 PM
    Wednesday, September 11, 2019 5:50 PM
  • Hi,

    i found it: 

    Find out how to unlock all Windows 10 text to speech voices on Windows 10 PCs so that they become available system-wide.

    is it the solution?

    Wednesday, September 18, 2019 5:56 PM
  • Hi Richa46,

    Thanks for the feedback.

    You could use the following the code to detect if your voice has been installed.

     using (SpeechSynthesizer synth = new SpeechSynthesizer())
                {
    
                    Console.WriteLine("Installed voices -");
                    foreach (InstalledVoice voice in synth.GetInstalledVoices())
                    {
                        VoiceInfo info = voice.VoiceInfo;
                        Console.WriteLine(" Voice Name: " + info.Name);
                    }
                   
                }

    Or you could check the specific language by changing the following code.

      foreach (InstalledVoice voice in synth.GetInstalledVoices(new System.Globalization.CultureInfo("en-us")))

    Like the above code, if you want to detect english voice, you could use "en-us" to get it.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 19, 2019 5:37 AM
    Moderator
  • Hi Jack,

    thank you your support.

    Your first code:

    Installed voices -
     Voice Name: Microsoft Zira Desktop

    but, 

    I saw regedit and i found:
    Computer\HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Isolated\xrTP16EzYS_Vwfs4bJ3mPwN7k9u47XsvGLGzKgmaNqE\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_hu-HU_Szabolcs

    ??

    Best Regards,

    Riha


    • Edited by Riha46 Sunday, September 22, 2019 6:03 PM
    Sunday, September 22, 2019 6:03 PM
  • Hi Rica46,

    Thanks for the feedback.

    According the code you provided, it shows that you only installed a voice. I think that it is possible that you don't install the voice.

    For example, I have two voices: English and chinese. I could do text reading by using these two voices by using the above code I provided.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 24, 2019 5:28 AM
    Moderator
  • Hi Jack,
    so I installed the Hungarian sound, but only its narrator (I followed Microsoft's instructions)?

    How can I install it on TTS as well?

    Best Regards,

    Riha

    Wednesday, September 25, 2019 10:00 AM
  • Hi Riha46,

    Thanks for the feedback.

    What is TTS? I suggest that he could look for new ways in third-party product forum if you don't have any ways about it.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 26, 2019 8:05 AM
    Moderator
  • so I installed the Hungarian sound, but only its narrator (I followed Microsoft's instructions)?

    How can I install it on TTS as well?

    You can choose the registry key with SpObjectTokenCategory SetId Method :

    // Reference SpeechLib
    // Microsoft Speech Object Library
    
    SpVoice voice = new SpVoice();
    ISpVoice pVoice = (ISpVoice)voice;           
    
    SpObjectTokenCategory otc = new SpObjectTokenCategory();
    // otc.SetId("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices");
    otc.SetId("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices");
    ISpeechObjectTokens tokenEnum = otc.EnumerateTokens();
    int nTokenCount = tokenEnum.Count;
    Console.WriteLine("Number of voices: {0}", nTokenCount);
    foreach (ISpeechObjectToken sot in tokenEnum)
    {
        Console.WriteLine("Voice : {0}", sot.GetDescription());
        {
            pVoice.SetVoice((ISpObjectToken)sot);
            try
            {
                uint n = 0;                      
                pVoice.Speak("Hello! This is a test", 0, out n);
            }
            catch (System.Exception ex)
            {                       
                Console.WriteLine("Cannot speak with the voice : {0}", sot.GetDescription());
            }                    
            Marshal.ReleaseComObject(sot);
        }
    }

    Thursday, September 26, 2019 8:30 AM
  • Hi Castorix,

    I'm already stuck here:

    // Reference SpeechLib // Microsoft Speech Object Library

    i do not found SpeechLib in the reference..

    Can you help me ?

    (In which directory I find them?)

    Best regards,

    Riha


    • Edited by Riha46 Tuesday, October 1, 2019 5:04 PM
    Tuesday, October 1, 2019 5:02 PM
  • Hi Castorix,

    I'm already stuck here:

    // Reference SpeechLib // Microsoft Speech Object Library

    i do not found SpeechLib in the reference..


    In the COM tab, SAPI.DLL :

    • Marked as answer by Riha46 Thursday, October 3, 2019 7:19 PM
    Tuesday, October 1, 2019 5:37 PM
  • Hi Castorix,

    YOU are my savior.

    Thank you very much.

    It is perfect now.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using SpeechLib;
    using System.Globalization;
    using System.Speech.Synthesis;
    using System.Runtime.InteropServices;

    Szabolcs said, thank you for your help.

    Best regards,

    Riha

    Thursday, October 3, 2019 7:19 PM