|
-
May 6th, 2006, 11:00 PM
#1
Thread Starter
Frenzied Member
changing/saving text-to-speech settings
I want to make a small app to set the speed and pitch of the current text-to-speech engine.
I've found how to change them, but it doesn't keep the new settings after the app closes.
anyone know how to save the new settings?
-
May 6th, 2006, 11:03 PM
#2
Addicted Member
Re: changing/saving text-to-speech settings
Can you show the part where you're saving and editing these values.
-
May 6th, 2006, 11:17 PM
#3
Thread Starter
Frenzied Member
Re: changing/saving text-to-speech settings
Here's my code.
VB Code:
Option Explicit
Private m_lOrgPitch As Long
Private m_lOrgSpeed As Long
Private m_bReset As Boolean
Private Sub cmdAction_Click(Index As Integer)
Select Case Index
Case 0 'test
TestVoice
Case 1 'save
Case 2 'reset
m_bReset = True
Reset
End Select
End Sub
Private Sub TestVoice()
Dim lSpeed As Long
Dim lPitch As Long
lSpeed = Val(txtSpeed.Text)
If lSpeed < DirectSS1.MinSpeed Then lSpeed = DirectSS1.MinSpeed
If lSpeed > DirectSS1.MaxSpeed Then lSpeed = DirectSS1.MaxSpeed
lPitch = Val(txtPitch.Text)
If lPitch < DirectSS1.MinPitch Then lPitch = DirectSS1.MinPitch
If lPitch > DirectSS1.MaxPitch Then lPitch = DirectSS1.MaxPitch
DirectSS1.Pitch = lPitch
DirectSS1.Speed = lSpeed
m_bReset = False
LoadTxtBoxes
DirectSS1.Speak txtTest.Text
End Sub
Private Sub Form_Load()
m_lOrgPitch = DirectSS1.Pitch
m_lOrgSpeed = DirectSS1.Speed
LoadTxtBoxes
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If m_lOrgPitch <> DirectSS1.Pitch Or m_lOrgSpeed <> DirectSS1.Speed Then
Select Case MsgBox("Would you like to keep the new settings?", vbYesNo Or vbQuestion Or vbDefaultButton1, App.Title)
Case vbYes
' DirectSS1.Pitch.save 'not a valid command
DirectSS1.Speak "New settings have been saved!"
'she just lied, it's not saving the settings
Case vbNo
Reset
DirectSS1.Speak "The old settings have been reset."
End Select
End If
End Sub
Private Sub Reset()
DirectSS1.Pitch = m_lOrgPitch
DirectSS1.Speed = m_lOrgSpeed
LoadTxtBoxes
End Sub
Private Sub LoadTxtBoxes()
txtPitch.Text = CStr(DirectSS1.Pitch)
txtSpeed.Text = CStr(DirectSS1.Speed)
End Sub
-
May 7th, 2006, 05:42 AM
#4
Re: changing/saving text-to-speech settings
You can save these settings to an ini file or you can use the dirty method using the registry SaveSetting and GetSetting.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
May 7th, 2006, 08:04 AM
#5
Thread Starter
Frenzied Member
Re: changing/saving text-to-speech settings
thanks Keith,
But the point of the app is to change the voice settings so that they stay that way no matter which program uses the voice.
For example, the default Mary voice sounds really bad.
But if you change both her pitch and speed to about 170, she doesn't sound too bad at all.
But not all programs that use TTS allow you to change or save the settings.
-
May 7th, 2006, 11:50 AM
#6
Re: changing/saving text-to-speech settings
 Originally Posted by longwolf
But not all programs that use TTS allow you to change or save the settings.
It does for me, I save my settings to an ini file.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
May 7th, 2006, 12:05 PM
#7
Thread Starter
Frenzied Member
Re: changing/saving text-to-speech settings
which ini are you talking about?
let me explain better.
I want this app only to adjust the settings.
Then if I open another program like Casino Verite, which uses msagent, the new setting will be heard there as well.
-
May 7th, 2006, 03:47 PM
#8
Re: changing/saving text-to-speech settings
You make your own ini file for the app your using.
By default the DirectSS1.Speed = 150, DirectSS1.Pitch = 125, DirectSS1.MaxSpeed = 250, DirectSS1.MinSpeed = 50
So when your app starts get these settings from the ini file and when it closes save them back to the ini file.
You have to watch out using the Speed and Pitch as sometimes it will give errors.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
May 7th, 2006, 05:53 PM
#9
Thread Starter
Frenzied Member
Re: changing/saving text-to-speech settings
Yes Keith,
I know I could do that for my own program.
But I want to change the default settings of the speech engine itself so that after changing them EVERY program I have that uses TTS will be using the new settings.
For example the Verite program I mentioned doesn't have an ini file for voice settings.
And I don't want to backward engineer it just to add one
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|