Software Archive
Read-only legacy content
17061 Discussions

Speech Synthesis.

HexLord
Beginner
458 Views

hi,

while going through the documentation for speech synthesis, I found a code snippet where we are asked to write a code to send audio to the audio device.Can anyone tell me how to do that. my code is C#

Thanks,

Shaleen

0 Kudos
7 Replies
Xusheng_L_Intel
Employee
458 Views

Please looked at the sample code @C:\Program Files (x86)\Intel\RSSDK\framework\CSharp\voice_synthesis.cs Thanks!

0 Kudos
HexLord
Beginner
458 Views

hi,

I dont understand the program structure in the speech synthesis sample. I have the text in a string, just want to send it to audio source.

How can I do that?

Thanks,

Shaleen

0 Kudos
Sahil_Kariyania_
Beginner
458 Views

Hi Shaleen,

If you go and read through documentation, its all easy. However if you are still unable to understand structure of code, do follow this simple steps.

  1. Navigate to <Installation_DIR>\RSSDK\framework\CSharp\voice_synthesis.cs
  2. Copy VoiceOut.cs and VoiceSynthesis.cs files to your project directory.
  3. Use this function string sts=VoiceSynthesis.Speak("Voice Synthesis (Nuance* Vocalizer Expressive*)",<LANG_CODE>,<your string for synthesis here>, curr_volume, curr_pitch, curr_speech_rate);

sts is string value containing status of device. (for debug purpose).

"Voice Synthesis (Nuance* Vocalizer Expressive*)" is a string value specifying your depth camera.

Where default value for curr_volume, curr_pitch & curr_speech_rate is 100,100,80 respectively. You may change it, if required.

LANG_CODE is 0 For English.

These values are passed to static Speak function written in VoiceSynthesis.cs, therefore you can call it directly without creating instance of class VoiceSynthesis. Make sure that you are using proper namespaces.

It may help you code your logic faster. Once it works, make sure you go through these two files as well documentation.

Thanks.

0 Kudos
HexLord
Beginner
458 Views

Hi Sahil,

Thanks for the reply.

I tried calling the Speak function but kept on getting an error:"failed to create the synthesis module".

here's the code I tried. I did include System.Media.

static void Main(string[] args)
{

  string sts= voice_synthesis.cs.VoiceSynthesis.Speak("Voice Synthesis(Nuance* Vocalizer Expressive*)", 0, "Hello", 80, 100, 100);
           Console.WriteLine(sts);
           Console.ReadLine();
}

Also, are the participant allowed to import class files from the samples directly?

I found little help in the samples but the documentation doed not seem to touch upon the details. There was no mention of Nuance module and it talked about using buffers .

 

0 Kudos
Jonathan_M_Intel
Employee
458 Views

This is an easy fix.  You are missing the space between Synthesis and (.  Should be "Voice Synthesis (Nuance* Vocalizer Expressive*)"

0 Kudos
HexLord
Beginner
458 Views

Hi Jonathan,

Thanks for the reply.

I tried implementing your solution but it still didn't work.

Here's the new snippet:

 
           string sts = voice_synthesis.cs.VoiceSynthesis.Speak("Voice Synthesis (Nuance* Vocalizer Expressive*)", 1, "Hello", 80, 100, 100);
            if (sts != null) MessageBox.Show(sts);

 

Pls suggest something.

 

Thanks,
Shaleen

0 Kudos
Jonathan_M_Intel
Employee
458 Views

Looks like you changed your language code from 0 to 1.  Try changing it back to 0.

0 Kudos
Reply