Jump to content

TTs need help


Recommended Posts

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
Link to comment
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!

Link to comment
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

Link to comment
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 :)

Link to comment
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

Link to comment
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

Link to comment
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!

Link to comment
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 ^^

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...