I’m using Nuance’s SpeechKit (specifically the SKRecognizer class) in order to detect speech from the user when they click a button. However, if they don’t speak anything within a pre-determined amount of time (3 seconds or so), I want to cancel the recording session. Passing “SKShortEndOfSpeechDetection” in the init function doesn’t appear to do the trick, it will only stop the recording when the user has already spoken something. Is there some other way to accomplish this?
I’m using Nuance’s SpeechKit (specifically the SKRecognizer class) in order to detect speech from
Share
I have used Nuance’s SpeechKit before and unfortunately it is lacking a few things and I remember this being one of them.
You could try using a completely free, open-source speech framework for iOS called OpenEars.
However, if you are still going to try and use SpeechKit the only way I can see to accomplish what you want is by monitoring the
audioLevelproperty onSKRecognizer. According to the SpeechKit Docs this property describes:I have already checked and it is not KVO compliant so you can’t simply add an observer to monitor it’s changes. To monitor changes in this, you can just add an
NSTimerthat checks the value every so often.…
It’ll take some experimentation to find what a good threshold is. Using this method, you would then just need to keep track if the user has spoken or not and then use another timer to see if they have spoken before your pre-determined cut off time.