Search code examples
iosspeech-recognitionios13

is on-device speech recognition a thing?


New in iOS 13, you're supposed to be able to say this (import Speech):

let req = SFSpeechAudioBufferRecognitionRequest()
let loc = Locale(identifier: "en-US")
guard let rec = SFSpeechRecognizer(locale:loc)
    else {print("no recognizer"); return}
print("rec isAvailable says: \(rec.isAvailable)")
if rec.supportsOnDeviceRecognition {
    print("on device recognition")
    req.requiresOnDeviceRecognition = true
} else {
    print("no on device recognition")
}

The trouble is that I get "no on device recognition" on all my devices. I can do speech recognition just fine; I just can't do on-device speech recognition. Is this feature real, or is it merely aspirational on Apple's part?


Solution

  • It's likely you're running into a known issue with supportsOnDeviceRecognition on 13.1. From the iOS/iPadOS 13.1 Release Notes:

    The supportsOnDeviceRecognition property always returns false the first time it’s accessed. After a few seconds, accessing it again returns the correct value. (47822242)