Apple has opened the speech recognition feature in iOS 10. With this library it is quite simple to capture audio and convert it to text.
It requires iOS 10+ and the voice recognition itself requires an internet connection.
See Apple's best practices recommendation: https://developer.apple.com/reference/speech
Using this library:
1. Add these attributes and explain the usages:
#MinVersion: 10 #PlistExtra:<key>NSSpeechRecognitionUsageDescription</key><string>More information here...</string> #PlistExtra:<key>NSMicrophoneUsageDescription</key><string>Speech recognition</string>
3. Once authorized we need to call SpeechRecognition.SetLanguage. The example code checks whether the current language is supported and if not it uses English (en).
SetLanguage will return False if the speech engine is not available. This will happen if there is no Internet connection.
4. Call StartRecording to start capturing audio and call StopRecording when done.
The Result event will be raised with a list of captured text. The list is ordered based on the confidence level. First item is the best match.
Set the ReportPartialResults parameter to True if you want the Result event to be raised during the audio capture.
- If you are using a local Mac builder then it needs to run Xcode 8+. The hosted builders were updated to Xcode 8.
- Dictation must be enabled for this feature to work. You can enable it by clicking on the microphone button in the keyboard or under Settings - Keyboards.