Sign in to follow this  
Followers 0
Wurschtbrot

TTs need help

8 posts in this topic

#1 ·  Posted (edited)

i use a pretty small / and easy to use script

i have a problem with it it does wait till speak is complete wich i dont want ..... i want to sent the command to the api and resume script asap without having to wait for the end of the tts

Speak("Test")
Exit 1
Func Speak($oSpeech_msg)
Local $oSpeech = ObjCreate("SAPI.SpVoice")
If ISObj($oSpeech) Then $oSpeech.Speak($oSpeech_msg)
EndFunc

i want it to speak the word test and exit instandly ^^

without waiting for the tts speaker to finish the text

any idea ?

Edited by Wurschtbrot

Share this post


Link to post
Share on other sites



Hi!

I extracted the code you needed form ProgAndys SAPI example, here

Global Enum Step *2 $SPF_ASYNC,          _
    $SPF_PURGEBEFORESPEAK,  _
    $SPF_IS_FILENAME,      _
    $SPF_IS_XML,  _
    $SPF_IS_NOT_XML, _     
    $SPF_PERSIST_XML, _
    $SPF_NLP_SPEAK_PUNC,    _
    $SPF_NLP_MASK,       _
    $SPF_VOICE_MASK,       _
    $SPF_UNUSED_FLAGS
Global $m_speakFlags = BitOR($SPF_ASYNC,$SPF_PURGEBEFORESPEAK)


Global $voice = ObjCreate("SAPI.SpVoice")

$voice.Speak("hello8888",$m_speakFlags)
Msgbox(0,"","")

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

So just to clarify, you want the script to exit before the word test is finished?

So presumably if it were reciting a long line of text you want the script to end but the speach to carry on?

If so, I think your out of luck

Share this post


Link to post
Share on other sites

So just to clarify, you want the script to exit before the word test is finished?

So presumably if it were reciting a long line of text you want the script to end but the speach to carry on?

If so, I think your out of luck

it has to "continue the script" exit was just a example ^^

i dont want it to wait for the speaker to finish his talk gonna try the stuff in 1st reply now :)

Share this post


Link to post
Share on other sites

Hi!

I extracted the code you needed form ProgAndys SAPI example, here

Global Enum Step *2 $SPF_ASYNC,          _
    $SPF_PURGEBEFORESPEAK,  _
    $SPF_IS_FILENAME,      _
    $SPF_IS_XML,  _
    $SPF_IS_NOT_XML, _     
    $SPF_PERSIST_XML, _
    $SPF_NLP_SPEAK_PUNC,    _
    $SPF_NLP_MASK,       _
    $SPF_VOICE_MASK,       _
    $SPF_UNUSED_FLAGS
Global $m_speakFlags = BitOR($SPF_ASYNC,$SPF_PURGEBEFORESPEAK)


Global $voice = ObjCreate("SAPI.SpVoice")

$voice.Speak("hello8888",$m_speakFlags)
Msgbox(0,"","")

:)

this is perfect even tho id prefer it not to stop but it is ok already can u explain the variable im pretty new to api`s / or objekts

Share this post


Link to post
Share on other sites

it has to "continue the script" exit was just a example ^^

i dont want it to wait for the speaker to finish his talk gonna try the stuff in 1st reply now :)

Well yes the method posted by monoceres should allow you to continue, but if you exit the speach will stop :P

Share this post


Link to post
Share on other sites

this is perfect even tho id prefer it not to stop but it is ok already can u explain the variable im pretty new to api`s / or objekts

As you will learn if you dig deeper into interacting with the windows api, msdn is your best friend.

Here's the msdn links that was used in the example:

http://msdn.microsoft.com/en-us/library/ms720570(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms719820(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms717252(VS.85).aspx

Good luck!

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Well yes the method posted by monoceres should allow you to continue, but if you exit the speach will stop :)

well i wont exit i will use it for audio output while a makro,

and a little tts for my little brother, hes not that good @ reading

Global Enum Step *2 $SPF_ASYNC,          _
    $SPF_PURGEBEFORESPEAK,  _
    $SPF_IS_FILENAME,      _
    $SPF_IS_XML,  _
    $SPF_IS_NOT_XML, _     
    $SPF_PERSIST_XML, _
    $SPF_NLP_SPEAK_PUNC,    _
    $SPF_NLP_MASK,       _
    $SPF_VOICE_MASK,       _
    $SPF_UNUSED_FLAGS
Global $m_speakFlags = BitOR($SPF_ASYNC,$SPF_PURGEBEFORESPEAK)

Global $voice = ObjCreate("SAPI.SpVoice")


If ISObj($voice) Then 
$voice.Speak("Text in Sprache Aktiviert.",$m_speakFlags) 
Else
ToolTip("Text in Sprache Deaktiviert.")
Sleep(2500)
ToolTip("")
exit 1
EndIf

While 1
$oldget = ClipGet()
Sleep(100)
if ClipGet() <> $oldget Then
if ClipGet() <> "" then Speak(ClipGet())
EndIf
WEnd

Func Speak($oSpeech_msg)
$voice.Speak($oSpeech_msg,$m_speakFlags)
EndFunc

wont post the makro/script tho its 1.21 mb big already :P

atm i have a gui wich i will kick out for this maybe on / off func that it wont bugg me so much ^^

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0