Author Topic: To change voice  (Read 10321 times)

miso58

  • Newbie
  • *
  • Posts: 11
To change voice
« on: April 25, 2018, 05:38:09 AM »
Hello everybody,
in an app I want at some point change the female voice by a male voice and vice versa
is it possible ?
and if yes, how ?
Thanks

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #1 on: April 25, 2018, 02:31:16 PM »
I'm not sure it is possible to change the default voice automatically with VA without resorting to an inline function that makes registry changes. This would be somewhat similar to how the Change Speech Recognition Profile commands work.

You certainly can go into the options for a given profile and then manually change the "default text-to-speech voice," but again this is not automated.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #2 on: April 25, 2018, 02:59:34 PM »
Hmm, what exact are you using the voices for, or maybe the question is how are you using the voices. If I had a better idea of what your doing, I might be able to find a workaround for you.

miso58

  • Newbie
  • *
  • Posts: 11
Re: To change voice
« Reply #3 on: April 25, 2018, 03:27:11 PM »
@iceblast
the goal is that in a specific environment, I would use a female voice
and in another environment I would use a male voice
and why not in a third environment another voice

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #4 on: April 25, 2018, 04:01:04 PM »
OK, I found a way to change the default windows voice.

It's by having VoiceAttack run a ahk program.

When you run it, a menu opens, and shows you a list of all your voices you have installed. Each Voice has a number beside it. You type the number for that voice, and hit Enter, or click Ok.

In this case you want to hit Enter.

I made a little command, that will run the ahk program, and enter a number and hit Enter to change the voice.

You can have this program run, and set a voice for each app you go into.

Or you can make a command name like, "Change to Amy" and it will change the voice to Amy.

Below I've attached two files.

1. Change Windows Default Voice-Profile.Vap  ;Profile that has the command in it. Just import in it into your profile.
2. Change Windows Default Voice.exe ;This is the AHK program, put this in your VoiceAttack Apps directory. c:\Program Files (x86)\VoiceAttack\Apps\ ;This is usually the default path.

Once you have Change Windows Default Voice.exe, run it, and you'll see the menu with the numbers and voices, make a note of what number is what voice, and then change the command to match the voice you wish.

Nice little program. :)
« Last Edit: April 25, 2018, 04:07:48 PM by iceblast »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: To change voice
« Reply #5 on: April 25, 2018, 05:08:21 PM »
Just to make sure: Are you referring to the voice used by VoiceAttack, or a voice used by another application entirely?

VoiceAttack itself accepts tokens in both profile-wide and action-specific TTS options, so you can change those on-the-fly.

miso58

  • Newbie
  • *
  • Posts: 11
Re: To change voice
« Reply #6 on: April 26, 2018, 03:52:09 AM »
@iceblast
thank you for your nice little program, but I see only 2 voices (Hortence (french) and Zira (US), but I have other voices (Julie / Paul / ....) and I don't see them. In fact in the registry I only have the 2 detected by your program. I don't know where are the other (perhaps you have an idea)

@pfeil
It's in the same profile, that I want to change the voice.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #7 on: April 26, 2018, 05:12:59 AM »
That's odd, I have 5 voices, and they are all seen. Sorry, I can't fix this, because I didn't write the program. I've seen the code for it, and it's beyond me.

Let me ask, are you using VA's ability to play text to speech? Meaning, you're having VA Say Something with Text to Speech? and not a 3rd party app that you're trying to use?

If you're using VA speech ability, you can change the voice VA uses, by Windows Title, or Process, or Process ID. Meaning, you can change the voice depending on what app you're in, and you can do all that within the same profile. No switching needed.

Actually, there are many ways to have the voice change. I actually have one command, that reads text, and it can be triggered 3 different ways. I could easily assign a different voice to each way if I wanted.


Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #8 on: April 26, 2018, 08:19:12 AM »
I feel like this would be good functionality to have built into VA (set the profile's default TTS voice with a VA action). I suggest you add this to the Feature Request thread for Gary to consider (if it's possible to do of course).

Otherwise like I mentioned previously I'll bet it could be made to work with a C# inline function that performs registry changes, though this would change your global Windows default TTS voice and may require resetting VA for VA to detect the changes. You would basically need to query the registry to obtain a list of available TTS voices, then loop through each voice name until you find a match against your desired voice name, and then activate that voice.

miso58

  • Newbie
  • *
  • Posts: 11
Re: To change voice
« Reply #9 on: April 26, 2018, 08:42:20 AM »
I think the solution is to create other profiles and to switch from one to another

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #10 on: April 26, 2018, 09:49:58 AM »
The the commands are the same but the "environment" that you want different voices is different then you can simply duplicate your original profile and make the TTS voice change for the new profile.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #11 on: April 26, 2018, 02:34:40 PM »
With the AHK program, you can change the voice, and VA will instantly use it, without restarting.

Here is the code for it. Maybe you or someone else can adapt it to work with VA easier.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #12 on: April 26, 2018, 05:14:58 PM »
Yep, registry changes :)

Quote
Maybe you or someone else can adapt it to work with VA easier.

I'm going to give this a try in my VA-AHK.Integration project and see how it goes.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: To change voice
« Reply #13 on: April 26, 2018, 07:20:26 PM »
If you notice in the Profile Options screen, the last item in the list is, 'Default Text-to-speech voice'.  This box can accept a variable name, tokens or literal text.  As long as the value resolves to a valid TTS voice name (as it is displayed), the profile's default voice will render this value every time.

As an example, if you go to the Profile Option screen and set the value in the, 'Default Text-to-speech voice' box to, 'defaultValue', the following will alternate between David and Hazel, given that the, 'Say' action is set to use the default voice:

Begin Boolean Compare : [toggleVoice] Does Not Equal True
    Set Boolean [toggleVoice] to True
    Set Text [defaultVoice] to 'Microsoft David Desktop'
Else
    Set Boolean [toggleVoice] to False
    Set Text [defaultVoice] to 'Microsoft Hazel Desktop'
End Condition
Say, 'I have something to say.'


Hope that opens up some options.

Edit - Pfeil mentioned this above.  No need to muck about with the registry, unless you just *want* to ;)

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #14 on: April 26, 2018, 09:59:18 PM »
Dang, didn't realize that was added as well. I'm learning new things all the time. :)

I made a profile for anyone that would like to use it. I hope it will hope someone understand how this can be done. Change it to suit your needs. :)

Under Profile Options at the bottom you'll see the Default voices option. Just type   Voice   in the box.
That's the name of the Variable. You can change that Variable in many ways. You don't need my profile to do it.

When you're making the variable for the name of the voice to be used, it's Cap sensitive, so write it exactly how windows has it written, otherwise, it won't work.

Example = IVONA 2 Joey OEM

If you look at the voices you have installed listed in windows, and VA can see this as well, you have to spell it exactly the same, Cap's and all, or it won't work. Just trying to make that clear. ;)

Also, this only changes the voice that VA will use, it doesn't change the Default voice that windows is using. So, any program that isn't using VA for text to speech will be using the Default windows voice.

The AHK program I listed above will change the default voice of windows. If that's something you need instead.

It's nice to have so many ways to change things.

VA just keeps getting better and better Gary! :)

miso58

  • Newbie
  • *
  • Posts: 11
Re: To change voice
« Reply #15 on: April 27, 2018, 08:18:26 AM »
@Gary
I Try what you write in the post, but it's not working
I have written the following in a VA command : Set Text [Default] to 'Microsoft Paul Mobile - French (France)' (save value to profile) and set Default in the profile general option
The voice is present in windows when I type the command : c:\Windows\SysWOW64\Speech\SpeechUX\sapi.cpl
but not in the registry




Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: To change voice
« Reply #16 on: April 27, 2018, 09:03:22 AM »
What Gary posted(and I inquired about), relates to the switching of voices that are already available in VoiceAttack, not the adding of non-recognized voices.


On Gary's post, if you followed the instructions to the letter it won't work; The line:
set the value in the, 'Default Text-to-speech voice' box to, 'defaultValue'
Should probably be
set the value in the, 'Default Text-to-speech voice' box to, 'defaultVoice'

So that it matches the actions given in the example.


Sometimes your brain just seems to type things autonomously while you're already thinking ahead, and they're not always what you intended ;)

miso58

  • Newbie
  • *
  • Posts: 11
Re: To change voice
« Reply #17 on: April 27, 2018, 09:13:35 AM »
@Pfeil @Gary
Sorry, it's work. It was a problem of voice definition

Thank you all, for your answers.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #18 on: April 27, 2018, 09:50:40 AM »
Thanks for pointing this out Gary! Totally forgot about that.

Quote
No need to muck about with the registry, unless you just *want* to
Lol. Glad I don't need to this time ;)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #19 on: April 27, 2018, 10:30:05 AM »
Quote
I'm going to give this a try in my VA-AHK.Integration project and see how it goes.

Works great! I can run the script directly through VoiceAttack without even having AHK installed :)

@iceblast: where did you acquire this script? I'm thinking about packaging it as another example in my AHK-VA.Integration project.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #20 on: April 27, 2018, 12:42:18 PM »
It was in the AHK forums. I just did a Google search for changing the Default windows voice in windows with AHK, and that came up in the search.

That's the reason I compiled the script into a .exe, because most people don't have AHK, and you don't need it installed when you compile it.


Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: To change voice
« Reply #21 on: April 27, 2018, 01:24:09 PM »
I've mashed so much crap into this app that I don't even know what's available o_O

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: To change voice
« Reply #22 on: April 27, 2018, 01:49:48 PM »

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #23 on: April 27, 2018, 02:54:10 PM »
LOL!!!

Yeah, but it's all mashed rather well, and just keeps getting better. :)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #24 on: April 27, 2018, 04:17:20 PM »
Should definitely go on the VA web page  :D

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: To change voice
« Reply #25 on: April 27, 2018, 04:21:14 PM »
And that's one of the benefits of my VA-AHK.Integration project - all you need is raw AHK code and the inline functions will fire it out no problem. Should be releasing it soon :)

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: To change voice
« Reply #26 on: April 27, 2018, 05:31:53 PM »
Nice!

tabnation

  • Newbie
  • *
  • Posts: 1
Re: To change voice
« Reply #27 on: March 10, 2022, 05:34:46 PM »
Hope this helps. I did a video on how to do this in AHK
https://www.youtube.com/watch?v=zwInBsU5YCI