Converting hindi text to audio file using System.Speech

1.2k views Asked by At

I've a windows application, in which there is a text box. IN the text box the user will put some hindi text and the text will be converted to audio file.

I've used the following code

        try
        {
            using (SpeechSynthesizer speechSynthesizerObj = new SpeechSynthesizer())
            {
                PromptBuilder builder = new PromptBuilder(new System.Globalization.CultureInfo("hi"));
                builder.AppendText(txtText.Text);
                speechSynthesizerObj.SetOutputToWaveFile(@"D:\Work\AudioFile\NugetTestAudio.wav");
                // Speak the prompt.
                speechSynthesizerObj.Speak(builder);

            }
            MessageBox.Show("Text to media file conversion done!!!");
        }
        catch (Exception ex)
        {
            string message = ex.Message;
        }

The code is not throwing any error, and the audio file is getting generated, but there is nothing inside the audio file if I play.

Please, let me know what is missing in the code

0

There are 0 answers