views:

241

answers:

1

I'm working on a program that includes speech synthesis. A few weeks ago, I wrote the introductory

    using (SpeechSynthesizer s = new SpeechSynthesizer())
    {
        s.SetOutputToWaveFile("file.wav");
        s.Speak(textBox1.Text);
    }

program. It worked just fine. I crossed off "research speech synthesis" from my task list and moved on to other parts of the project.

Now I'm writing a real program, and trying to use this same basic block of code. However, it is now failing on the s.SetOutputToWaveFile call. It throws a PlatformNotSupportedException, with the following message: "No voice installed on the system or none available with the current security setting."

I'm on 32-bit Vista. As far as I can tell, both programs have the same compiler settings. Note that this is a Winforms app, and not ASP.Net or anything partially trusted. I pulled up the original program in another instance of Visual Studio, and it still works just fine.

Any ideas?

Edit, 11/9/09:

I've added a bounty, and now even just this program:

static void Main(string[] args)
{
    using (SpeechSynthesizer ss = new SpeechSynthesizer())
    {
        ss.Speak("Hello There");
    }
}

fails. I'm guessing that there's some permission or something that I need to set, but I can't find it. My other program - the initial, basic program that does exactly the same as this new one, still works.

+1  A: 

can you compare with WinDiff both .csproj file and look if they use the same stuff for the references?

Maybe one use a local file(in his own sub directory) while the other use a system file?

Fredou
The working program was referring to System.Speech, while the non-working program was referring to Microsoft.Speech. They had completely different references! I already diffed the .csproj files looking for security differences and missed the different references entirely.
Aric TenEyck