Jeff Brown
Jeff Brown

Reputation: 86

OSX Sierra Nsspeechrecognizer issues

Rather than bore you with a bunch of code I will summize it below.

In app delegate I create an nsspeechrecognizer set its delegate, add commands, and then start listening.

Speech recognizer recognizes the command the first time and continues as long as i do not stop it from listening.

Once I stop the speech recognizer by calling stoplistening, subsequent calls to start listening are made but no commands that have previously been recognizer are recognized a second time.

I have confirmed that the commands array remains the same. It is kind of a "each command works once" type thing.

The only way to get commands recognized again is to kill the speech recognizercore.broker process. Relaunching my app does not do this.

This was not an issue on el cap. Has any one experience oddities such as this with Sierra.

Let speechRecognizer = NSSpeechRecognizer()
speechRecognizer.delegate = self
speechRecognizer.listenInBackgroundOnly = false
speechRecognizer.commands = cmdArray
speechRecognizer.startListening()

In didrecognize command delegate

If cmd== specificCommand {
     Print("heard")
     // commenting out the following line allows recognizer to continue functioning correctly
     speechRecognizer.stopListening()
}

Another method calls start listening again. And commands are recognized after startlistening is called..... except for commands that have already been recognized.

This is compile using swift 2.3 on Xcode 8 on a Sierra machine

Upvotes: 0

Views: 224

Answers (1)

Jeff Brown
Jeff Brown

Reputation: 86

While I didn't solve this issue. I was able to work around the issue by shortening all commands to "do something for (nickname)" from "do something for (firstAndLastName)"

It is illogical that the issue is resolved by such. The "broker" I put and output in Xcode now suggests to me that nsspeechrecognizer may be "grading" recongnitions.

Upvotes: 1

Related Questions