Sign in to follow this  
Followers 0
Noob

'Sound' question: How to detect when Text-To-Speech engine is "playing"

3 posts in this topic

This may not be possible, or it may just be way too complicated for an amateur like me.

I looked at the sound-related functions in the Help file. As far as I understand them they can be used (only) in relation to actual sound files. My problem is I have a need to detect if the sound being played by the computer is generated by the text-to-speech function of Windows.

A little bit of background: This is related to my freeware application which controls a third-party GPS navigation program. A user requested a feature which would mute his music (CD, MP3, etc) for the duration of the voice direction prompts given by the GPS navigation program (e.g. "Turn right in 1 mile"). Perhaps I could figure out how to mute the music, but I have no idea how to detect when the Windows Text-To-Speech engine (e.g. Microsoft Anna) is talking.

Any feedback/help/suggestions will be greatly appreciated.

Share this post


Link to post
Share on other sites



$o_speech = ObjCreate( "SAPI.SpVoice" )

$o_speech.Speak( "Turn right in 1 mile", 1 )

If Not $o_speech.WaitUntilDone( 10 ) Then
    PAUSE_MUSIC( )
EndIf

Do 
    Sleep( 100 )
Until $o_speech.WaitUntilDone( 10 )  

RESUME_MUSIC( )
        
$o_speech = ""

=)

Share this post


Link to post
Share on other sites

Thanks much for trying to help, but looking at your code I realized I should have been clearer about the fact that the voice direction prompts are coming from the 3rd party GPS navigation software (not from my application). So I need to detect when Text-To-Speech is "talking".

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