Search code examples
c#text-to-speechspeech

TTS in C# .net 6 - No voice installed on the system or none available with the current security setting


It seems that Microsoft wants us to use Azure Cognitive APIs, but my app is just a local app that I want to run to assist me in tasks.

System.Speech doesn't exist in .NET6 anymore.

I downloaded the Speech SDK, which gives me access to Microsoft.Speech. I added a reference to the DLL in my project.

That all works fine, but I get the error message:

No voice installed on the system or none available with the current security setting.
using System;
using Microsoft.Speech.Synthesis;

SpeechSynthesizer ssTest = new SpeechSynthesizer();
System.Diagnostics.Debug.WriteLine(ssTest.GetInstalledVoices().Count);

When I go to the control panel - speech settings - there are several voices installed and working.

I looked at several older answers here, checked the correct registry settings, reinstalled the SDK, and also the speech runtime, but nothing helped so far.

I also tried running the app as administrator. Same result.

Any idea what I can do to fix this?


Solution

  • for me you have a problem of 32/64bits application

    you could check the voices installed:

    type in window terminal

    C:\Windows\SysWOW64\Speech\SpeechUX\sapi.cpl (app 32 bits)

    or

    C:\Windows\System32\Speech\SpeechUX\sapi.cpl (app 64 bits)

    System32 is the 64-bit Windows system directory and SysWOW64 is the 32-bit Windows system directory (entirely the opposite way around to what the directory names would suggest)

    If you have voices installed, may be the dll is really incompatible with net6... so the only solution i see is to do create a wrapper to your application using speech sdk from your net6 application..

    EDIT

    another solution is to install the nuget package System.Speech 6.0.0 developped by MIT on nuget

    i am using this package without problem