Is there some FB code that will let you choose what sapi voice you want to do the talking ?
I have a number of FB progs that convert text to speech text but dont know how to select or change the voice from within FB
what needs adding to this in order to change the default voice (which is M$ mary as far as i can tell) though M$ sam is the stuck choice in control panel/speech. it is M$ mary that plays with this code below
sapi4 code plays a female voice for me m$ mary
Code: Select all
'speech => SAPI4 test, Windows only
#define UNICODE
#include once "disphelper/disphelper.bi"
#include once "windows.bi"
'
dim myt as wstring * 512
dim as integer isSpeaking
dim as HRESULT hr
DISPATCH_OBJ(tts)
'
screen 13
WindowTitle "SAPI 4 Test"
print "Attempting speech now"
print
'
dhInitialize( TRUE )
dhToggleExceptions(FALSE) 'set this true to get error codes
'
myt="Speech.VoiceText" 'SAPI 4
hr=dhCreateObject(@myt, NULL, @tts)
if hr<>0 then
print "Problems encountered, speech failed,"
print " sleeping to exit"
sleep
end
end if
'
dhCallMethod(tts, ".Register(%S, %S)", "", @"DispHelper Sample Application")
dhPutValue(tts, ".Enabled = %b", TRUE)
'
myt="SAPIhlh Version 4 was found on your computer."
dhCallMethod(tts, ".Speak(%S, %d)", @myt, 1)
'myt="SA your computer."
'dhCallMethod(tts, ".Speak(%S, %d)", @myt, 1)
'
isSpeaking=1
while isSpeaking=1
sleep 100
dhGetValue("%b", @isSpeaking, tts, ".IsSpeaking")
wend
'
print "SAPI Version 4 found"
print "Done, sleeping"
sleep
SAFE_RELEASE(tts)
end
'not FreeBASIC below !!!
'Module TTSHelloWorld
' Sub Main()
' Dim ttsVoice As New Speech.Synthesis_SpeechSynthesizer ttsVoice.speak(“Hello world!”)
'End Sub
'End Module
I have dozens of installed voices and can choose them at will if i run various this app or that app
M$sam seems to be stuck with windows narrator
----------------------------------------------------
[i]off topic from sapi voice question i found this link for speech macros[/i]may come in handy at some stage
http://code.msdn.microsoft.com/wsrmacros/Wiki/View.aspx?title=speechMacros&referringTitle=Command%20Set