Speech API select voice under a service

Here is an interesting one.  I have a program that has no visible user interface, as it runs as a service.  It does talk Using SPVOICE.

 I would like to have it speak with a certain voice, but it always selects the default voice.  Since there is no user, it cant select the default voice for the user, as there is no user.  So, where does it get the voice it selects?  It seems to pick Sam.  I have a user interface for changing settings (when there is a user logged on) where i would like to set the voice, but it uses an spobjecttoken as the object to select the voice, and i dont know how to save that to the registry.

John Gjonola
Who is Participating?
quintsystemsConnect With a Mentor Commented:
If you install the speach SDK you can get different voices.  Once installed, go to the control panel, speech and the TEXT TO SPEECH tab and you should have three voices to choose from: Microsoft Mary, Microsoft Mike and Microsoft Sam.  I don't know how to get other voices and they might cost money.  I prefer Microsoft Mary.
I would try setting the service credentials to your username, restart the servce, and see if it uses the default voice you select for running the parent application in your user context.  If so, then create a user (admin if needed), log that user on and set it's default voice, then log off that user.  This will create a profile for that dummy user and set the HKCU key that likely holds the value.  Set the service to use that dummy user's credentials.  If the dummy user needs to be administrator level, you may want to remove the ability to log on locally in the local security settings (or domain/GPO if you use a domain admin user).
publicvoid, If you don't mind, can you tell me what progrma is it and how to get it..?
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Look in HKEY_USERS\.Default

If you already know the location in the HKCU registry hive where the voice selection is stored, then either update that same location in HKU\.Default, or create it.

If you don't know where it's stored, either search for the voice name, or use a tool such as REGMON from sysinternals.com to monitor the registry as you change the voice.

Note that changing the .DEFAULT key means that users who log on for the first time will receive the configured settings as their initial settings.
Be carreful with Speech, because on Win 2000, there's only one voice available. Maybe that is your problem ? can you change the voice with a GUI app ?
A Windows service does have a user. Check the Services - Properties, under the Log On tab. The logon defaults to 'Local System account' which is a special Windows user. You might try setting it to log in under another user.
Based on the initial post, "but it always selects the default voice" leads me to believe that the other voices are already installed. Therefore, installing the Speech SDK to get more voices won't resolve the issue.

Just my 2 pesos.
All Courses

From novice to tech pro — start learning today.