Find All Installed TTS Voices for Microsoft Speech Platform SDK (C#)

 

When working with Text To Speech (TTS) voices such offered in the Microsoft Speech Platform SDK and Server Runtime Languages it is not apparent that the voices are actually installed. These voices are offered in an SDK for developers but are not integrated as part of the systems TTS options as you would expect to find in the control panel, speech properties section.

Here is a quick how to for those wanting to install and use these TTS voices in their own C# project.

Download and install the SpeechPlatformRuntime.msi from here:
http://www.microsoft.com/en-us/download/details.aspx?id=24974

Make sure you install the correct version, x64 or x86.

Download and install language and voice packages you prefer from here:
http://www.microsoft.com/en-us/download/details.aspx?id=3971

Start a new C# console project in Visual Studio Express 2012 or whatever version you prefer and name it “SpeechVoicesCheck”.

Take the Micosoft.Speech.dll file and copy it into your project directory and note its location.

Add as a reference to the project by browsing to where you put Microsoft.Speech.dll and including it. This allows you to now add the in the using section to make use of the platform methods:

using Microsoft.Speech.Synthesis;

Here is the code to for the new project which will list all of your installed voice packages and some information regarding them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Speech.Synthesis;

namespace SpeechVoicesCheck
{
    class Program
    {
        static void Main(string[] args)
        {
            SpeechSynthesizer speaker = new SpeechSynthesizer();
            Console.WriteLine("INSTALLED VOICES");
            Console.WriteLine("");

            
            foreach(InstalledVoice voice in speaker.GetInstalledVoices())
            {
                VoiceInfo info = voice.VoiceInfo;
                
                Console.WriteLine("Voice: " + info.Id + " : " + info.Name + " : " + info.Gender + " : " + info.AdditionalInfo);
                Console.WriteLine("");
            }

            Console.WriteLine("");
            Console.WriteLine("Press any key to close...");

            Console.ReadLine();

        }
    }
}

Leave a Reply

*

code