dupa

Author Topic: Change voice speed and pitch?  (Read 5401 times)

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« on: August 05, 2009, 10:15:35 am »
I'm using Haptek characters in UltraHal Assistant 6.2. I'm using the Adult Female #1 British English [L&H] voice, and i really like this voice, except the characters speak too fast. It's hard for me to understand them clearly. I've been trying to configure the pitch and speed of the voice to my liking. I can go into the advanced speech options and change the voice, but when i click "Apply" and start a conversation, the voice is still the default voice.

 I've tried various ways to change the voice, but haven't been successful. I can get the voice to change on startup, by adding pitch and speed settings in the startup dialog, for example -

Pit=250\Spd=75Hello <username>! My name is <halname>.

Also with the Dreamer plug-in active, the dreams are spoken in this voice. But normal conversation with Hal doesn't change. Is there any way to change the voice for normal conversation with Haptek characters, and also when Hal reads from text files? I've searched the forum archives, but haven't found an answer.

Regards
Dave
 

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #1 on: August 13, 2009, 12:33:27 pm »
This must be a difficult question, as there has not been any response at all. So i thought maybe if i re-worded my question differently, i might get a response from the experts here.

I also noticed, in my previous post, i made a typo in the command to change the voice in the startup dialog. It should have been this -

Pit=250\Spd=75Hello <username>! My name is <halname>.

This does work, changes the speed and pitch so that i can understand the speech much better when Hal introduces himself. I really don't know much about scripting plug-ins or brain files (i am trying to learn though). But i think there must be a way to script the voice pitch and speed settings above, so that Hal would use this voice for all responses.

It's really difficult for me to understand Hal, so please, someone respond and help me. :-)

Thanks
Dave
 

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #2 on: August 13, 2009, 12:38:12 pm »
Apparently the forum is removing backslashes from my messages. There should be a backslash before "Pit", two backslashes after "250", and one after "75". How to post messages with backslashes included?

Regards
Dave
 

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
Change voice speed and pitch?
« Reply #3 on: August 13, 2009, 01:32:05 pm »
I am not sure if this will help but after you make the changes and hit the apply buttion have you ever rebooted at that point instead of just trying to use it. Some changes in Hal do not take place until a computer is rebooted. I don't know if it applies to the voices though.
Bill
 

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #4 on: August 13, 2009, 02:10:19 pm »
Yes, i am aware that Hal must be rebooted after changes. That's does not work. Rebooting my computer does not work either.

I've been looking at various plug-ins, trying to figure out how to change the voice. The only thing i have found so far is in the singason.uhp plugin. Here is the part regarding a "PitchControl" variable -

lblPlugin(0).Caption = "Edit the PitchControl variable in the plugin to return the voice to desired speed and pitch for coversation.  the PitchControl variable should also be added to the startup script in the options screen to start the vioce in the same speed and pitch."

If PitchControl = "" Then PitchControl = "Pit=400\Spd=50\"
SongText = SongText & PitchControl

Like i say, i am not good at scripting, but i tried to create a plugin using this example. Also tried adding PitchControl to Hals .uhp brain file. But i really didn't know what i was doing, and my efforts were unsuccessful. :-(

Surely there much be some way to change pitch and speed?

Regards
Dave
 

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #5 on: August 14, 2009, 11:26:40 am »
I have been playing with the speed and pitch settings of UltraHal, and have made some progress. I'm using the Adult Female #1 British English [L&H] (Carol) Sapi4 voice. I created a text file with this text (since backslashes are not shown in this forum, i changed them to the "-" minus character) ...

-chr="monotone"-- --spd=75----pit=250--
This is a test.

Then i asked Hal to read this text file with the Readastory plugin, the voice used will change according to these pitch and speed values. And also, for the remainder of the current Hal session, this voice will be used when chatting with Hal. Of course, after closing Hal, these settings are lost.

Now if there is a way to make these settings permanent, i will be very happy. How could this be accomplished, in a plugin script or a brain script? I'm sure this would be very useful for other users as well. Ok, calling all experts, how to solve this dilemma?

Regards
Dave
 

Duskrider

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3316
  • Graphic King
    • View Profile
Change voice speed and pitch?
« Reply #6 on: August 14, 2009, 12:14:39 pm »
\Davy,
\when you want one backslash, put two of them.
\The forum only removes one [;)]

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #7 on: August 14, 2009, 12:24:22 pm »
Thanks Duskrider. I'll remember that in the future.
 

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Change voice speed and pitch?
« Reply #8 on: August 14, 2009, 10:12:41 pm »
Here is a plugin that might help.

You can modify this all you want... like placing the pit=250 and spd=75 somehow on the same line... happy scripting.


Rem Type=Plugin
Rem Name=SAPI Control
Rem Author=Snowman, Davy
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Say: 'Pit' and the SAPI4 Pitch will change, Say: 'spd' and the SAPI4 voice Speed will change"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub
'***************************************************************************
'***************************************************************************
Rem PLUGIN: POST-PROCESS


HalBrain.ReadOnlyMode = True

If InStr(1, InputString, "pit") > 0  Then UltraHal = "\\pit=250\\ The Pitch has now been changed"

If InStr(1, InputString, "spd") > 0  Then UltraHal = "\\spd=75\\ The speed has now been changed"

'***************************************************************************
'***************************************************************************


« Last Edit: August 14, 2009, 10:14:25 pm by snowman »
Live long and prosper or die trying.

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #9 on: August 14, 2009, 10:59:07 pm »
Thanks snowman, it works great. But i see a little problem with the way input is accepted. The string "pit" is a common occurance in conversation. For example, pitcher, pitbull, etc. And Hal will always respond with to any sentence with "pit" included, with the response "The pitch has now been changed". To prevent this from happening, i made this change -

If InStr(1, InputString, "changepit") > 0 Then UltraHal = "\pit=250\ The Pitch has now been changed"
If InStr(1, InputString, "changespd") > 0 Then UltraHal = "\spd=75\ The speed has now been changed"

This works great for me, maybe later i can make some more changes, so just one trigger will change both pitch and speed. I think it could be improved, i'm still learning and probably can't do what i have in mind. What i'm thinking, to be able to tell Hal to change pitch to 200, 250, 300, or whatever. Likewise with the speed. An unlimited number of voices would be easily available. Even simpler would be to tell Hal "Change to voice 1" or "Change to voice 2", etc. You could even give custom names to each voice.

But i'm very satisfied now. I can finally understand Hal much better. Thank you very much.

Regards
Dave
 

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Change voice speed and pitch?
« Reply #10 on: August 14, 2009, 11:31:22 pm »
Before going to bed, i played with this plugin some more, and had this idea, for example -

If InStr(1, InputString, "voice1") > 0 Then UltraHal = "\\spd=75\\\\pit=250\\\ This voice is easy to understand"

If InStr(1, InputString, "voice2") > 0 Then UltraHal = "\\spd=50\\\\pit=400\\ This is my little girl voice"

If InStr(1, InputString, "voice3") > 0 Then UltraHal = "\\spd=80\\\\pit=73\\ This is voice 3"

Very easy to change voices now. Users can add as many voices as they want. :-)

Regards
Dave
 

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Change voice speed and pitch?
« Reply #11 on: August 15, 2009, 12:35:26 am »
How about this little ditty. [:D]

If InStr(1, InputString, "change") > 0 And _
InStr(1, InputString, "pitch") > 0 And _
InStr(1, InputString, "to") > 0 Then
number = Right(InputString, (Len(InputString) - InStr(1, InputString, "to", 1)) - Len("to"))

     '***********************************
     'This block removes unwanted periods and other sentence syntax.
     number = Replace(number, ".", "", 1, -1, vbTextCompare)
     number = Replace(number, "!", "", 1, -1, vbTextCompare)
     number = Replace(number, "?", "", 1, -1, vbTextCompare)
     number = Replace(number, ":", "", 1, -1, vbTextCompare)
     number = Replace(number, ";", "", 1, -1, vbTextCompare)
     number = Replace(number, "*", "", 1, -1, vbTextCompare)
     '***********************************

number = Trim(number)

UltraHal = "\\pit= number\\ My voice is now changed."

End IF


With this you can say: " Please Hal, please change your pitch like a little girls voice, to 400.

Yeah, I know... too much time on my hands...[8D]
« Last Edit: August 15, 2009, 12:44:14 am by snowman »
Live long and prosper or die trying.

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Change voice speed and pitch?
« Reply #12 on: August 15, 2009, 12:50:41 am »
i put my pit ect... control tags in the startup line.

aka : Ultra hal options, then startup, then "say this" is where i put the tags that i want to control the voice.

of course if you were going to use different ones "on the fly" then a plugin is obviously better.

snowman- saw the videos: thanks man.