I’m trying to use one class from the MonkeyBread Library to make my Mac say a first sentence ,then wait until the sentence has been pronounced completely by the synthesizer, then say a second sentence.
This is the code I’m using:
[code] Dim voice As New NSSpeechSynthesizerMBS()
Call voice.startSpeakingString(“and Jerry”)[/code]
The final result I’d like to obtain is to make it say “Tom and Jerry”.
I tried to check if the speech synthesizer is still talking by checking the boolean value of NSSpeechSynthesizer.isAnyApplicationSpeaking, but it’s not working as its value remains true.
Do you know if there’s another method or property I could check to see if my Mac is still talking before going on and make it say another phrase?
Can’t speak to the MBS plug-in but if you check at Apple …
Indicates whether any application is currently speaking through the sound output device.
YES when another application is producing speech through the sound output device, NO otherwise.
You usually invoke this method to prevent your application from speaking over speech being generated by another application or system component.[/quote]
I’m not sure if this Boolean checks when the speech is generated by the same application.
If you take a look at my code above you’ll see that I’m actually polling the isAnyApplicationSpeaking method, but it is always returns me the boolean value “true”, even when the computer is not saying anything.
As it seems unexpected, you should ask help directly from @Christian Schmitz . Are you using the latest MBS Lib?
I wrote a whole app on this (Speed Reading) in the MAS. I used Christian’s examples plus some extra sauce of my own. As I remember the class itself holds all the events you need and this is where you need to place your code as these events are called. It even calls the events on each word allowing you to highlight each word/sentence/paragraph as it is being spoken.
I don’t know why, but the very same source code that yesterday was looping on “While (voice.isAnyApplicationSpeaking())” today is working properly!