Speech recognition in iOS — (only available from iOS 10)
Source: internet and internet.
iOS 10 introduces a new API for speech recognition. WWDC video link: https://developer.apple.com/videos/play/wwdc2016/509/
These apis helps us to convert audio of human speech to text to use within the application. It uses the same technology of that of Siri. The apple doc says that the speech recognition api is so powerful that it can give more information about the recognised data like the confidence level, more interpretation about what the user might have said, timing info etc.
The audio for recognition can be either a pre-recorded file or a live audio from a microphone. Any device running iOS 10 and above supports this feature and it can recognise upto 50 languages.
Active internet connection is required to perform this operation in most cases. Doc says that there are some exceptions which doesn’t require internet. The Speech APIs perform speech recognition by communicating with Apple’s servers or using an on-device speech recognizer, if available. To find out if a speech recognizer is available for a specific language, you adopt the
Because your app may need to connect to the servers to perform recognition, it’s essential that you respect the privacy of your users and treat their utterances as sensitive data. For this reason, you must get the user’s explicit permission before you initiate speech recognition.
Add the NSSpeechRecognitionUsageDescription key to your
Info.plistfile and provide the description about how your app uses the speech api for. If you are using live audio, then you should ask permission for microphone as well. Add NSMicrophoneUsageDescription key to your
The above code works for pre recorded audio file.
Github Project link: https://github.com/abhimuralidharan/SpeechToText
Reference: Envato Tuts+ Tutorial: Using the Speech Recognition API in iOS 10
And before you go…
If you found this article helpful, click the💚 button below or share the article on Facebook so other people can benefit from it too.