Hello Everyone,
So this class is for text to speech for the following screenreaders.

Windows Narrator

What can you do with this class?
Simply put, you can use this to implent text to speech in your C Sharp projects.

How to use?

1: TTSEngine.Engine = Engine.NVDA;
Using the above statement you can set the engine you wish to use.

2: Rate, Volume etc.
These are only used for windows narrator.
And speak for itself ( See what i did there?).

3: TTSEngine.Speak("Hello World");
Using the above function you can make it say whatever you wish.

You will need the following libraries for it to work.

FSAPI.dll (Jaws library).

I cant share these libraries.
You will need to find them online or contact me so i can send them personally.

The class i wrote ifs for simplified purposes.
For programmers that are more advanced i know i should use constructor , destructor handling completed states etc.
However like i state i wanted it as simple as possible.
Withouth it running into issues.
So below you will find the class.

//Project: TextToSpeech
//Class: TTSEngine.cs
//Author: XSense.
#region Imports
using System;
using FSAPILib;
using System.Runtime.InteropServices;
namespace TextToSpeech
    class TTSEngine
        #region DLL Imports
        [DllImport("nvdaControllerClient.dll", CharSet = CharSet.Unicode)]
        static extern long nvdaController_speakText(String text);
        #region Fields
        public static int Volume { get; set; }
        public static int Rate { get; set; }
        public static int VoiceID { get; set; }
        public static Engine SpeechEngine { get; set; }
                #region Enumeration
        public enum Engine
            Default, NVDA, Jaws
        #region Engines
        private static FSAPILib.JawsApi Jaws = new JawsApi();
        private static System.Speech.Synthesis.SpeechSynthesizer DefaultEngine = new System.Speech.Synthesis.SpeechSynthesizer();
        #region Speak
        /// Speaks Message Using TTSEngine
        /// <summary>
        /// </summary>
        /// <param name="info">String Message</param>
        public static void Speak(string info)
                                //Switch on engine
                switch (SpeechEngine)
                    case Engine.Default:
                        DefaultEngine.Volume = 100;
                        //DefaultEngine.Rate = Rate;
                    case Engine.Jaws:
                    case Engine.NVDA:
            catch (Exception)

Homepage: http://xsense.venict.nl
Skype: xsense29

Thumbs up


the nvda ones are easy to find though I don't know about that nvdahelper.dll, I know what the nvdahelper.exe is though, its like a bridge that the nvda.exe process offloads work to because nvda.exe is 32 bit ,and nvdahelper is 64 bit, and the two processes communicate back and forth.

The bipeds think this place belongs to them, how cute.

Thumbs up


consider adding  auto-detection, or minimally a boolian to see if the reader the user wishes to speak through is even active.

With NVDA it's simply nvdaController_testIfRunning.
The same can't be said for JFW, although you could always see if speaking a blank string is successful.

You can follow me on twitter, @cartertemm

Thumbs up